summaryrefslogtreecommitdiffstats
path: root/lld/ELF/Symbols.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Simplify. NFC.Rafael Espindola2017-09-131-1/+1
| | | | | | The isShared case was handled by the isInCurrentDSO check. llvm-svn: 313190
* Add a helper for checking for weak undef. NFC.Rafael Espindola2017-09-131-2/+10
| | | | llvm-svn: 313188
* Remove CopyRelSecOff from SharedSymbol.Rafael Espindola2017-09-131-2/+1
| | | | | | | This reduces the size of SharedSymbol which in turn reduces the size of Symbol from 88 to 80 bytes. llvm-svn: 313154
* Handle lazy symbols is Symbol::includeInDynsym.Rafael Espindola2017-09-131-1/+1
| | | | | | | | | | This should fix the lto bootstrap. It is somewhat hard to remember about lazy symbols deep down in the link. It might be worth it replacing them with undefined symbols once we are done adding files. llvm-svn: 313103
* [ELF] Handle references to garbage collected common symbolsBen Dunbobbin2017-09-121-0/+2
| | | | | | | | | | https://reviews.llvm.org/rL312796 meant that references to garbage collected common symbols would cause a segfault. This change fixes the behaviour for references to stripped common symbols. Differential Revision: https://reviews.llvm.org/D37718 llvm-svn: 313086
* Remove Offset from Common.Rafael Espindola2017-09-121-2/+1
| | | | | | It is not needed since it is always 0. llvm-svn: 313076
* Currently lld creates a single section to collect all commons. There is no wayDmitry Mikulin2017-09-081-5/+7
| | | | | | | | | | | | | | | to separate commons based on file name patterns. The following linker script construct does not work because commons are allocated before section placement is done and the only synthesized BssSection that holds all commons has no file associated with it: SECTIONS { .common_0 : { *file0.o(COMMON) }} This patch changes the allocation of commons to create a section per common symbol and let the section logic do the layout. Differential revision: https://reviews.llvm.org/D37489 llvm-svn: 312796
* Avoid crash with local abs symbol.Rafael Espindola2017-08-111-2/+7
| | | | llvm-svn: 310736
* Garbage-collect common symbols.Rui Ueyama2017-08-101-1/+1
| | | | | | | | | | | | Liveness is usually a notion of input sections, but this patch adds "liveness" bit to common symbols because they don't belong to any input section. This patch is based on https://reviews.llvm.org/D36520 Differential Revision: https://reviews.llvm.org/D36546 llvm-svn: 310617
* Compute isPreemtible only once.Rafael Espindola2017-08-101-36/+2
| | | | | | | | This is probably a small optimization, but the main motivation is having a way of fixing pr34053 that doesn't require a hash lookup in isPreempitible. llvm-svn: 310602
* Move File from SymbolBody to Symbol.Rafael Espindola2017-08-041-23/+28
| | | | | | | | | | | | | With this Symbol has the same size as before, but DefinedRegular goes from 72 to 64 bytes. I also find this a bit easier to read. There are fewer places initializing File for example. This has a small but measurable speed improvement on all tests (1% max). llvm-svn: 310142
* Remove redundant flag.Rafael Espindola2017-08-041-5/+5
| | | | llvm-svn: 310079
* [ELF] - Recommit r309252 "[ELF] - Fix missing relocation when linking ↵George Rimar2017-08-021-5/+10
| | | | | | | | | | | | | | | | | | | | | executable with --unresolved-symbols=ignore-all" With fix for undefined weak symbols in executable. Original commit message: This is PR32112. Previously when we linked executable with --unresolved-symbols=ignore-all and undefined symbols, like: _start: callq und@PLT we did not create relocations, though it looks in that case we should delegate handling of such symbols to runtime linker, hence should emit them. Patch fixes that. Differential revision: https://reviews.llvm.org/D35724 llvm-svn: 309796
* Never export weak undefined from executable.Rafael Espindola2017-07-311-2/+3
| | | | | | | | Before we were doing it with --export-dynamic. That seems incorrect. The intention of --export-dynamic is to export symbols *defined* in the executable. llvm-svn: 309605
* Revert r309252 "[ELF] - Fix missing relocation when linking executable with ↵George Rimar2017-07-271-14/+6
| | | | | | | | | --unresolved-symbols=ignore-all" It broke bot: http://lab.llvm.org:8011/builders/clang-with-thin-lto-ubuntu/builds/4231 llvm-svn: 309258
* [ELF] - Fix missing relocation when linking executable with ↵George Rimar2017-07-271-6/+14
| | | | | | | | | | | | | | | | | | --unresolved-symbols=ignore-all This is PR32112. Previously when we linked executable with --unresolved-symbols=ignore-all and undefined symbols, like: _start: callq und@PLT we did not create relocations, though it looks in that case we should delegate handling of such symbols to runtime linker, hence should emit them. Patch fixes that. Differential revision: https://reviews.llvm.org/D35724 llvm-svn: 309252
* Rename ObjectFile -> ObjFile.Rui Ueyama2017-07-261-1/+1
| | | | | | | Rename it because it was too easy to conflict with llvm::object::ObjectFile which broke buildbots several times. llvm-svn: 309199
* ELF: Reword a somewhat misleading error message.Peter Collingbourne2017-07-141-1/+1
| | | | | | | | | | | PT_TLS is a type of program header, so we wouldn't expect to see one in an object file. This error should probably be referring to the fact that we didn't see a section with the flag SHF_TLS, which would normally cause us to create a PT_TLS program header. Differential Revision: https://reviews.llvm.org/D35395 llvm-svn: 307983
* Fix PR33635.Rafael Espindola2017-07-051-10/+3
| | | | | | | | | This is a semantic revert of r306036. We have to change the names, otherwise dynamic relocations will point to the wrong name. llvm-svn: 307110
* [ELF] - Resolve references properly when using .symver directiveGeorge Rimar2017-07-041-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is PR28414. Previously LLD was unable to link following: (failed with undefined symbol bar) Version script: SOME_VERSION { global: *; }; .global _start .global bar .symver _start, bar@@SOME_VERSION _start: jmp bar Manual has next description: .symver name, name2@@nodename In this case, the symbol name must exist and be defined within the file being assembled. It is similar to name2@nodename. The difference is name2@@nodename will also be used to resolve references to name2 by the linker https://sourceware.org/binutils/docs/as/Symver.html Patch implements that. If we have name@@ver symbol and name is undefined, name@@ver is used to resolve references to name. If name is defined then multiple definition error is emited, that is consistent with what bfd do. Differential revision: https://reviews.llvm.org/D33680 llvm-svn: 307077
* Move copy function from Symbol to SymbolBody.Rui Ueyama2017-06-281-14/+15
| | | | | | | | We could have add this function either Symbol or SymbolBody. I added it to Symbol at first. But I noticed that if I've added it to SymbolBody, we could've removed SymbolBody::setName(). So I'll do that in this patch. llvm-svn: 306590
* Define Symbol::copyBody function.Rui Ueyama2017-06-281-0/+14
| | | | | | | This patch adds a utility function to Symbol. This function should be useful in https://reviews.llvm.org/D33680 too. llvm-svn: 306587
* Add GlobalOffsetTable to ElfSym. NFC.Rui Ueyama2017-06-261-0/+1
| | | | | | | | Most "reserved" symbols are in ElfSym and it looks like there's no reason to not do the same thing for _GLOBAL_OFFSET_TABLE_. This should help https://reviews.llvm.org/D34618 too. llvm-svn: 306292
* Simplify. NFC.Rui Ueyama2017-06-091-6/+5
| | | | llvm-svn: 305112
* Store a single Parent pointer for InputSectionBase.Rafael Espindola2017-05-311-4/+4
| | | | | | | | | | | | | | | Before InputSectionBase had an OutputSection pointer, but that was not always valid. For example, if it was a merge section one actually had to look at MergeSec->OutSec. This was brittle and caused bugs like the one fixed by r304260. We now have a single Parent pointer that points to an OutputSection for InputSection, but to a SyntheticSection for merge sections and .eh_frame. This makes it impossible to accidentally access an invalid OutSec. llvm-svn: 304338
* Detemplate SymbolBody::getGotVA. NFC.Rafael Espindola2017-05-111-6/+1
| | | | llvm-svn: 302846
* Detemplate the got.Rafael Espindola2017-05-111-1/+1
| | | | | | This is a bit hackish, but allows for a lot of followup cleanups. llvm-svn: 302845
* Reduce code duplication. NFC.Rafael Espindola2017-05-041-6/+1
| | | | llvm-svn: 302155
* Remove a useless temporary variable.Rui Ueyama2017-04-241-2/+1
| | | | llvm-svn: 301278
* Add "1" suffix if there's varaible ends with "2".Rui Ueyama2017-04-131-4/+4
| | | | | | | If we knew that we'd add End2, Edata2 and Etext2, we'd name their original symbols with "1". This patch does it. llvm-svn: 300263
* [ELF] - Define __bss_start symbol.George Rimar2017-04-051-0/+1
| | | | | | | | | | | | | | | | | | | | GNU linkers define __bss_start symbol. Patch teaches LLD to do that. This is PR32051. Below is part of standart ld.bfd script: .data1 : { *(.data1) } _edata = .; PROVIDE (edata = .); . = .; __bss_start = .; .bss : { Currently LLD can emit up to 3 .bss* sections as one of testcase shows. Implementation inserts this symbol before first .bss* output section. Differential revision: https://reviews.llvm.org/D30419 llvm-svn: 299528
* [ELF] - Detemplate SymbolBody::getGotOffset(). NFC.George Rimar2017-03-171-7/+2
| | | | llvm-svn: 298091
* [ELF] - Detemplate SymbolBody::getVA and SymbolBody::getPltVA. NFC.George Rimar2017-03-171-20/+8
| | | | llvm-svn: 298071
* [ELF] - Recommit "[ELF] - Make Bss and BssRelRo sections to be synthetic (#3)."George Rimar2017-03-171-2/+3
| | | | | | | | | | | | | | | | | | Was fixed, details on review page. Original commit message: That removes CopyRelSection class completely, making Bss/BssRelRo to be just regular synthetics. This is splitted from D30541 and polished. Difference from D30541 that all logic of SharedSymbol converting to DefinedRegular was removed for now and probably will be posted as separate patch. Differential revision: https://reviews.llvm.org/D30892 llvm-svn: 298062
* [ELF] - Detemplate SymbolBody::getGotPltVA and ↵George Rimar2017-03-161-14/+4
| | | | | | | | | SymbolBody::getGotPltOffset(). NFC. That opens road to detemplate PltSection<ELFT>, what allows then to detemplate all methods of SymbolBody. llvm-svn: 297950
* [ELF] - Detemplate SymbolBody::getOutputSection(). NFC.George Rimar2017-03-161-7/+2
| | | | llvm-svn: 297943
* Revert r297813 "[ELF] - Make Bss and BssRelRo sections to be synthetic (#3)."George Rimar2017-03-161-3/+2
| | | | | | | | | I suppose it is the reason of BB fail: http://lab.llvm.org:8011/builders/clang-cmake-aarch64-lld/builds/921 https://bugs.llvm.org/show_bug.cgi?id=32167 llvm-svn: 297933
* [ELF] - Make Bss and BssRelRo sections to be synthetic (#3).George Rimar2017-03-151-2/+3
| | | | | | | | | | | | | | That removes CopyRelSection class completely, making Bss/BssRelRo to be just regular synthetics. This is splitted from D30541 and polished. Difference from D30541 that all logic of SharedSymbol converting to DefinedRegular was removed for now and probably will be posted as separate patch. Differential revision: https://reviews.llvm.org/D30892 llvm-svn: 297814
* Remove DefinedSynthetic.Rafael Espindola2017-03-081-31/+19
| | | | | | | | | | | | | With this we have a single section hierarchy. It is a bit less code, but the main advantage will be in a future patch being able to handle foo = symbol_in_obj; in a linker script. Currently that fails since we try to find the output section of symbol_in_obj. With this we should be able to just return an InputSection from the expression. llvm-svn: 297313
* Use uint32_t for alignment in more places, NFC.Rafael Espindola2017-03-081-8/+8
| | | | llvm-svn: 297305
* Revert r297008: [ELF] - Make Bss and BssRelRo sections to be synthetic (#2).Rui Ueyama2017-03-081-6/+14
| | | | | | | This reverts commit r297008 because it's reported that that change broke AArch64 bots. llvm-svn: 297297
* Remove unnecessary template.Rafael Espindola2017-03-081-2/+2
| | | | llvm-svn: 297293
* Remove unnecessary template. NFC.Rafael Espindola2017-03-081-1/+1
| | | | llvm-svn: 297292
* Convert a few more uses of uintX_t to uint64_t.Rafael Espindola2017-03-081-4/+2
| | | | llvm-svn: 297286
* Convert a few uses of uintX_t to uint64_t.Rafael Espindola2017-03-081-1/+1
| | | | llvm-svn: 297282
* Fix -Werror build error.Evgeniy Stepanov2017-03-061-1/+1
| | | | | | | | tools/lld/ELF/Symbols.cpp:215:13: error: unused variable 'S' [-Werror,-Wunused-variable] if (auto *S = dyn_cast<SharedSymbol>(this) llvm-svn: 297063
* [ELF] - Make Bss and BssRelRo sections to be synthetic (#2).George Rimar2017-03-061-14/+6
| | | | | | | | | | | | | | | In compare with D30458, this makes Bss/BssRelRo to be pure synthetic sections. That removes CopyRelSection class completely, making Bss/BssRelRo to be just regular synthetics. SharedSymbols involved in creating copy relocations are converted to DefinedRegular, what also simplifies things. Differential revision: https://reviews.llvm.org/D30541 llvm-svn: 297008
* Improve comment.Sean Silva2017-03-011-6/+8
| | | | | | | Thanks to Rafael for helping to dig down into what we're really trying to communicate here. llvm-svn: 296580
* De-template DefinedRegular.Rui Ueyama2017-02-281-8/+20
| | | | | | Differential Revision: https://reviews.llvm.org/D30348 llvm-svn: 296508
* Comment on the typical/simple case of VA calculationSean Silva2017-02-281-0/+12
| | | | | | | | | | | | There are many special cases and a layer of abstraction or two in the way, but the VA calculation in the typical case is actually very simple and probably makes perfect sense even to somebody new to linkers. Also, this line brings together many components and is a good place to start understanding the linker (or improve one's existing understanding). llvm-svn: 296451
OpenPOWER on IntegriCloud