summaryrefslogtreecommitdiffstats
path: root/lld/COFF/Writer.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [Support] Move Parallel algorithms from LLD to LLVM.Zachary Turner2017-05-111-1/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D33024 llvm-svn: 302748
* [Core] Make parallel algorithms match C++ Parallelism TS.Zachary Turner2017-05-101-8/+6
| | | | | | Differential Revision: https://reviews.llvm.org/D33016 llvm-svn: 302613
* COFF: support the /appcontainer flagSaleem Abdulrasool2017-04-061-0/+2
| | | | | | | | | The /appcontainer flag indicates that the module may only be used inside an application container (for isolation). This has been supported by link.exe since Windows 8.0. It sets an additional bit in the PE DLL Characteristics flag to indicate the behavioural change. llvm-svn: 299728
* Add a function to MD5 a file's contents.Zachary Turner2017-03-201-1/+1
| | | | | | | | | | | | | | | In doing so, clean up the MD5 interface a little. Most existing users only care about the lower 8 bytes of an MD5, but for some users that care about the upper and lower, there wasn't a good interface. Furthermore, consumers of the MD5 checksum were required to handle endianness details on their own, so it seems reasonable to abstract this into a nicer interface that just gives you the right value. Differential Revision: https://reviews.llvm.org/D31105 llvm-svn: 298322
* COFF: prevent nullptr dereferenceSaleem Abdulrasool2017-02-071-2/+6
| | | | | | | | If `/debugtypes` is used to omit the codeview information, we would not have constructed the debug info codeview record which is used to tie the PDB to the binary. In such a case, rub out the GUID and Age fields. llvm-svn: 294279
* COFF: Change the /lldmap output format to be more like the ELF linker.Peter Collingbourne2017-01-141-46/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D28717 llvm-svn: 291990
* COFF: tie the execute and the PDB togetherSaleem Abdulrasool2017-01-041-1/+1
| | | | | | | | The PDB GUID, Age, and version are tied together by the RSDS record in the binary. Pass along the BuildId information into the createPDB to allow us to tie the binary and the PDB together. llvm-svn: 290975
* COFF: replace a magic number and assert moreSaleem Abdulrasool2016-12-301-1/+4
| | | | | | | | | Assert that the size of the MD5 result is the same size as the signature field being populated. Use the sizeof operator to determine the size of the field being written rather than hardcoding it to the magic number 16. NFC. llvm-svn: 290764
* Remove lld/Support/Memory.h.Rui Ueyama2016-12-181-1/+1
| | | | | | | | | | | | I thought for a while about how to remove it, but it looks like we can just copy the file for now. Of course I'm not happy about that, but it's just less than 50 lines of code, and we already have duplicate code in Error.h and some other places. I want to solve them all at once later. Differential Revision: https://reviews.llvm.org/D27819 llvm-svn: 290062
* COFF: Use a bit in SymbolBody to track which symbols are written to the ↵Peter Collingbourne2016-12-111-2/+3
| | | | | | | | | | | | | | | | | | | | symbol table. Using a set here caused us to take about 1 second longer to write the symbol table when linking chrome_child.dll. With this I consistently get better performance on Windows with the new symbol table. Before r289280 and with r289183 reverted (median of 5 runs): 17.65s After this change: 17.33s On Linux things look even better: Before: 10.700480444s After: 5.735681610s Differential Revision: https://reviews.llvm.org/D27648 llvm-svn: 289408
* COFF: New symbol table design.Peter Collingbourne2016-12-091-15/+17
| | | | | | | | | This ports the ELF linker's symbol table design, introduced in r268178, to the COFF linker. Differential Revision: http://reviews.llvm.org/D21166 llvm-svn: 289280
* COFF: Use make() in SymbolTable and Writer.Rui Ueyama2016-12-091-8/+5
| | | | llvm-svn: 289170
* Remove unnecessary `llvm::`.Rui Ueyama2016-12-081-3/+3
| | | | llvm-svn: 289102
* Emit Section Contributions.Rui Ueyama2016-11-121-1/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D26211 llvm-svn: 286684
* Re-submit r283825: Add section header stream to PDB.Rui Ueyama2016-10-111-1/+9
| | | | | | | It was reverted because the change that depends on was reverted. Now it was submitted as r283925, so we can submit this as well. llvm-svn: 283926
* Revert "Add section header stream to PDB." because it depends on r283823.Rui Ueyama2016-10-111-9/+1
| | | | | | The change this patch depends on was reverted. llvm-svn: 283837
* Add section header stream to PDB.Rui Ueyama2016-10-101-1/+9
| | | | | | Differential Revision: https://reviews.llvm.org/D25357 llvm-svn: 283825
* Use StringSwtich::Cases for multiple choices.Rui Ueyama2016-09-301-4/+1
| | | | llvm-svn: 282964
* COFF: make builds more reproducibleSaleem Abdulrasool2016-09-091-11/+38
| | | | | | | Change the way we calculate the build id to use MD5 to give reproducible build ids. Previously we would generate random bytes for the build id GUID. llvm-svn: 281079
* Fix UBSan bot by not passing NULL into memcpy src.Ivan Krasin2016-08-311-1/+2
| | | | | | | | | | | | | | | | Summary: UBSan complains like the following: tools/lld/COFF/Writer.cpp:97:15: runtime error: null pointer passed as argument 2, which is declared to never be null The reason is that the vector could be empty. Reviewers: rsmith Subscribers: Eugene.Zelenko, kcc Differential Revision: https://reviews.llvm.org/D24050 llvm-svn: 280259
* COFF: disambiguate make_unique (NFC)Saleem Abdulrasool2016-08-291-2/+2
| | | | | | | This disambiguates `llvm::make_unqiue` and `std::make_unique` for the Windows buildbots. llvm-svn: 280014
* COFF: add beginnings of debug directory creationSaleem Abdulrasool2016-08-291-0/+76
| | | | | | | | | | The IMAGE_FILE_HEADER structure contains a (RVA, size) to an array of COFF_DEBUG_DIRECTORY records. Each one of these records contains an RVA to a OMF Debug Directory. These OMF debug directories are derived into newer types such as PDB70, PDB20, etc. This constructs a PDB70 structure which will allow us to associate a GUID with a build to actually tie debug information. llvm-svn: 280012
* COFF: hoist a local variableSaleem Abdulrasool2016-08-211-3/+7
| | | | | | Create a local variable for the rdata section. NFC. llvm-svn: 279407
* COFF: reorder the table constructionSaleem Abdulrasool2016-08-101-9/+9
| | | | | | | | Reorder the table setup to mirror the indices corresponding to them. This means that the table values are filled out as per the enumeration ordering. Doing so makes it easier to identify a particular table. NFC. llvm-svn: 278199
* COFF: Update error messages so that they start with lowercase letters.Rui Ueyama2016-07-151-1/+1
| | | | llvm-svn: 275513
* Make check() always return a value.Rui Ueyama2016-07-151-5/+3
| | | | | | | Previously, one of two check functions didn't return a value. It was confusing. This patch makes both functions return values. llvm-svn: 275511
* COFF: Remove `void error()` functions and use fatal instead.Rui Ueyama2016-07-151-2/+4
| | | | | | This change makes the control flow more explicit. llvm-svn: 275504
* COFF: Remove unnecessary explicit calls of Twine ctor.Rui Ueyama2016-07-141-1/+1
| | | | llvm-svn: 275501
* COFF: Rename noreturn error -> fatal.Rui Ueyama2016-07-141-4/+4
| | | | | | This new name is also consistent with ELF. llvm-svn: 275500
* COFF: Rename non-noreturn error -> check.Rui Ueyama2016-07-141-2/+2
| | | | | | The new name is consistent with ELF. llvm-svn: 275499
* [COFF] Add /section command line flag.Rui Ueyama2016-06-201-0/+18
| | | | llvm-svn: 273134
* [COFF] Don't call memcpy with a NULL argumentDavid Majnemer2016-03-201-1/+2
| | | | | | | | | | | | | Some declarations of memcpy (like glibc's for example) are attributed with notnull which makes it UB for NULL to get passed in, even if the memcpy count is zero. To account for this, guard the memcpy with an appropriate precondition. This should fix the last UBSan bug, exposed by the test suite, in the COFF linker. llvm-svn: 263919
* [COFF] Don't hard-code the load configuration sizeDavid Majnemer2016-03-151-2/+13
| | | | | | | | | | | | | | | | | | | | | The load configuration directory is a structure whose size varies as the OS gains additional functionality. To account for this, the structure's layout begins with a size field; this allows loaders to know which fields are available. However, LLD hard-coded the sizes (112 bytes for 64-bit and 64 for 32-bit). This means that we might not inform the loader of all the pertinent fields or we might claim that there are more fields than are actually present. To correctly account for this, the size field must be loaded from the _load_config_used symbol. N.B. The COFF spec is either wrong or out of date, the load configuration directory is not correctly documented in the specification: it omits the size field. llvm-svn: 263543
* [COFF] Use the correct size of the TLS directoryDavid Majnemer2016-03-151-1/+3
| | | | | | | | | The TLS directory has a different layout depending on the bitness of the machine the image will run on. LLD would always use the 64-bit TLS directory for the data directory entry instead of an appropriately sized TLS directory. llvm-svn: 263539
* Update for LLVM function name change.Rui Ueyama2016-01-141-9/+9
| | | | llvm-svn: 257801
* COFF: Rename RoundUpToAlignment -> align.Rui Ueyama2016-01-081-9/+8
| | | | llvm-svn: 257220
* COFF: Add /nosymtab command line option.Rui Ueyama2015-09-211-1/+2
| | | | | | | | | | | | | This is an LLD extension to MSVC link.exe command line. MSVC linker does not write symbol tables for executables. We do unless no /debug option is given. There's a situation that we want to enable debug info but don't want to emit the symbol table. One example is when we are comparing output file size. With this patch, you can tell the linker to not create a symbol table by just specifying /nosymtab. llvm-svn: 248225
* COFF: Move markLive() from Writer.cpp to its own file.Rui Ueyama2015-09-191-55/+0
| | | | | | | Conceptually, garbage collection is not part of Writer, so move the function out of the file. llvm-svn: 248099
* Remove unused #includes.Rui Ueyama2015-09-191-1/+0
| | | | llvm-svn: 248081
* COFF: Use parallel_sort in Writer::sortExceptionTable().Rui Ueyama2015-09-181-4/+6
| | | | | | | This patch saves 4 ms out of 5 ms. Very small improvement, but maybe better than nothing. llvm-svn: 248063
* COFF: Parallelize Writer::writeSections().Rui Ueyama2015-09-181-2/+3
| | | | | | | | Self-hosting took 801 ms on my machine. Of which this function took 69 ms. Now it takes 37 ms. That is about 4% overall performance improvement. llvm-svn: 248052
* COFF: Remove DefinedSymbol::isLive() and markLive(). NFC.Rui Ueyama2015-09-161-17/+14
| | | | | | | | | | | | | Basically the concept of "liveness" is for sections (or chunks in LLD terminology) and not for symbols. Symbols are always available or live, or otherwise it indicates a link failure. Previously, we had isLive() and markLive() methods for DefinedSymbol. They are confusing methods. What they actually did is to act as a proxy to backing section chunks. We can simplify eliminate these methods and call section chunk's methods directly. llvm-svn: 247869
* COFF: Fix bug that not all symbols were written to symtab if /opt:noref.Rui Ueyama2015-09-161-14/+13
| | | | | | | | | Only live symbols are written to the symbol table. Because isLive() returned false if dead-stripping was disabled entirely, only non-COMDAT sections were written to the symbol table. This patch fixes the issue. llvm-svn: 247856
* COFF: Rename /opt:lldicf -> /opt:icf.Rui Ueyama2015-09-161-1/+1
| | | | | | | Now that ICF is complete, we can rename this option so that the driver accepts the MSVC-compatible command line option. llvm-svn: 247816
* COFF: /delayload:<DLLNAME> is case-insensitive.Rui Ueyama2015-09-031-1/+1
| | | | llvm-svn: 246770
* COFF: Preserve original spelling of DLL file name.Rui Ueyama2015-09-021-3/+5
| | | | | | | | | | | This patch fixes a subtle incompatibility with MSVC linker. MSVC linker preserves the original spelling of a DLL in the import descriptor table. LLD previously converted all characters to lowercase. Usually this difference is benign, but if a program explicitly checks for DLL file names, the program could fail. llvm-svn: 246620
* COFF: Fix the order of the DLL import entry.Rui Ueyama2015-08-171-4/+11
| | | | | | | | | | | There are some DLLs whose initializers depends on other DLLs' initializers. The initialization order matters for them. MSVC linker uses the order of the libraries from the command line. LLD used ASCII-betical order. So they were incompatible. This patch makes LLD compatible with MSVC. llvm-svn: 245201
* COFF: Simplify Writer::createImportTables.Rui Ueyama2015-08-171-13/+7
| | | | | | | A short import library has up to two symbols, so we don't have to do a for-loop and type dispatch in createImportTables. llvm-svn: 245200
* COFF: In chunks, store the offset from the start of the output section. NFC.Rafael Espindola2015-08-141-5/+4
| | | | | | | | | This is more convenient than the offset from the start of the file as we don't have to worry about it changing when we move the output section. This is a port of r245008 from ELF. llvm-svn: 245018
* Update for llvm api change.Rafael Espindola2015-08-131-3/+4
| | | | llvm-svn: 244849
OpenPOWER on IntegriCloud