summaryrefslogtreecommitdiffstats
path: root/lld/ELF/InputSection.h
Commit message (Collapse)AuthorAgeFilesLines
...
* Be a bit more consistent about using getters. NFC.Rafael Espindola2016-10-251-0/+1
| | | | llvm-svn: 285082
* Delete getSectionHdr.Rafael Espindola2016-10-251-2/+5
| | | | | | | | | | | We were fairly inconsistent as to what information should be accessed with getSectionHdr and what information (like alignment) was stored elsewhere. Now all section info has a dedicated getter. The code is also a bit more compact. llvm-svn: 285079
* Fix SectionPiece size when compiling with MSVCHans Wennborg2016-10-201-1/+1
| | | | | | | | | | | | Builds were failing with: InputSection.h(139): error C2338: SectionPiece is too big because MSVC does record layout differently, probably not packing the 'OutputOff' and 'Live' bitfields because their types are of different size. Using size_t for 'Live' seems to fix it. llvm-svn: 284740
* Compact SectionPiece.Rafael Espindola2016-10-201-21/+15
| | | | | | | We allocate a lot of these when linking debug info. This speeds up the link of debug programs by 1% to 2%. llvm-svn: 284716
* Format. NFC.Rui Ueyama2016-10-201-6/+1
| | | | llvm-svn: 284697
* Don't call markLiveAt for non alloc sections.Rafael Espindola2016-10-191-1/+4
| | | | | | We don't gc them anyway, so just use an early return in Enqueue. llvm-svn: 284663
* Support GNU-style ZLIB-compressed input sections.Rui Ueyama2016-10-121-1/+8
| | | | | | | | | | | | | | | | | | Previously, we supported only SHF_COMPRESSED sections because it's new and it's the ELF standard. But there are object files compressed in the GNU style out there, so we had to support it. Sections compressed in the GNU style start with ".zdebug_" and contain different headers than the ELF standard's one. In this patch, getRawCompressedData is responsible to handle it. A tricky thing about GNU-style compressed sections is that we have to rename them when creating output sections. ".zdebug_" prefix implies the section is compressed. We need to rename ".zdebug_" ".debug" because our output sections are not compressed. We do that in this patch. llvm-svn: 284068
* [ELF][ARM] Garbage collection support for .ARM.exidx sectionsPeter Smith2016-10-101-0/+3
| | | | | | | | | | | | | | | .ARM.exidx sections have a reverse dependency on the section they have a SHF_LINK_ORDER dependency on. In other words a .ARM.exidx section is live only if the executable section it describes is live. We implement this with a reverse dependency field in InputSection. Adding the dependency to InputSection is the simplest implementation but it could be moved out to a separate map if it were found to decrease performance for non ARM targets. Differential revision: https://reviews.llvm.org/D25234 llvm-svn: 283734
* [ELF][ARM] Initial implentation of ARM exceptions supportPeter Smith2016-10-101-1/+1
| | | | | | | | | | | | | | | | | | | The .ARM.exidx sections contain a table. Each entry has two fields: - PREL31 offset to the function the table entry describes - Action to take, either cantunwind, inline unwind, or PREL31 offset to .ARM.extab section The table entries must be sorted in order of the virtual addresses the first entry of the table describes. Traditionally this is implemented by the SHF_LINK_ORDER dependency. Instead of implementing this directly we sort the table entries post relocation. The .ARM.exidx OutputSection is described by the PT_ARM_EXIDX program header Differential revision: https://reviews.llvm.org/D25127 llvm-svn: 283730
* Store the hash in SectionPiece.Rafael Espindola2016-10-051-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This spreads out computing the hash and using it in a hash table. The speedups are: firefox master 6.811232891 patch 6.559280249 1.03841162939x faster chromium master 4.369323666 patch 4.33171853 1.00868134338x faster chromium fast master 1.856679971 patch 1.850617741 1.00327578725x faster the gold plugin master 0.32917962 patch 0.325711944 1.01064645023x faster clang master 0.558015452 patch 0.550284165 1.01404962652x faster llvm-as master 0.032563515 patch 0.032152077 1.01279662275x faster the gold plugin fsds master 0.356221362 patch 0.352772162 1.00977741549x faster clang fsds master 0.635096494 patch 0.627249229 1.01251060127x faster llvm-as fsds master 0.030183188 patch 0.029889544 1.00982430511x faster scylla master 3.071448906 patch 2.938484138 1.04524944215x faster This seems to be because we don't stall as much. When linking firefox stalled-cycles-frontend goes from 57.56% to 55.55%. With -O2 the difference is even more significant since we avoid recomputing the hash. For firefox we go from 9.990295265 to 9.149627521 seconds (1.09x faster). llvm-svn: 283367
* Compact SectionPiece.Rafael Espindola2016-10-051-5/+7
| | | | | | | | | It is pretty easy to get the data from the InputSection, so we don't have to store it. This opens the way for storing the hash instead. llvm-svn: 283357
* Simplify setting the Live bit in SectionPiece. NFC.Rafael Espindola2016-10-051-2/+2
| | | | llvm-svn: 283340
* Store an ArrayRef for Data in InputSectionData.Rafael Espindola2016-09-121-6/+7
| | | | llvm-svn: 281210
* Revert "Revert "Compact InputSectionData from 64 to 48 bytes. NFC.""Rafael Espindola2016-09-121-2/+3
| | | | | | | | This reverts commit r281096. The previous link errors should be fixed by r281208. llvm-svn: 281209
* Revert "Compact InputSectionData from 64 to 48 bytes. NFC."Rafael Espindola2016-09-091-3/+2
| | | | | | | | | This reverts commit r281084. The link was failing on some bots. No idea why. I will try to reproduce it on Monday. llvm-svn: 281096
* Compact InputSectionData from 64 to 48 bytes. NFC.Rafael Espindola2016-09-091-2/+3
| | | | llvm-svn: 281084
* Compute section names only once.Rafael Espindola2016-09-081-11/+18
| | | | | | | | This simplifies error handling as there is now only one place in the code that needs to consider the possibility that the name is corrupted. Before we would do it in every access. llvm-svn: 280937
* Pack InputSectionData from 72 to 64 bytes. NFC.Rafael Espindola2016-09-081-4/+11
| | | | llvm-svn: 280925
* Move field to the base class. NFC.Rafael Espindola2016-09-071-1/+2
| | | | llvm-svn: 280858
* Delete dead field. NFC.Rafael Espindola2016-09-071-1/+1
| | | | llvm-svn: 280856
* Eliminate LayoutInputSection classEugene Leviant2016-09-011-22/+27
| | | | | | | | | | Previously we used LayoutInputSection class to correctly assign symbols defined in linker script. This patch removes it and uses pointer to preceding input section in SymbolAssignment class instead. Differential revision: https://reviews.llvm.org/D23661 llvm-svn: 280348
* Delete unnecessary template.Rafael Espindola2016-08-311-2/+2
| | | | llvm-svn: 280237
* [ELF][MIPS] Support .MIPS.abiflags sectionSimon Atanasyan2016-08-121-1/+20
| | | | | | | This section supersedes .reginfo and .MIPS.options sections. But for now we have to support all three sections for ABI transition period. llvm-svn: 278482
* [ELF] Symbol assignment within output section descriptionEugene Leviant2016-08-111-1/+1
| | | | llvm-svn: 278322
* Include filenames and section names to error messages.Rui Ueyama2016-08-031-0/+3
| | | | llvm-svn: 277566
* Remove dependency to SymbolTable from CommonInputSection.Rui Ueyama2016-07-291-1/+1
| | | | llvm-svn: 277103
* Make CommonInputSection singleton class.Rui Ueyama2016-07-281-2/+11
| | | | | | | | | All other singleton instances are accessible globally. CommonInputSection shouldn't be an exception. Differential Revision: https://reviews.llvm.org/D22935 llvm-svn: 277034
* [ELF] Allows setting section for common symbols in linker scriptEugene Leviant2016-07-281-0/+12
| | | | llvm-svn: 277023
* Fix PR28575.Rafael Espindola2016-07-211-1/+8
| | | | | | | | | | Not all relocations from a .eh_frame that point to an executable section should be ignored. In particular, the relocation finding the personality function should not. This is a reduction from trying to bootstrap a static lld on linux. llvm-svn: 276329
* Delete SplitInputSection.Rafael Espindola2016-07-211-23/+14
| | | | | | This opens the way for having a different Piece type for EhInputSection. llvm-svn: 276275
* Delete EhInputSection::getOffset.Rafael Espindola2016-07-201-4/+0
| | | | | | | | | | | | | We no longer need it for relocations in .eh_frame. The only relocations that point to .eh_frame are the ones trying to find the output .eh_frame. This actually fixes a bug in the symbol value code. It was not handling -1 as an indicator for a piece not being included in the output. llvm-svn: 276175
* [ELF] Create output sections in LinkerScript classEugene Leviant2016-07-201-2/+0
| | | | llvm-svn: 276121
* [ELF] - Make few members of Writer to be global and export them for reuseGeorge Rimar2016-07-121-0/+2
| | | | | | | | | | | Creating sections on linkerscript side requires some methods that can be reused if are exported from writer. Patch implements that change. Differential revision: http://reviews.llvm.org/D20104 llvm-svn: 275162
* Recommit R274836 Add Thunk support framework for ARM and MipsPeter Smith2016-07-081-3/+4
| | | | | | | | | | | The TinyPtrVector of const Thunk<ELFT>* in InputSections.h can cause build failures on certain compiler/library combinations when Thunk<ELFT> is not a complete type or is an abstract class. Fixed by making Thunk<ELFT> non Abstract. type or is an abstract class llvm-svn: 274863
* Revert R274836 Add Thunk support framework for ARM and MipsPeter Smith2016-07-081-4/+3
| | | | | | | This seems to be causing a buildbot failure on lld-x86_64-freebsd. Will reproduce locally and fix. llvm-svn: 274841
* Add Thunk support framework for ARM and MipsPeter Smith2016-07-081-3/+4
| | | | | | | | | | | | | | | | | | | | | | | Generalise the Mips LA25 Thunk code and implement ARM and Thumb interworking Thunks. - Introduce a new module Thunks.cpp to store the Target Specific Thunk implementations. - DefinedRegular and Shared have a ThunkData field to record Thunk. - A Target can have more than one type of Thunk. - Support PC-relative calls to Thunks. - Support Thunks to PLT entries. - Existing Mips LA25 Thunk code integrated. - Support for ARMv7A interworking Thunks. Limitations: - Only one Thunk per SymbolBody, this is sufficient for all currently implemented Thunks. - ARM thunks assume presence of V6T2 MOVT and MOVW instructions. Differential revision: http://reviews.llvm.org/D21891 llvm-svn: 274836
* Fix endianness issue.Rui Ueyama2016-07-071-0/+1
| | | | | | | | Previously, ch_size was read in host byte order, so if a host and a target are different in byte order, we would produce a corrupted output. llvm-svn: 274729
* [ELF] - Support of compressed input sections implemented.George Rimar2016-06-241-0/+7
| | | | | | | | | | Patch implements support of zlib style compressed sections. SHF_COMPRESSED flag is used to recognize that decompression is required. After that decompression is performed and flag is removed from output. Differential revision: http://reviews.llvm.org/D20272 llvm-svn: 273661
* Fix a bug that MIPS thunks can overwrite other section contents.Rui Ueyama2016-06-231-5/+6
| | | | | | | | | | | | | | | Peter Smith found while trying to support thunk creation for ARM that LLD sometimes creates broken thunks for MIPS. The cause of the bug is that we assign file offsets to input sections too early. We need to create all sections and then assign section offsets because appending thunks changes file offsets for all following sections. This patch separates the pass to assign file offsets from thunk creation pass. This effectively reverts r265673. Differential Revision: http://reviews.llvm.org/D21598 llvm-svn: 273532
* Rename Align -> Alignment.Rui Ueyama2016-06-171-1/+1
| | | | | | | | I think it is me who named these variables, but I always find that they are slightly confusing because align is a verb. Adding four letters is worth it. llvm-svn: 272984
* [ELF] Unbreak build with GCC.Davide Italiano2016-05-281-2/+2
| | | | | | Differential Revision: http://reviews.llvm.org/D20777 llvm-svn: 271148
* Avoid doing binary search.Rui Ueyama2016-05-271-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MergedInputSection::getOffset is the busiest function in LLD if string merging is enabled and input files have lots of mergeable sections. It is usually the case when creating executable with debug info, so it is pretty common. The reason why it is slow is because it has to do faily complex computations. For non-mergeable sections, section contents are contiguous in output, so in order to compute an output offset, we only have to add the output section's base address to an input offset. But for mergeable strings, section contents are split for merging, so they are not contigous. We've got to do some lookups. We used to do binary search on the list of section pieces. It is slow because I think it's hostile to branch prediction. This patch replaces it with hash table lookup. Seems it's working pretty well. Below is "perf stat -r10" output when linking clang with debug info. In this case this patch speeds up about 4%. Before: 6584.153205 task-clock (msec) # 1.001 CPUs utilized ( +- 0.09% ) 238 context-switches # 0.036 K/sec ( +- 6.59% ) 0 cpu-migrations # 0.000 K/sec ( +- 50.92% ) 1,067,675 page-faults # 0.162 M/sec ( +- 0.15% ) 18,369,931,470 cycles # 2.790 GHz ( +- 0.09% ) 9,640,680,143 stalled-cycles-frontend # 52.48% frontend cycles idle ( +- 0.18% ) <not supported> stalled-cycles-backend 21,206,747,787 instructions # 1.15 insns per cycle # 0.45 stalled cycles per insn ( +- 0.04% ) 3,817,398,032 branches # 579.786 M/sec ( +- 0.04% ) 132,787,249 branch-misses # 3.48% of all branches ( +- 0.02% ) 6.579106511 seconds time elapsed ( +- 0.09% ) After: 6312.317533 task-clock (msec) # 1.001 CPUs utilized ( +- 0.19% ) 221 context-switches # 0.035 K/sec ( +- 4.11% ) 1 cpu-migrations # 0.000 K/sec ( +- 45.21% ) 1,280,775 page-faults # 0.203 M/sec ( +- 0.37% ) 17,611,539,150 cycles # 2.790 GHz ( +- 0.19% ) 10,285,148,569 stalled-cycles-frontend # 58.40% frontend cycles idle ( +- 0.30% ) <not supported> stalled-cycles-backend 18,794,779,900 instructions # 1.07 insns per cycle # 0.55 stalled cycles per insn ( +- 0.03% ) 3,287,450,865 branches # 520.799 M/sec ( +- 0.03% ) 72,259,605 branch-misses # 2.20% of all branches ( +- 0.01% ) 6.307411828 seconds time elapsed ( +- 0.19% ) Differential Revision: http://reviews.llvm.org/D20645 llvm-svn: 270999
* Make SectionPiece 8 bytes smaller on LP64.Rui Ueyama2016-05-251-4/+15
| | | | | | | | | | | | This patch makes SectionPiece class 8 bytes smaller on platforms on which pointer size is 8 bytes. Sean suggested in a post commit review for r270340 that this could make a differentce, and it actually is. Time to link clang (with debug info) improved from 6.725 seconds to 6.589 seconds or by about 2%. Differential Revision: http://reviews.llvm.org/D20613 llvm-svn: 270717
* Create Relocations.cpp and move scanRelocs there.Rui Ueyama2016-05-241-48/+1
| | | | | | | | | | scanReloc and the functions on which scanReloc depends is in total more than 600 lines of code. Since scanReloc does not depend on Writer, it is better to move it into a separate file. Differential Revision: http://reviews.llvm.org/D20554 llvm-svn: 270606
* Revert "Simplify. Thanks to Rui for the suggestion."Rafael Espindola2016-05-241-2/+0
| | | | | | | | This reverts commit r270551. Sorry, I commited the wrong branch :-( llvm-svn: 270554
* Simplify. Thanks to Rui for the suggestion.Rafael Espindola2016-05-241-0/+2
| | | | llvm-svn: 270551
* Rename EHInputSection -> EhInputSection.Rui Ueyama2016-05-241-2/+2
| | | | llvm-svn: 270532
* Do not split mergeable sections if they are gc'ed.Rui Ueyama2016-05-231-2/+11
| | | | | | | | | | | | | | | | | | | | | Previously, mergeable section's constructors did more than just setting member variables; it split section contents into small pieces. It is not always computationally cheap task because if the section is a mergeable string section, it needs to scan the entire section to split them by NUL characters. If a section would be thrown away by GC, that cost ended up being a waste of time. It is going to be larger problem if the section is compressed -- the whole time to uncompress it and split it up is going to be a waste. Luckily, we can defer section splitting after GC. We just have to remember which offsets are in use during GC and apply that later. This patch implements it. Differential Revision: http://reviews.llvm.org/D20516 llvm-svn: 270455
* Move splitInputSection from EHOutputSection to EHInputSection.Rui Ueyama2016-05-221-0/+1
| | | | llvm-svn: 270385
* Store section contents to SectionPiece. NFC.Rui Ueyama2016-05-221-3/+6
| | | | | | So that we don't need to cut a slice when we use a SectionPiece. llvm-svn: 270348
OpenPOWER on IntegriCloud