summaryrefslogtreecommitdiffstats
path: root/lld/ELF
Commit message (Collapse)AuthorAgeFilesLines
...
* [ELF] Fix buildbot warning error.Peter Smith2017-12-151-1/+1
| | | | | | Forward declare InputSectionDescription as struct not class. llvm-svn: 320801
* [ELF] Complete implementation of --fix-cortex-a53-843419Peter Smith2017-12-153-62/+249
| | | | | | | | | | | | | | | | | | This patch provides the mechanism to fix instances of the instruction sequence that may trigger the cortex-a53 843419 erratum. The fix is provided by an alternative instruction sequence to remove one of the erratum conditions. To reach this alternative instruction sequence we replace the original instruction with a branch to the alternative sequence. The alternative sequence is responsible for branching back to the original. As there is only erratum to fix the implementation is specific to AArch64 and the specific erratum conditions. It should be generalizable to other targets and erratum if needed. Differential Revision: https://reviews.llvm.org/D36749 llvm-svn: 320800
* Fix error messages.Rui Ueyama2017-12-151-1/+1
| | | | llvm-svn: 320772
* Use warn() instead of error() to report a bad symbol in a DSO.Rui Ueyama2017-12-152-5/+7
| | | | | | | | | | Specifically, libwidevinecdm.so in Chrome has such bad symbol. It seems the BFD linker handles them as local symbols, so instead of inserting them to the symbol table, we should skip them too. Differential Revision: https://reviews.llvm.org/D41257 llvm-svn: 320770
* Fix a build bot failure.Igor Kudrin2017-12-141-1/+1
| | | | llvm-svn: 320671
* [ELF] Prevent crash in writing an .ARM.exidx sentinel entry.Igor Kudrin2017-12-141-9/+15
| | | | | | | | | | | | We might crash in 'ARMExidxSentinelSection::writeTo()' because it expected the sentinel entry to be put in the same 'InputSectionDescription' as the last real entry. This assumption fails if the last output section command for .ARM.exidx is anything but an input section description, because in this case 'OutputSection::addSection()' creates a new 'InputSectionDescription'. Differential Revision: https://reviews.llvm.org/D41105 llvm-svn: 320668
* Fix crash on invalid.Rafael Espindola2017-12-141-1/+5
| | | | | | | We would fail an assert if a shared library had a local symbol after sh_info. llvm-svn: 320667
* Move Repl to SectionBase.Rafael Espindola2017-12-134-25/+18
| | | | | | | | | | | | | | | | It is currently in InputSectionBase. Only InputSections are used in ICF, so Repl should be move to InputSection to clear the class hierarchy or, like this patch does, to SectionBase for convenience. The convenience of having it on the base class is that we can just access the replacement without having to first check if it is an InputSection. It is a bit less code and a bit faster as some of this code is very hot. I got up to 1.77% improvement in clang-gdb-index and no regressions according to lnt. llvm-svn: 320654
* Inline a small function.Rui Ueyama2017-12-132-11/+5
| | | | | | Differential Revision: https://reviews.llvm.org/D41204 llvm-svn: 320652
* Move Repl check to a symbol method.Rafael Espindola2017-12-132-3/+6
| | | | | | | | | | | | Having a SectionBase method check Repl is inconsistent with how we handle other section information. For example, if a section is replaced, Sec->Live is false and it is natural for Sec->getOutputSection() to be null. It is the symbol that is moved to the replacement section. llvm-svn: 320599
* Simplify. NFC.Rafael Espindola2017-12-131-2/+2
| | | | | | If a section has been replaced (Sec != Sec->Repl) it is not Live. llvm-svn: 320597
* Remove unnecessary use of Repl.Rafael Espindola2017-12-131-4/+1
| | | | | | This runs before ICF, so Sec->Repl == Sec. llvm-svn: 320543
* Make a method private. NFC.Rafael Espindola2017-12-131-2/+1
| | | | llvm-svn: 320542
* Fix the type of the Discared section.Rafael Espindola2017-12-132-9/+3
| | | | | | | It is constructed with a kind of Regular and will dyn_cast to InputSection, but is declared to be an InputSectionBase. llvm-svn: 320539
* Remove trailing whitespace.Rui Ueyama2017-12-121-1/+1
| | | | llvm-svn: 320520
* Fix line endings. NFC.Rafael Espindola2017-12-122-11/+11
| | | | llvm-svn: 320502
* [ELF] Refactor to remove loop copying all Sections in OS->finalize() [NFC]Peter Smith2017-12-121-10/+11
| | | | | | | | | | Moving the SHF_LINK_ORDER processing out of OutputSection::finalize() means that we no longer need to copy all InputSections as we now only need the first one. Differential Revision: https://reviews.llvm.org/D40966 llvm-svn: 320478
* [ELF] Move SHF_LINK_ORDER processing earlier in Writer.cpp [NFC]Peter Smith2017-12-122-24/+43
| | | | | | | | | | By moving this step before thunk creation and other processing that depends on the size of sections, we permit removal of duplicates in the .ARM.exidx section. Differential Revision: https://reviews.llvm.org/D40964 llvm-svn: 320477
* [ELF] Reset OutputSection size prior to processing linker script commandsJames Henderson2017-12-124-21/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The size of an OutputSection is calculated early, to aid handling of compressed debug sections. However, subsequent to this point, unused synthetic sections are removed. In the event that an OutputSection, from which such an InputSection is removed, is still required (e.g. because it has a symbol assignment), and no longer has any InputSections, dot assignments, or BYTE()-family directives, the size member is never updated when processing the commands. If the removed InputSection had a non-zero size (such as a .got.plt section), the section ends up with the wrong size in the output. The fix is to reset the OutputSection size prior to processing the linker script commands relating to that OutputSection. This ensures that the size is correct even in the above situation. Additionally, to reduce the risk of developers misusing OutputSection Size and InputSection OutSecOff, they are set to simply the number of InputSections in an OutputSection, and the corresponding index respectively. We cannot completely stop using them, due to SHF_LINK_ORDER sections requiring them. Compressed debug sections also require the full size. This is now calculated in maybeCompress for these kinds of sections. Reviewers: ruiu, rafael Differential Revision: https://reviews.llvm.org/D38361 llvm-svn: 320472
* Compact symbols from 96 to 88 bytes.Rafael Espindola2017-12-126-23/+22
| | | | | | | | | | | | By using an index instead of a pointer for verdef we can put the index next to the alignment field. This uses the otherwise wasted area and reduces the shared symbol size. By itself the performance change of this is in the noise, but I have a followup patch to remove another 8 bytes that improves performance when combined with this. llvm-svn: 320449
* Add an option for ICFing data.Rafael Espindola2017-12-124-2/+11
| | | | | | | | | | An internal linker has support for merging identical data and in some cases it can be a significant win. This is behind an off by default flag so it has to be requested explicitly. llvm-svn: 320448
* [ELF] Don't set the executable bit for relocatable filesPetr Hosek2017-12-111-2/+4
| | | | | | | | These are not executable files so they shouldn't be marked as such. Differential Revision: https://reviews.llvm.org/D41041 llvm-svn: 320438
* [ELF] Change default output section type to SHT_NOBITSJake Ehrlich2017-12-112-1/+3
| | | | | | | | | | | | | | | | When an output section has no byte commands and has no input sections then it would be ideal if the type of the section is SHT_NOBITS so that the file can take up less space. This change sets the default type of of output sections to SHT_NOBITS instead of SHT_PROGBITS to allow this. This required some minor test changes (which double as tests for this new behavior) but extend-pt-load.s had be changed in a non-trivial way. Since it seems to me that the point of the test is to point out the consequences of how flags are assigned to output sections that don't have input sections I changed the test to work and still show how the memsize of the executable segment was changed. Differential Revision: https://reviews.llvm.org/D41082 llvm-svn: 320437
* Remove redundant local variables.Rui Ueyama2017-12-111-3/+2
| | | | llvm-svn: 320436
* ELF: Do not follow relocation edges to output sections during GC.Peter Collingbourne2017-12-111-2/+3
| | | | | | | | This fixes an assertion error introduced by r320390. Differential Revision: https://reviews.llvm.org/D41095 llvm-svn: 320431
* Return R_PLT_PC for R_PPC_PLTREL24.Rafael Espindola2017-12-111-8/+1
| | | | | | | | The PPC port doesn't support PLT yet, but the architecture independent code optimizes PLT access for non preemptible symbols, which is exactly what returning R_PC was trying to implement. llvm-svn: 320430
* [ELF] When a relocation is out of range print the value and the rangeAlexander Richardson2017-12-111-6/+13
| | | | | | | | | | | | Reviewers: ruiu, grimar Reviewed By: ruiu Subscribers: emaste, nemanjai, javed.absar, kbarton, llvm-commits Differential Revision: https://reviews.llvm.org/D40962 llvm-svn: 320416
* Handle symbols pointing to output sections.Rafael Espindola2017-12-111-1/+1
| | | | | | | | | Now that gc sections runs after linker defined symbols are added it can see symbols that point to an OutputSection. Should fix a bot failure. llvm-svn: 320412
* Create reserved symbols early so they can be versioned.Rafael Espindola2017-12-113-13/+26
| | | | | | | | | | | | | | | | | | | | | This fixes pr35570. We were creating these symbols after parsing version scripts, so they could not be versioned. We cannot move the version script parsing later because we need it for lto. One option is to move both addReservedSymbols and createSyntheticSections earlier. The disadvantage is that some sections created by createSyntheticSections replace other input sections. For example, gdb index replaces .debug_gnu_pubnames, so it wants to run after gc sections so that it can set S->Live to false. What this patch does instead is to move just the ElfHeader creation early. llvm-svn: 320390
* Move RelaPlt and RelaIplt to InX. NFC.Rafael Espindola2017-12-104-28/+29
| | | | llvm-svn: 320327
* Move RelaDyn to InX. NFC.Rafael Espindola2017-12-104-40/+38
| | | | llvm-svn: 320324
* Remove this->. NFC.Rafael Espindola2017-12-101-2/+2
| | | | llvm-svn: 320323
* PPC32: Support R_PPC_PLTREL32 in static mode.Tim Northover2017-12-101-0/+10
| | | | | | | | See https://reviews.llvm.org/D39226 Patch by vit9696 <vit9696@avp.su> llvm-svn: 320286
* Remove some includes from InputFiles.h.Rafael Espindola2017-12-0912-3/+14
| | | | | | | They were not used in InputFiles.h and it was getting too easy to add circular includes. llvm-svn: 320256
* Make createSyntheticSections a static helper. NFC.Rafael Espindola2017-12-081-96/+95
| | | | llvm-svn: 320200
* Make findSection a static function. NFC.Rafael Espindola2017-12-081-9/+8
| | | | llvm-svn: 320198
* ELF: Ignore --long-plt flag.Peter Collingbourne2017-12-081-0/+1
| | | | | | | | This flag can be ignored because we always emit long PLTs. Differential Revision: https://reviews.llvm.org/D41025 llvm-svn: 320178
* Make addReservedSymbols a static helper. NFC.Rafael Espindola2017-12-081-79/+78
| | | | llvm-svn: 320175
* Print the bad value and required alignment for unaligned relocationsAlexander Richardson2017-12-081-1/+2
| | | | | | | | | | | | Reviewers: ruiu, grimar Reviewed By: ruiu Subscribers: emaste, javed.absar, llvm-commits Differential Revision: https://reviews.llvm.org/D40963 llvm-svn: 320147
* Use lambda to simplify code.Rui Ueyama2017-12-081-26/+25
| | | | | | Differential Revision: https://reviews.llvm.org/D40994 llvm-svn: 320130
* Further simplify .gnu.hash writing. NFC.Rafael Espindola2017-12-071-12/+10
| | | | llvm-svn: 320072
* Simplify .gnu.hash writing. NFC.Rafael Espindola2017-12-071-9/+6
| | | | llvm-svn: 320070
* Avoid using a temporary std::vector.Rafael Espindola2017-12-071-15/+15
| | | | | | | With this memory usage when linking clang goes from 174.62MB to 172.77MB. llvm-svn: 320069
* [ELF][mips] Print the full file path for files with incompatible ISAAlexander Richardson2017-12-071-14/+20
| | | | | | | | | | | | | | | | | | Summary: I also changed the message to print both the ISA and the the architecture name for incompatible files. Previously it would be quite hard to find the actual path of the incompatible object files in projects that have many object files with the same name in different directories. Reviewers: atanasyan, ruiu Reviewed By: atanasyan Subscribers: emaste, sdardis, llvm-commits Differential Revision: https://reviews.llvm.org/D40958 llvm-svn: 320056
* [ELF] Handle multiple "--version-script" options.Igor Kudrin2017-12-071-1/+1
| | | | | | | | Both ld.bfd and ld.gold can handle this case. Differential Revision: https://reviews.llvm.org/D40878 llvm-svn: 320006
* Remove checkToString functions and use toString instead.Rui Ueyama2017-12-071-40/+30
| | | | | | Differential Revision: https://reviews.llvm.org/D40928 llvm-svn: 320005
* Add a call to std::vector::reserve.Rafael Espindola2017-12-061-0/+3
| | | | | | | | | | This reduces total allocations when linking clang fsds from 263.21MB to 174.62MB. This also has some very nice speed improvements on some benchmarks. Chromium and clang fsds link 6% faster. llvm-svn: 319976
* Always evaluate the second argument for CHECK() lazily.Rui Ueyama2017-12-062-46/+41
| | | | | | | | | This patch is to rename check CHECK and make it a C macro, so that we can evaluate the second argument lazily. Differential Revision: https://reviews.llvm.org/D40915 llvm-svn: 319974
* Convert a check to checkLazy.Rafael Espindola2017-12-061-2/+3
| | | | | | | This brings memory allocations when linking clang from 270.96MB to 267.80MB. llvm-svn: 319932
* Add an early return.Rafael Espindola2017-12-061-0/+2
| | | | | | | Total memory allocation when linking clang goes from 281.80MB to 270.96MB. llvm-svn: 319930
OpenPOWER on IntegriCloud