summaryrefslogtreecommitdiffstats
path: root/lld/ELF/Symbols.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* ELF: Teach SymbolBody about how to get its addresses.Rui Ueyama2016-02-011-1/+84
| | | | | | | | | | | | | Previously, the methods to get symbol addresses were somewhat scattered in many places. You can use getEntryAddr returns the address of the symbol, but if you want to get the GOT address for the symbol, you needed to call Out<ELFT>::Got->getEntryAddr(Sym). This change adds new functions, getVA, getGotVA, getGotPltVA, and getPltVA to SymbolBody, so that you can use SymbolBody as the central place to ask about symbols. http://reviews.llvm.org/D16710 llvm-svn: 259404
* [ELF] - Symbols from object files that override symbols in DSO are added to ↵George Rimar2016-01-251-0/+7
| | | | | | | | | | | .dynsym table. Main executable did not export symbols that exist both in the main executable and in DSOs before this patch. Symbols from object files that override symbols in DSO should be added to .dynsym table. Differential revision: http://reviews.llvm.org/D16405 llvm-svn: 258672
* Rename IgnoredWeak to Ignored.Rafael Espindola2016-01-191-2/+2
| | | | | | Thanks to Rui for the suggestion. llvm-svn: 258189
* Delete addIgnoredStrong.Rafael Espindola2016-01-191-2/+0
| | | | | | | It is not needed now that we resolve symbols is shared libraries correctly. llvm-svn: 258104
* Prefer symbols from .o over .so.Rafael Espindola2016-01-181-7/+4
| | | | | | This matches the behavior of gold and bfd ld. llvm-svn: 258102
* Update comment for __cxa_demangle again to make it precise.Rui Ueyama2016-01-131-4/+5
| | | | | | Thanks for Ed Maste for the suggestion. llvm-svn: 257685
* Update comment for __cxa_demangle.Rui Ueyama2016-01-131-1/+4
| | | | llvm-svn: 257678
* Attempt to make FreeBSD buildbot green.Rui Ueyama2016-01-131-0/+5
| | | | | | | | It seems that __cxa_demangle function on the buildbot tried to demangle a variable "tlsvar" as a C++ symbol. Do not call that function unless it does not start with "_Z" which is the prefix of mangled names. llvm-svn: 257661
* Demangle symbols when including them in error messages.Rui Ueyama2016-01-131-0/+22
| | | | llvm-svn: 257647
* Rename IgnoredUndef -> Ignored since it is not an undefined symbol.Rui Ueyama2016-01-121-4/+4
| | | | | | | 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/+2
| | | | | | | | | | | | | 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
* Remove unnecessary `lld::`.Rui Ueyama2016-01-061-9/+9
| | | | llvm-svn: 256970
* Do not use templates to instantiate {Object,Shared}Files.Rui Ueyama2016-01-061-2/+1
| | | | | | | createELFFile looked complex because of its use of template, so I want to keep it private within this file. llvm-svn: 256880
* Factor out static members from DefinedRegular.Rui Ueyama2015-12-251-3/+3
| | | | | | | | This patch moves statically-allocated Elf_Sym objects out of DefinedRegular class, so that the class definition becomes smaller. llvm-svn: 256408
* Make it possible to create common symbols from bitcode.Rafael Espindola2015-12-241-3/+10
| | | | | | | Since the only missing bit was the size, I just replaced the Elf_Sym with the size. llvm-svn: 256384
* Delete DefinedAbsolute.Rafael Espindola2015-12-241-3/+3
| | | | | | | | | | | | | | | | | | | | 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
* Split Defined and DefinedElf.Rafael Espindola2015-12-241-0/+15
| | | | | | | This is similar to what was done for Undefined and opens the way for having a symbol defined in bitcode. llvm-svn: 256354
* Split Undefined and UndefinedElf.Rafael Espindola2015-12-221-1/+23
| | | | | | | | | | | | | | | | | | | | | | 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
* Typedef uintX_t at beginning of a function just like others.Rui Ueyama2015-12-161-4/+4
| | | | llvm-svn: 255853
* [ELF] Define symbols "_end" and "end" if referenced.Igor Kudrin2015-11-201-0/+1
| | | | | | | | | | These symbols are expected to point to the end of the data segment. Implements http://llvm.org/pr25528. Differential Revision: http://reviews.llvm.org/D14833 llvm-svn: 253637
* ELF2: Avoid bitwise-OR hack. NFC.Rui Ueyama2015-10-211-2/+2
| | | | | | | The previous code is too clever that that needs a bit more brain power than this new code. llvm-svn: 250934
* ELF2: Rename getMostConstrainingVisibility -> getVisibility. NFC.Rui Ueyama2015-10-211-4/+2
| | | | | | The previous name was too long. llvm-svn: 250920
* ELF2: Inititalize other symbols only once as well.Rui Ueyama2015-10-081-4/+10
| | | | llvm-svn: 249645
* ELF2: Make member variable names shorter.Rui Ueyama2015-10-081-4/+4
| | | | | | | I'm going to use them in other patches, and the names feel too long despite their narrow scope. llvm-svn: 249642
* ELF2: Initialize SyntheticOptional only once.Rui Ueyama2015-10-071-0/+7
| | | | llvm-svn: 249636
* Don't complain about symbols showing up in multible shared libraries.Rafael Espindola2015-09-231-0/+4
| | | | llvm-svn: 248381
* Rename Chunks.(h|cpp) to InputSection.(h|cpp). NFC.Rafael Espindola2015-09-221-1/+1
| | | | llvm-svn: 248226
* ELF2: Reduce nesting by returning early. NFC.Rui Ueyama2015-09-091-11/+9
| | | | llvm-svn: 247168
* ELF2: Return early. NFC.Rui Ueyama2015-09-091-17/+16
| | | | llvm-svn: 247165
* Start adding support for symbols in shared libraries.Rafael Espindola2015-09-081-0/+3
| | | | llvm-svn: 247019
* [elf2] Add basic archive file support.Michael J. Spencer2015-09-041-0/+15
| | | | llvm-svn: 246886
* Merge visibility from all symbols with the same name.Rafael Espindola2015-09-011-0/+14
| | | | | | | | | | | | | | | The ELF spec says: ... if any reference to or definition of a name is a symbol with a non-default visibility attribute, the visibility attribute must be propagated to the resolving symbol in the linked object. If different visibility attributes are specified for distinct references to or definitions of a symbol, the most constraining visibility attribute must be propagated to the resolving symbol in the linked object. The attributes, ordered from least to most constraining, are: STV_PROTECTED, STV_HIDDEN and STV_INTERNAL. llvm-svn: 246603
* Remember the maximum alignment used to refer to a common symbol.Rafael Espindola2015-09-011-3/+8
| | | | llvm-svn: 246517
* Keep the largest common symbol.Rafael Espindola2015-08-311-5/+16
| | | | | | | This requires templating some functions over ELFT, but that opens other cleanup opportunities for future patches. llvm-svn: 246405
* Turn resolution.s into an exhaustive testcase.Rafael Espindola2015-08-301-3/+10
| | | | | | | | | | | | | | Now that we print a symbol table and all symbol kinds are at least declared, we can test all combinations that don't produce an error. This also includes a few fixes to keep the test passing: * Keep the strong symbol in a weak X strong pair * Handle common symbols. The common X common case will be finished in a followup patch. llvm-svn: 246401
* Add support for weak absolute symbols.Rafael Espindola2015-08-281-18/+8
| | | | | | | On ELF being weak is independent of what we call the kind of the symbol. So this also makes the code simpler. llvm-svn: 246326
* Start adding support for absolute symbols.Rafael Espindola2015-08-271-0/+1
| | | | llvm-svn: 246147
* ELF: Also record the type of undefined symbols.Rafael Espindola2015-08-141-0/+1
| | | | | | | Tested with a weak undefined. Testing with a plain undefined will have to wait for support for -shared. llvm-svn: 245069
* ELF2: Make Defined{Regular,Weak} ctors look the same as other SymbolBody ctors.Rui Ueyama2015-08-111-5/+0
| | | | llvm-svn: 244701
* Add support for weak undefined symbols.Rafael Espindola2015-08-111-0/+1
| | | | llvm-svn: 244640
* Remove unused templating.Rafael Espindola2015-08-111-19/+2
| | | | llvm-svn: 244639
* Add support for weak symbols.Rafael Espindola2015-08-111-4/+11
| | | | llvm-svn: 244636
* Use real values for DefindeFirst and DefinedLast.Rafael Espindola2015-08-111-2/+1
| | | | | | With this clang notices that switches are fully covered. llvm-svn: 244632
* Delete broken code.Rafael Espindola2015-08-061-16/+2
| | | | | | | | This was using a hard coded string table and getting it for every symbol. The symbol name was already available. llvm-svn: 244220
* barRafael Espindola2015-08-061-5/+9
| | | | llvm-svn: 244219
* Delete dead code.Rafael Espindola2015-08-051-4/+2
| | | | llvm-svn: 244040
* [ELF2] Devirtualize SymbolBody.Michael J. Spencer2015-07-281-0/+18
| | | | llvm-svn: 243496
* ELF2: Inline very small functions.Rui Ueyama2015-07-271-6/+0
| | | | llvm-svn: 243323
* ELF2: Devirtualize SymbolBody::compare. NFC.Rui Ueyama2015-07-271-18/+20
| | | | | | This is to make it consistent with COFF. llvm-svn: 243321
* [ELF2] Add a new ELF linker based on the new PE/COFF linker.Michael J. Spencer2015-07-241-0/+57
| | | | | | Differential Revision: http://reviews.llvm.org/D11188 llvm-svn: 243161
OpenPOWER on IntegriCloud