summaryrefslogtreecommitdiffstats
path: root/lld/ELF/SymbolTable.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [lto] Add beginning of -save-temps option.Sean Silva2016-03-091-0/+9
| | | | | | | | | | | | | | | | | | | | | Summary: This is useful for debugging issues with LTO. The option follows the analogous option in ld64 and the gold plugin (per Rafael's suggestion). For starters, this only dumps the combined bitcode file. In a future patch I will add dumping for the .o file. The naming of the output follows ld64's convention which is slightly more consistent IMO (consistent `.lto.<extension>` for all the files). Reviewers: rafael, ruiu Subscribers: joker.eph, Bigcheese, llvm-commits Differential Revision: http://reviews.llvm.org/D18006 llvm-svn: 263055
* [lto] Don't lazy load metadata for now.Sean Silva2016-03-091-1/+1
| | | | | | | | | | | | | | | | | | | | | Summary: At the very least we hit Assertion failed: (((Flags & RF_HaveUnmaterializedMetadata) || Node->isResolved()) && "Unexpected unresolved node"), function MapMetadataImpl, file /Users/Sean/pg/llvm/lib/Transforms/Utils/ValueMapper.cpp, line 375. on the included test case. We currently do things like parse the module twice to keep the implementation minimal. I think it makes sense to add start with eager loading for similar reasons. Reviewers: rafael Subscribers: ruiu, Bigcheese, llvm-commits, joker.eph Differential Revision: http://reviews.llvm.org/D17982 llvm-svn: 263045
* [ELF] - Simplify a SymbolBody class interface a bit.George Rimar2016-03-061-3/+2
| | | | | | | | | Get rid of few accessors in that class, and replace them with direct fields access. Differential revision: http://reviews.llvm.org/D17879 llvm-svn: 262796
* Use IRMover directly.Rafael Espindola2016-03-051-10/+25
| | | | | | | | This has a few advantages: * If lld selected a non bitcode symbol, be the bitcode GV is not merged * lib/Linker is not redoing symbol resolution. llvm-svn: 262773
* [ELF] Generalize symbol type handling.Davide Italiano2016-03-041-2/+3
| | | | | | | | | | | | | | | SymbolBody constructor and friends take isFunc and isTLS boolean arguments. ELF symbols have already a type so than be easily passed as argument. If we want to support another type, this scheme is not good enough, that is, the current code logic would require passing another `bool isObject` around. Up to two argument, this stretching exercise was a little bit goofy but still acceptable, but with more types to support, is just too much, IMHO. Change the code so that the type is passed instead. Differential Revision: http://reviews.llvm.org/D17871 llvm-svn: 262684
* Rename 'fatal' to 'check' when it doesn't always fail.Rafael Espindola2016-03-031-1/+1
| | | | llvm-svn: 262666
* Simplify error handling.Rafael Espindola2016-03-031-5/+3
| | | | | | | This makes fatal return T when there is no error. This avoids the need for quite a few temporaries. llvm-svn: 262626
* 1Fix handling of undef in partial LTO.Rafael Espindola2016-03-021-0/+2
| | | | llvm-svn: 262497
* LTO: Use the correct relocation model.Rafael Espindola2016-03-021-1/+2
| | | | llvm-svn: 262492
* Handle comdat in LTO.Rafael Espindola2016-03-021-3/+3
| | | | llvm-svn: 262489
* [ELF] - Create _DYNAMIC symbol for dynamic outputGeorge Rimar2016-03-011-3/+3
| | | | | | | | | | | lld needs to provide _DYNAMIC symbol when creating a shared library both bfd and gold do that. This should fix the https://llvm.org/bugs/show_bug.cgi?id=26732 Differential revision: http://reviews.llvm.org/D17607 llvm-svn: 262348
* Remove bogus assert.Rafael Espindola2016-02-291-1/+0
| | | | llvm-svn: 262219
* Rename elf2 to elf.Rafael Espindola2016-02-281-5/+5
| | | | llvm-svn: 262159
* Report duplicated symbols in bitcode.Rafael Espindola2016-02-261-5/+9
| | | | llvm-svn: 262076
* Make SymbolBodies private.Rafael Espindola2016-02-261-1/+1
| | | | | | | | | This makes BitcodeFile a bit closer to ObjectFile. If anyone prefers I can go the other way and delete getSymbols from ObjectFile. llvm-svn: 262072
* Handle a weak undefined tls to archive member.Rafael Espindola2016-02-221-1/+4
| | | | | | | | | | | | A weak undefined should not fetch archive members, so we have to keep the Lazy symbol. That means the lazy symbol has to encode information about the original weak undef. Fixes pr25762. llvm-svn: 261591
* Remove a trivial getter.Rafael Espindola2016-02-221-1/+1
| | | | llvm-svn: 261590
* Add initial LTO support.Rafael Espindola2016-02-121-0/+78
| | | | llvm-svn: 260726
* Rename IsUsedInDynamicReloc to MustBeInDynSym.Rafael Espindola2016-02-051-1/+1
| | | | | | | | The variable was marking various cases where a symbol must be included in the dynamic symbol table. Being used by a dynamic relocation was only one of them. llvm-svn: 259889
* ELF: Include archive names in error messages.Rui Ueyama2016-02-021-6/+12
| | | | | | | | If object files are drawn from archive files, the error message should be something like "conflict symbols in foo.a(bar.o) and baz.o" instead of "conflict symbols in bar.o and baz.o". This patch implements that. llvm-svn: 259475
* ELF: Report duplicate symbols as many as possible instead of the first one.Rui Ueyama2016-01-291-11/+15
| | | | | | http://reviews.llvm.org/D16647 llvm-svn: 259233
* ELF: Rename error -> fatal and redefine error as a non-noreturn function.Rui Ueyama2016-01-281-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In many situations, we don't want to exit at the first error even in the process model. For example, it is better to report all undefined symbols rather than reporting the first one that the linker picked up randomly. In order to handle such errors, we don't need to wrap everything with ErrorOr (thanks for David Blaikie for pointing this out!) Instead, we can set a flag to record the fact that we found an error and keep it going until it reaches a reasonable checkpoint. This idea should be applicable to other places. For example, we can ignore broken relocations and check for errors after visiting all relocs. In this patch, I rename error to fatal, and introduce another version of error which doesn't call exit. That function instead sets HasError to true. Once HasError becomes true, it stays true, so that we know that there was an error if it is true. I think introducing a non-noreturn error reporting function is by itself a good idea, and it looks to me that this also provides a gradual path towards lld-as-a-library (or at least embed-lld-to-your-program) without sacrificing code readability with lots of ErrorOr's. http://reviews.llvm.org/D16641 llvm-svn: 259069
* Rename IgnoredWeak to Ignored.Rafael Espindola2016-01-191-1/+1
| | | | | | Thanks to Rui for the suggestion. llvm-svn: 258189
* Delete addIgnoredStrong.Rafael Espindola2016-01-191-7/+0
| | | | | | | It is not needed now that we resolve symbols is shared libraries correctly. llvm-svn: 258104
* Demangle symbols when including them in error messages.Rui Ueyama2016-01-131-1/+1
| | | | llvm-svn: 257647
* Rename IgnoredUndef -> Ignored since it is not an undefined symbol.Rui Ueyama2016-01-121-2/+2
| | | | | | | Also rename Ignored -> IgnoredWeak and IgnoredStrong -> Ignored, since strong symbol is a norm. llvm-svn: 257507
* [ELF][MIPS] Prevent substitution of _gp_disp symbolSimon Atanasyan2016-01-121-0/+7
| | | | | | | | | | | | | On MIPS O32 ABI, _gp_disp is a magic symbol designates offset between start of function and gp pointer into GOT. To make seal with such symbol we add new method addIgnoredStrong(). It adds ignored symbol with global binding to prevent the symbol substitution. The addIgnored call is not enough here because this call adds a weak symbol which might be substituted by symbol from shared library. Differential Revision: http://reviews.llvm.org/D16084 llvm-svn: 257449
* Use shorter name. NFC.Rui Ueyama2016-01-081-1/+1
| | | | llvm-svn: 257217
* Remove an empty constructor.Rui Ueyama2016-01-081-2/+0
| | | | | | | We used to have code in SymbolTable constructor to add entry symbols, etc. That code has been moved to Driver. We can remove the constructor. llvm-svn: 257214
* Add comments.Rui Ueyama2016-01-081-1/+3
| | | | llvm-svn: 257212
* ELF: Consistently return SymbolBody * from SymbolTable::add functions.Rui Ueyama2016-01-081-10/+10
| | | | | | | | For historical reasons, some add* functions for SymbolTable returns a pointer to a SymbolBody, while some are not. This patch is to make them consistently return a pointer to a newly added symbol. llvm-svn: 257211
* ELF: Implement --wrap.Rui Ueyama2016-01-071-0/+14
| | | | | | | | | | | | | In this patch, all symbols are resolved normally and then wrap options are applied. Renaming is implemented by mutating `Body` pointers of Symbols. (As a result, Symtab.find(SymbolName)->getName() may return a string that's different from SymbolName, but that is by design. I designed the symbol and the symbol table to allow this kind of operations.) http://reviews.llvm.org/D15896 llvm-svn: 257075
* Rename Comdats -> ComdatGroups.Rui Ueyama2016-01-061-1/+1
| | | | | | | I usually prefer short names, but in this case the new descriptive name should improve readability a bit. llvm-svn: 256899
* Rename SharedFile::parse -> SharedFile::parseRest.Rui Ueyama2016-01-061-1/+1
| | | | | | | | | | | | Unlike ObjectFile or ArchiveFile, SharedFile had two parse functions, parseSoName() and parse(). parse must have been called after parseSoName, but that requirement was not obvious from their names. (So it looked like you could call parse() on a shared object file right away.) This patch rename parseRest. It is now obvious that there's no single parse function for the shared object file. llvm-svn: 256898
* Simplify. NFC.Rui Ueyama2016-01-061-4/+4
| | | | llvm-svn: 256879
* Fix local variable naming.Rui Ueyama2016-01-061-3/+3
| | | | llvm-svn: 256878
* Add comments.Rui Ueyama2016-01-051-1/+8
| | | | llvm-svn: 256872
* Remove SymbolTable::isUndefined.Rui Ueyama2016-01-051-6/+0
| | | | | | Because it can be implemented outside of the symbol table. llvm-svn: 256869
* Make findFile() a member function of SymbolTable to simplify. NFC.Rui Ueyama2016-01-051-19/+4
| | | | llvm-svn: 256867
* Factor out static members from DefinedRegular.Rui Ueyama2015-12-251-1/+1
| | | | | | | | This patch moves statically-allocated Elf_Sym objects out of DefinedRegular class, so that the class definition becomes smaller. llvm-svn: 256408
* Delete DefinedAbsolute.Rafael Espindola2015-12-241-2/+2
| | | | | | | | | | | | | | | | | | | | There are 3 symbol types that a .bc can provide during lto: defined, undefined, common. Defined and undefined symbols have already been refactored. I was working on common and noticed that absolute symbols would become an oddity: They would be the only symbol type present in a .o but not in a.bc. Looking a bit more, other than the special section number they were only used for special rules for computing values. In that way they are similar to TLS, and we don't have a DefinedTLS. This patch deletes it. With it we have a reasonable rule of the thumb for having a symbol kind: It exists if it has special resolution semantics. llvm-svn: 256383
* Add comments.Rui Ueyama2015-12-241-0/+3
| | | | llvm-svn: 256380
* Split Defined and DefinedElf.Rafael Espindola2015-12-241-5/+1
| | | | | | | This is similar to what was done for Undefined and opens the way for having a symbol defined in bitcode. llvm-svn: 256354
* Simplify memory management.Rafael Espindola2015-12-231-7/+5
| | | | | | We no longer need an explicit delete or a polymorphic destructor. llvm-svn: 256333
* Fix an asan found leak.Rafael Espindola2015-12-231-1/+3
| | | | | | I will make better use of std::unique_ptr in followup patch. llvm-svn: 256310
* Split Undefined and UndefinedElf.Rafael Espindola2015-12-221-11/+7
| | | | | | | | | | | | | | | | | | | | | | I am working on adding LTO support to the new ELF lld. In order to do that, it will be necessary to represent defined and undefined symbols that are not from ELF files. One way to do it is to change the symbol hierarchy to look like Defined : SymbolBody Undefined : SymbolBody DefinedElf<ELFT> : Defined UndefinedElf<ELFT> : Undefined Another option would be to use bogus Elf_Sym, but I think that is getting a bit too hackish. This patch does the Undefined/UndefinedElf. Split. The next one will do the Defined/DefinedElf split. llvm-svn: 256289
* Refactor duplicated code. NFC.Rafael Espindola2015-12-211-5/+18
| | | | llvm-svn: 256180
* ELF: Rename isTLS -> isTls for consistency.Rui Ueyama2015-12-171-1/+1
| | | | llvm-svn: 255855
* ELF: Remove a dumb constructor.Rui Ueyama2015-12-171-1/+1
| | | | | | Symbol is a struct and can be initialized using an initializer. llvm-svn: 255854
* ELF: Move shouldUseRela to Writer.cpp.Rui Ueyama2015-12-161-5/+0
| | | | | | | The function was used only in Writer.cpp and did not depend on SymbolTable. There is no reason to have that function in SymbolTable.cpp. llvm-svn: 255850
OpenPOWER on IntegriCloud