summaryrefslogtreecommitdiffstats
path: root/lld/ELF/InputFiles.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Remove variables. NFC.Rui Ueyama2016-07-151-6/+4
| | | | llvm-svn: 275605
* Inline traceUndefined function.Rui Ueyama2016-07-151-9/+5
| | | | llvm-svn: 275531
* Update comments.Rui Ueyama2016-07-151-3/+5
| | | | llvm-svn: 275530
* ELF: Make check() always return a value.Rui Ueyama2016-07-151-1/+2
| | | | | | This patch corresponds to r275511 for COFF. llvm-svn: 275521
* Fix memory leak.Rui Ueyama2016-07-081-2/+3
| | | | | | | | | | Symbol's dtors are not called because they are allocated using BumpPtrAllocators. So, members of std::unique_ptr type are not freed when symbols are deallocated. This patch is to allocate Thunks using BumpPtrAllocators. llvm-svn: 274896
* Fix formatting.Rui Ueyama2016-07-071-21/+20
| | | | llvm-svn: 274724
* Fix formatting. NFC.Rui Ueyama2016-07-021-2/+2
| | | | llvm-svn: 274426
* [BitcodeFile] Simplify shouldSkip(). NFCI.Davide Italiano2016-07-011-5/+2
| | | | llvm-svn: 274383
* [ELF] More self-explanatory error message when e_machine can't be inferred.Davide Italiano2016-06-291-1/+1
| | | | | | Thanks to Sean Silva for the suggestion! llvm-svn: 274134
* [LTO] Infer ELFKind/EMachine from Bitcode filesDavide Italiano2016-06-291-1/+40
| | | | | | | | | | So that users are not forced to pass `-m` on the command line when the inputs are all bitcode. PR: 28268 Differential Revision: http://reviews.llvm.org/D21779 llvm-svn: 274107
* Refactor ELF type inference functions.Rui Ueyama2016-06-291-34/+23
| | | | | | | | | | | | | Previously, we initialized Config->EKind and Config->EMachine when we instantiate ELF objects. That was not an ideal location to do that because the logic was buried too deep inside a concrete logic. This patch moves the code to the driver so that the initialization becomes explicit. Differential Revision: http://reviews.llvm.org/D21784 llvm-svn: 274089
* Implement --trace-symbol=symbol option.Rui Ueyama2016-06-231-0/+9
| | | | | | | | | | | | | | | Patch by Shridhar Joshi. This option provides names of all the link time modules which define and reference symbols requested by user. This helps to speed up application development by detecting references causing undefined symbols. It also helps in detecting symbols being resolved to wrong (unintended) definitions in case of applications containing multiple definitions for same symbols with different types, bindings. Implements PR28226. llvm-svn: 273536
* Internalize symbols in comdats.Rafael Espindola2016-06-151-4/+6
| | | | | | | We were dropping the CanOmitFromDynSym bit when creating undefined symbols because of comdat. llvm-svn: 272812
* Don't include --start-lib/--end-lib files twice.Rafael Espindola2016-06-141-1/+8
| | | | | | | | | This should never happen with correct programs, but it is trivial write a testcase where lld would crash or report duplicated symbols. We now behave like when an archive is used and include the file only once. llvm-svn: 272724
* Fix global version handling.Rafael Espindola2016-06-091-3/+5
| | | | | | | | We should not ignore the symbol, just the version. Fixes error with -z defs. llvm-svn: 272270
* [ELF] Simplify shouldMerge() result calculation. NFC.George Rimar2016-06-081-4/+1
| | | | llvm-svn: 272131
* [ELF] - Replaced hardcode with named constants. NFC.George Rimar2016-06-081-1/+2
| | | | llvm-svn: 272129
* Initial support for ARM in lld.Peter Smith2016-06-071-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | Add support for an ARM Target and the initial set of relocations and PLT entries that are necessary for an ARM only hello world to link. This has been tested against an ARM only sysroot from the 4.2.0 CodeSourcery Lite release. Tests have been added to test/ELF for the support that has been implemented. Main limitations: - No Thumb support - Relocations incomplete - No C++ exceptions support - No TLS support - No range extension or interworking veneer (thunk) support - No Build Attribute support - No Big-endian support The deprecated relocations R_ARM_PLT32 and R_ARM_PC24 have been implemented as these are used by the 4.2.0 CodeSourcery Lite release. llvm-svn: 271993
* Ignore the "globally available" version.Rafael Espindola2016-06-061-1/+1
| | | | | | Reduced from a firefox build. llvm-svn: 271950
* Rename EHInputSection -> EhInputSection.Rui Ueyama2016-05-241-2/+2
| | | | llvm-svn: 270532
* Simplify. NFC.Rui Ueyama2016-05-241-8/+4
| | | | llvm-svn: 270531
* Fix typo in comment aligment should be alignment. NFC.Peter Smith2016-05-181-1/+1
| | | | llvm-svn: 269905
* Reorganize the cpio archiver as CpioFile class. NFC.Rui Ueyama2016-05-151-2/+3
| | | | | | This code separates the code to create cpio archive from the driver. llvm-svn: 269593
* Print member name in undefined symbol error.Rafael Espindola2016-05-091-0/+9
| | | | llvm-svn: 268976
* [ELF][MIPS] Read/write .MIPS.options sectionSimon Atanasyan2016-05-041-6/+14
| | | | | | | | | MIPS N64 ABI introduces .MIPS.options section which specifies miscellaneous options to be applied to an object/shared/executable file. LLVM as well as modern versions of GNU tools read and write the only type of the options - ODK_REGINFO. It is exact copy of .reginfo section used by O32 ABI. llvm-svn: 268485
* Produce cpio files for --reproduce.Rafael Espindola2016-05-031-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We want --reproduce to * not rewrite scripts and thin archives * work with absolute paths Given that, it pretty much has to create a full directory tree. On windows that is problematic because of the very short maximum path limit. On most cases users can still work around it with "--repro c:\r", but that is annoying and not viable for automated testing. We then need to produce some form of archive with the files. The first option that comes to mind is .a files since we already have code for writing them. There are a few problems with them The format has a dedicated string table, so we cannot start writing it until all members are known. Regular implementations don't support creating directories. We could make llvm-ar support that, but that is probably not a good idea. The next natural option would be tar. The problem is that to support long path names (which is how this started) it needs a "pax extended header" making this an annoying format to write. The next option I looked at seems a natural fit: cpio files. They are available on pretty much every unix, support directories and long path names and are really easy to write. The only slightly annoying part is a terminator, but at least gnu cpio only prints a warning if it is missing, which is handy for crashes. This patch still makes an effort to always create it. llvm-svn: 268404
* Copy thin archive members with --reproduce.Rafael Espindola2016-05-021-0/+3
| | | | llvm-svn: 268229
* Should fix all remaining MSVC problems.Peter Collingbourne2016-05-011-5/+5
| | | | llvm-svn: 268187
* ELF: New symbol table design.Peter Collingbourne2016-05-011-59/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch implements a new design for the symbol table that stores SymbolBodies within a memory region of the Symbol object. Symbols are mutated by constructing SymbolBodies in place over existing SymbolBodies, rather than by mutating pointers. As mentioned in the initial proposal [1], this memory layout helps reduce the cache miss rate by improving memory locality. Performance numbers: old(s) new(s) Without debug info: chrome 7.178 6.432 (-11.5%) LLVMgold.so 0.505 0.502 (-0.5%) clang 0.954 0.827 (-15.4%) llvm-as 0.052 0.045 (-15.5%) With debug info: scylla 5.695 5.613 (-1.5%) clang 14.396 14.143 (-1.8%) Performance counter results show that the fewer required indirections is indeed the cause of the improved performance. For example, when linking chrome, stalled cycles decreases from 14,556,444,002 to 12,959,238,310, and instructions per cycle increases from 0.78 to 0.83. We are also executing many fewer instructions (15,516,401,933 down to 15,002,434,310), probably because we spend less time allocating SymbolBodies. The new mechanism by which symbols are added to the symbol table is by calling add* functions on the SymbolTable. In this patch, I handle local symbols by storing them inside "unparented" SymbolBodies. This is suboptimal, but if we do want to try to avoid allocating these SymbolBodies, we can probably do that separately. I also removed a few members from the SymbolBody class that were only being used to pass information from the input file to the symbol table. This patch implements the new design for the ELF linker only. I intend to prepare a similar patch for the COFF linker. [1] http://lists.llvm.org/pipermail/llvm-dev/2016-April/098832.html Differential Revision: http://reviews.llvm.org/D19752 llvm-svn: 268178
* Be sure to always increment the Versym pointer.Rafael Espindola2016-04-291-3/+6
| | | | | | | It was getting out of sync if we had undefined symbols at the start of the symbol table. llvm-svn: 268077
* Fix producing undefined reference to __progname.Rafael Espindola2016-04-291-5/+7
| | | | | | We were not producing them if the library had version info. llvm-svn: 268060
* ELF: Add -O0 (produce output as fast as possible) mode.Rui Ueyama2016-04-291-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | This patch redefines the default optimization level as 1 and adds new level 0. In the command line, it is -O0. The flag disables costly but optional features so that the linker produces semantically correct but larger output quickly. Currently it only disables section merging. This flag is not intended to be used for final production linking. It is intended to be used in compile-link-test cycle. Time to link clang with debug info is about 2x faster with the flag. Head: 13.24 seconds Output size: 1227189664 bytes With this patch: 7.41 seconds Output size: 2490281784 bytes Differential Revision: http://reviews.llvm.org/D19705 llvm-svn: 268056
* [ELF][MIPS] Accept MIPS 64-bit binariesSimon Atanasyan2016-04-291-0/+2
| | | | | | | LLD accepts MIPS 64-bit binaries, supports corresponding eulation (-m) arguments and emits 64-bit specific ELF flags. llvm-svn: 268024
* Use a single context for lto.Rafael Espindola2016-04-281-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using multiple context used to be a really big memory saving because we could free memory from each file while the linker proceeded with the symbol resolution. We are getting lazier about reading data from the bitcode, so I was curious if this was still a good tradeoff. One thing that is a bit annoying is that we still have to copy the symbol names. The problem is that the names are stored in the Module and get freed when we move the module bits during linking. Long term I think the solution is to add a symbol table to the bitcode. That way IRObject file will not need to use a Module or a Context and we can drop it while still keeping a StringRef to the names. This patch is still be an interesting medium term improvement. When linking llvm-as without debug info this patch is a small speedup: master: 29.861877513 seconds patch: 29.814533787 seconds With debug info the numbers are master: 34.765181469 seconds patch: 34.563351584 seconds The peak memory usage when linking llvm-as with debug info was master: 599.10MB patch: 600.13MB llvm-svn: 267921
* Remove Size from Undefined symbol.Rui Ueyama2016-04-281-10/+7
| | | | | | | | | | | There seems to be no reason to keep st_size of undefined symbols. This patch removes the member for it. This patch will change outputs in cases that undefined symbols are copied to output, but I think this is unimportant. Differential Revision: http://reviews.llvm.org/D19574 llvm-svn: 267826
* ELF: Create .gnu.version and .gnu.version_r sections when linking against ↵Peter Collingbourne2016-04-271-1/+60
| | | | | | | | versioned DSOs. Differential Revision: http://reviews.llvm.org/D19464 llvm-svn: 267775
* ELF: Merge UndefinedBitcode and UndefinedElf. NFC.Peter Collingbourne2016-04-271-9/+15
| | | | | | Differential Revision: http://reviews.llvm.org/D19566 llvm-svn: 267640
* [LTO] Create Undefined Bitcode symbol when we drop a comdat member.Davide Italiano2016-04-221-19/+31
| | | | | | Differential Revision: http://reviews.llvm.org/D19389 llvm-svn: 267181
* This reverts commit r267154 and r267161.Rafael Espindola2016-04-221-18/+0
| | | | | | | | | | | | | | | | It turns out that this will read data from the section to properly handle Elf_Rel implicit addends. Sorry for the noise. Original messages: Try to fix Windows lld build. Move getRelocTarget to ObjectFile. It doesn't use anything from the InputSection. llvm-svn: 267163
* Move getRelocTarget to ObjectFile.Rafael Espindola2016-04-221-0/+18
| | | | | | It doesn't use anything from the InputSection. llvm-svn: 267154
* Internalize linkonce_odr more often.Rafael Espindola2016-04-211-2/+6
| | | | | | | | | | | | | | Since there is a copy in every translation unit that uses them, they can be omitted from the symbol table if the address is not significant. This still doesn't catch as many cases as the gold plugin. The difference is that we check canBeOmittedFromSymbolTable in each file and use lazy loading which limits what it can do. Gold checks it in the merged file. I think the correct way of getting the same results as gold is just to cache in the IR the result of canBeOmittedFromSymbolTable. llvm-svn: 267063
* ELF: Implement basic support for module asm in bitcode files.Peter Collingbourne2016-04-111-7/+17
| | | | | | Differential Revision: http://reviews.llvm.org/D18872 llvm-svn: 265956
* Fix another crash bug in --start-lib.Rui Ueyama2016-04-081-1/+1
| | | | | | | The previous fix didn't work for bitcode files. This patch fixes the remaining issue. llvm-svn: 265854
* Fix a crash bug in --start-lib.Rui Ueyama2016-04-081-2/+5
| | | | | | | | Previously, Lazy symbols were created for undefined symbols even though such symbols cannot be resolved by loading object files. This patch fixes that bug. llvm-svn: 265847
* Simplify createELFFile. NFC.Rui Ueyama2016-04-081-6/+8
| | | | llvm-svn: 265758
* Define a helper function to simplify. NFC.Rui Ueyama2016-04-081-10/+13
| | | | llvm-svn: 265757
* ELF: Add --strip-debug option.Rui Ueyama2016-04-071-1/+6
| | | | | | | If --strip-debug option is given, then all sections whose names start with ".debug" are removed from output. llvm-svn: 265722
* ELF: Implement --start-lib and --end-libRui Ueyama2016-04-071-0/+60
| | | | | | | | | | | | | | | | start-lib and end-lib are options to link object files in the same semantics as archive files. If an object is in start-lib and end-lib, the object is linked only when the file is needed to resolve undefined symbols. That means, if an object is in start-lib and end-lib, it behaves as if it were in an archive file. In this patch, I introduced a new notion, LazyObjectFile. That is analogous to Archive file type, but that works for a single object file instead of for an archive file. http://reviews.llvm.org/D18814 llvm-svn: 265710
* Change the type hierarchy for undefined symbols.Rafael Espindola2016-04-061-1/+1
| | | | | | | | | | We have to differentiate undefined symbols from bitcode and undefined symbols from other sources. Undefined symbols from bitcode should not inhibit the symbol being internalized. Undefined symbols from other sources should. llvm-svn: 265536
* Do not allocate MipsReginfo using BumpPtrAllocator.Rui Ueyama2016-04-061-2/+2
| | | | | | So that MipsReginfo's destructor will be called. llvm-svn: 265512
OpenPOWER on IntegriCloud