summaryrefslogtreecommitdiffstats
path: root/lld/ELF/InputSection.h
Commit message (Collapse)AuthorAgeFilesLines
...
* Replace size_t with uintX_t in a few places.Rafael Espindola2015-11-111-1/+1
| | | | | | If linking a 32 bit binary, these values must fit in 32 bits. llvm-svn: 252739
* Don't pass a member variable to a method. NFC.Rafael Espindola2015-11-111-1/+1
| | | | llvm-svn: 252718
* Move relocate to the base class.Rafael Espindola2015-11-111-7/+6
| | | | | | | This is in preparation for adding .eh_frame support. They will have another input section type but will also need to be relocated. llvm-svn: 252717
* [ELF2] merge-string.s test fixed for win32 configuration.George Rimar2015-10-291-1/+1
| | | | | | Differential revision: http://reviews.llvm.org/D14171 llvm-svn: 251644
* ELF2: Move some code from MarkLive.cpp to InputSection.cpp.Rui Ueyama2015-10-271-0/+6
| | | | | | This function is useful for ICF, so move that to a common place. llvm-svn: 251455
* Add support for merging string from SHF_STRINGS sections.Rafael Espindola2015-10-241-0/+3
| | | | llvm-svn: 251212
* Drop a few const to reduce the noise from the next patch. NFC.Rafael Espindola2015-10-231-2/+2
| | | | llvm-svn: 251140
* ELF2: Implement --gc-sections.Rui Ueyama2015-10-221-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | Section garbage collection is a feature to remove unused sections from outputs. Unused sections are sections that cannot be reachable from known GC-root symbols or sections. Naturally the feature is implemented as a mark-sweep garbage collector. In this patch, I added Live bit to InputSectionBase. If and only if Live bit is on, the section will be written to the output. Starting from GC-root symbols or sections, a new function, markLive(), visits all reachable sections and sets their Live bits. Writer then ignores sections whose Live bit is off, so that such sections are excluded from the output. This change has small negative impact on performance if you use the feature because making sections means more work. The time to link Clang changes from 0.356s to 0.386s, or +8%. It reduces Clang size from 57,764,984 bytes to 55,296,600 bytes. That is 4.3% reduction. http://reviews.llvm.org/D13950 llvm-svn: 251043
* Add support for merging the contents of SHF_MERGE sections.Rafael Espindola2015-10-191-17/+52
| | | | | | For now SHF_STRINGS are not supported. llvm-svn: 250737
* Change getLocalRelTarget to include the addend.Rafael Espindola2015-10-191-6/+0
| | | | | | | | | Given the name, it is natural for this function to compute the full target. This will simplify SHF_MERGE handling by allowing getLocalRelTarget to centralize the addend logic. llvm-svn: 250731
* ELF2: Use ELFT to template OutputSections.Rui Ueyama2015-10-151-2/+2
| | | | | | | | | | | | This patch is to use ELFT instead of Is64Bits to template OutputSection and its subclasses. This increases code size slightly because it creates two identical functions for some classes, but that's only 20 KB out of 33 MB, so it's negligible. This is as per discussion with Rafael. He's not fan of the idea but OK with this. We'll revisit later to this topic. llvm-svn: 250466
* Centralize the handling of r_addend. NFC.Rafael Espindola2015-10-151-0/+6
| | | | | | | | | | | When a relocation points to a SHF_MERGE section, the addend has special meaning. It should be used to find what in the section the relocation points to. It should not be added to the output position. Centralizing it means that the above rule will be implemented once, not once per target. llvm-svn: 250421
* Use OutputSectionBase in a few cases where we don't need a OutputSection.Rafael Espindola2015-10-151-1/+2
| | | | | | | NFC. This is just preparation for adding a new OutputSection dedicated to SHF_MERGE input sections. llvm-svn: 250419
* ELF2: Do not use OutputSection as a member variable name.Rui Ueyama2015-10-151-2/+2
| | | | | | We have OutputSection<ELFT> type. GCC 4.9.2 warns on the duplication. llvm-svn: 250358
* ELF2: Remove {set,get}OutputSection accessors.Rui Ueyama2015-10-141-5/+1
| | | | | | | These accessors didn't provide any additional value over a public member variable, too. llvm-svn: 250328
* ELF2: Remove {set,get}OutputSectionOff accessors.Rui Ueyama2015-10-141-6/+4
| | | | | | | These accessors didn't provide any additional value over a public member variable. llvm-svn: 250326
* [ELF2] Allow PPC64 to add the TOC-restore after .plt-based relocationsHal Finkel2015-10-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Under the PPC64 ELF ABI, functions that might call into other modules (and, thus, need to load a different TOC base value into %r2), need to restore the old value after the call. The old value is saved by the .plt code, and the caller only needs to include a nop instruction after the call, which the linker will transform into a TOC restore if necessary. In order to do this the relocation handler needs two things: 1. It needs to know whether the call instruction it is modifying is targeting a .plt stub that will load a new TOC base value (necessitating a restore after the call). 2. It needs to know where the buffer ends, so that it does not accidentally run off the end of the buffer when looking for the 'nop' instruction after the call. Given these two pieces of information, we can insert the restore instruction in place of the following nop when necessary. llvm-svn: 250110
* Add support for comdats.Rafael Espindola2015-10-091-0/+5
| | | | | | The implementation is a direct translation to c++ of the rules in the ELF spec. llvm-svn: 249881
* ELF2: Make singleton output sections globally accessible.Rui Ueyama2015-10-071-7/+2
| | | | | | | | | | | | | | | Previously, output sections that are handled specially by the linker (e.g. PLT or GOT) were created by Writer and passed to other classes that need them. The problem was that because these special sections are required by so many classes, the plumbing work became too much burden. This patch is to simply make them accessible from anywhere in the linker to eliminate the plumbing work once and for all. http://reviews.llvm.org/D13486 llvm-svn: 249590
* ELF2: Rename local variable name `Out` in preparation to define `Out` global ↵Rui Ueyama2015-10-071-3/+3
| | | | | | var. llvm-svn: 249568
* Simplify memory management by having ELFData contain a ELFObj.Rafael Espindola2015-09-241-1/+1
| | | | llvm-svn: 248502
* [elf2] Pass BSSSec to the relocation handling code differently. Don't store ↵Michael J. Spencer2015-09-231-2/+3
| | | | | | it in the symbol. llvm-svn: 248393
* Move relocation processing to Target.Rafael Espindola2015-09-221-5/+0
| | | | | | I will add a couple of ppc64 relocs in the next patches. llvm-svn: 248319
* Remove the Chunk terminology from ELF.Rafael Espindola2015-09-221-5/+5
| | | | llvm-svn: 248229
* Rename Chunks.(h|cpp) to InputSection.(h|cpp). NFC.Rafael Espindola2015-09-221-0/+90
llvm-svn: 248226
OpenPOWER on IntegriCloud