summaryrefslogtreecommitdiffstats
path: root/lld/ELF/OutputSections.h
Commit message (Collapse)AuthorAgeFilesLines
...
* Detemplate SectionKey. NFC.Rafael Espindola2017-01-051-15/+12
| | | | llvm-svn: 291110
* Change which input sections we concatenateRafael Espindola2017-01-051-1/+0
| | | | | | | | | | | | | | | | | | | | | After Mark's patch I was wondering what was the rationale for the ELF spec requiring us to merge only sections with matching flags and types. I tried emailing https://groups.google.com/forum/#!forum/generic-abi, but looks like my emails are not being posted (the list is probably moderated). I emailed Cary Coutant instead. Cary pointed out that the section was a late addition and didn't got the scrutiny it deserved. Given that and the problems found by implementing the letter of the standard, I propose changing lld to merge all sections with the same name and issue errors if the types or some critical flags are different. This should allow an unmodified firefox linked with lld to run. This also merges some code with the linkerscript path. llvm-svn: 291107
* Simplify type of Config->SymbolOrderingFile.Rui Ueyama2016-12-201-1/+1
| | | | | | | | | | | That variable was of type DenseMap<StringRef, unsigned>, but the unsigned numbers needed to be monotonicly increasing numbers because the implementation that used the variable depended on that fact. That was an implementation detail and shouldn't have leaked into Config. This patch simplifies its type to std::vector<StringRef>. llvm-svn: 290151
* Detemplate PhdrEntry. NFC.Rafael Espindola2016-12-191-2/+3
| | | | llvm-svn: 290115
* [ELF] Refactor target error messagesEugene Leviant2016-11-291-0/+3
| | | | | | Differential revision: https://reviews.llvm.org/D27097 llvm-svn: 288114
* Split MergeOutputSection::finalize.Rui Ueyama2016-11-261-0/+3
| | | | llvm-svn: 287977
* [ELF] EhOutputSection improvementsEugene Leviant2016-11-251-4/+2
| | | | | | Differential revision: https://reviews.llvm.org/D27098 llvm-svn: 287914
* [ELF] Convert .rld_map to input sectionEugene Leviant2016-11-221-2/+0
| | | | | | Differential revision: https://reviews.llvm.org/D26958 llvm-svn: 287675
* [ELF] Convert Version*** sections to input sectionsEugene Leviant2016-11-211-86/+0
| | | | | | Differential revision: https://reviews.llvm.org/D26918 llvm-svn: 287554
* [ELF] Convert EhFrameHeader to input sectionEugene Leviant2016-11-211-34/+0
| | | | | | Differential revision: https://reviews.llvm.org/D26906 llvm-svn: 287549
* [ELF] Convert GdbIndexSection to input sectionEugene Leviant2016-11-211-27/+0
| | | | | | Differential revision: https://reviews.llvm.org/D26854 llvm-svn: 287526
* [ELF] Convert PltSection to input sectionEugene Leviant2016-11-181-21/+0
| | | | | | Differential revision: https://reviews.llvm.org/D26842 llvm-svn: 287346
* [ELF] Convert HashTableSection to input sectionEugene Leviant2016-11-181-16/+0
| | | | | | Differential revision: https://reviews.llvm.org/D26834 llvm-svn: 287326
* [ELF] Convert GnuHashTableSection to input sectionEugene Leviant2016-11-181-50/+0
| | | | | | Differential revision: https://reviews.llvm.org/D26792 llvm-svn: 287322
* Simplify MergeOutputSection.Rui Ueyama2016-11-181-3/+0
| | | | | | | | | | | | | | | | | MergeOutputSection class was a bit hard to use because it provdes a series of finalize functions that have to be called in a right way at a right time. It also intereacted with MergeInputSection, and the logic was somewhat entangled between the two classes. This patch simplifies it by providing only one finalize function. Now, all you have to do is to call MergeOutputSection::finalize when you have added all sections to the output section. Then, it internally merges strings and initliazes StringPiece objects. I think this is much easier to understand. This patch also adds comments. llvm-svn: 287314
* [ELF] Remove unneeded forward declarations. NFC.Eugene Leviant2016-11-171-3/+0
| | | | llvm-svn: 287218
* [ELF] Convert SymbolTableSection to input sectionEugene Leviant2016-11-171-39/+0
| | | | | | Differential revision: https://reviews.llvm.org/D26740 llvm-svn: 287216
* [ELF] Convert RelocationSection to input sectionEugene Leviant2016-11-161-62/+0
| | | | | | Differential revision: https://reviews.llvm.org/D26669 llvm-svn: 287092
* [ELF] Convert DynamicSection to input section.Eugene Leviant2016-11-151-52/+0
| | | | | | | | | | | | | | | | This patch introduces the following changes: - DynamicSection now inherits InputSection<ELFT> and was moved to SyntheticSections.h/.cpp. - Link and Entsize fields of DynamicSection are propagated to its output section - In<ELFT>::SyntheticSections was removed. - Finalization of synthetic sections was removed from OutputSection<ELFT>::finalize. Now finalizeSyntheticSections is used instead. Differential revision: https://reviews.llvm.org/D26603 llvm-svn: 286950
* [ELF] Convert StringTableSection to input sectionEugene Leviant2016-11-141-27/+0
| | | | | | Differential revision: https://reviews.llvm.org/D26549 llvm-svn: 286799
* [ELF] Convert .got section to input sectionEugene Leviant2016-11-111-72/+1
| | | | | | Differential revision: https://reviews.llvm.org/D26498 llvm-svn: 286580
* [ELF] Convert .got.plt section to input sectionEugene Leviant2016-11-101-22/+4
| | | | | | Differential revision: https://reviews.llvm.org/D26349 llvm-svn: 286443
* [ELF] - Implemented --symbol-ordering-file option.George Rimar2016-11-101-0/+1
| | | | | | | | | | | | | | | | | | | | | | | Patch allows to pass a symbols file to linker. LLD will map symbols to sections and sort sections in output according to symbol ordering file. That can help to reduce the startup time and/or amount of pagefaults during startup. Also, interesting benchmark result was produced by Rafael Espíndola. After applying the symbols file for clang he timed compiling X86MCTargetDesc.ii to an object file. The page faults went from just 56,988 to 56,946 since most faults are not in the binary. Running time went from 4.403053515 to 4.178112244. The speedup seems to be because of better cache locality. Differential revision: https://reviews.llvm.org/D26130 llvm-svn: 286440
* Make OutputSectionBase a class instead of class template.Rafael Espindola2016-11-091-119/+120
| | | | | | | | The disadvantage is that we use uint64_t instad of uint32_t for some value in 32 bit files. The advantage is a substantially simpler code, faster builds and less code duplication. llvm-svn: 286414
* [ELF][MIPS] Convert .MIPS.abiflags section to synthetic input sectionSimon Atanasyan2016-11-091-19/+0
| | | | | | | | | | | | | | Previously, we have both input and output section for .MIPS.abiflags. Now we have only one class for .MIPS.abiflags, which is MipsAbiFlagsSection. This class is a synthetic input section. .MIPS.abiflags sections are handled as regular sections until the control reaches Writer. Writer then aggregates all sections whose type is SHT_MIPS_ABIFLAGS to create a single synthesized input section. The synthesized section is then processed normally as if it came from an input file. llvm-svn: 286398
* [ELF][MIPS] Convert .reginfo and .MIPS.options sections to synthetic input ↵Simon Atanasyan2016-11-091-40/+0
| | | | | | | | | | | | | | | | | | | sections Previously, we have both input and output sections for .reginfo and .MIPS.options. Now for each such sections we have one synthetic input sections: MipsReginfoSection and MipsOptionsSection respectively. Both sections are handled as regular sections until the control reaches Writer. Writer then aggregates all sections whose type is SHT_MIPS_REGINFO or SHT_MIPS_OPTIONS to create a single synthesized input section. In that moment Writer also save GP0 value to the MipsGp0 field of the corresponding ObjectFile. This value required for R_MIPS_GPREL16 and R_MIPS_GPREL32 relocations calculation. Differential revision: https://reviews.llvm.org/D26444 llvm-svn: 286397
* Split Header into individual fields.Rafael Espindola2016-11-091-20/+17
| | | | | | | | | This is similar to what was done for InputSection. With this the various fields are stored in host order and only converted to target order when writing. llvm-svn: 286327
* Store the size the same way as any other OutputSection. NFC.Rafael Espindola2016-11-081-3/+0
| | | | llvm-svn: 286286
* Add a few const qualifiers.Rafael Espindola2016-11-041-1/+1
| | | | llvm-svn: 285996
* Convert Out::InterpSection to In::InterpSection.Rui Ueyama2016-11-021-14/+0
| | | | | | Differential Revision: https://reviews.llvm.org/D26225 llvm-svn: 285851
* Add strings to .dynstr early.Rui Ueyama2016-11-021-1/+5
| | | | | | | | | | | | | | | | | Previously, we added strings from DynamicSection::finalize(). It was a bit tricky because finalize() is supposed to fix the final size of the section, but adding new strings would change the size of .dynstr section. So there was a dependency between finalize functions of .dynamic and .dynstr. However, I noticed that we can elimiante the dependency by simply add strings early; we don't have to do that in finalize() but can do from DynamicSection's ctor. This patch defines a new function, DynamicSection::addEntries, to add .dynamic entries that doesn't depend on other sections. llvm-svn: 285784
* Create Out members using make() to simplify.Rui Ueyama2016-11-011-1/+3
| | | | llvm-svn: 285764
* Remove Out::Pool and use make() instead.Rui Ueyama2016-11-011-7/+0
| | | | llvm-svn: 285763
* Create SyntheticSections.cpp.Rui Ueyama2016-11-011-2/+0
| | | | | | | | We are going to have many more classes for linker-synthesized input sections, so it's worth to be added to a separate file than to the file for regular input sections. llvm-svn: 285740
* Convert BuildIdSection to input sectionEugene Leviant2016-11-011-50/+0
| | | | | | Differential revision: https://reviews.llvm.org/D25627 llvm-svn: 285682
* [ELF][MIPS] Put local GOT entries accessed via a 16-bit index firstSimon Atanasyan2016-10-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | Some MIPS relocations used to access GOT entries are able to manipulate 16-bit index. The other ones like R_MIPS_CALL_HI16/LO16 can handle 32-bit indexes. 16-bit relocations are generated by default. The 32-bit relocations are generated by -mxgot flag passed to compiler. Usually these relocation are not mixed in the same code but files like crt*.o contain 16-bit relocations so even if all "user's" code compiled with -mxgot flag a few 16-bit relocations might come to the linking phase. Now LLD does not differentiate local GOT entries accessed via a 16-bit and 32-bit indexes. That might lead to relocation's overflow if 16-bit entries are allocated to far from the beginning of the GOT. The patch introduces new "part" of MIPS GOT dedicated to the local GOT entries accessed by 32-bit relocations. That allows to put local GOT entries accessed via a 16-bit index first and escape relocation's overflow. Differential revision: https://reviews.llvm.org/D25833 llvm-svn: 284809
* [ELF] - Partial support of --gdb-index command line option (Part 1).George Rimar2016-10-201-0/+30
| | | | | | | | | | | | | | | In this patch partial gdb_index section is created. For costructing the .gdb_index section 6 steps should be performed (details are in SplitDebugInfo.cpp file header), this patch do first 3: Creates proper section header. Fills list of compilation units. Types CU list area is not supposed to be supported, so it is ignored and therefore can be treated as implemented either. Differential revision: https://reviews.llvm.org/D24706 llvm-svn: 284708
* [ELF] - Applied clang format. NFC.George Rimar2016-10-201-4/+2
| | | | llvm-svn: 284705
* Fix narrowing conversion error in 32-bit MSVC buildsReid Kleckner2016-10-201-1/+1
| | | | | | | | Use size_t instead of ELFT::uint for the string table offset. If the linker is built 32-bit, it can't write an output file larger than 2GB. Other code in this area uses size_t as well. llvm-svn: 284680
* [ELF] Replace std::pair with a struct so we have proper names. NFC.Michael J. Spencer2016-10-191-3/+8
| | | | llvm-svn: 284670
* [ELF] Add `const` qualifier to functions. NFCSimon Atanasyan2016-10-191-2/+2
| | | | llvm-svn: 284614
* [ADT] Move CachedHashString to its own header in ADT, and rename to ↵Justin Lebar2016-10-171-1/+1
| | | | | | | | | | | | | | | | CachedHashStringRef. Summary: Reclaiming the name 'CachedHashString' will let us add a type with that name that owns its value. Reviewers: timshen Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D25644 llvm-svn: 284434
* [ELF] Linker script: implement LOADADDREugene Leviant2016-10-061-0/+3
| | | | | | Differential revision: https://reviews.llvm.org/D24298 llvm-svn: 283429
* Store the hash in SectionPiece.Rafael Espindola2016-10-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [ELF] Change the way we compute file offsets Eugene Leviant2016-09-291-0/+9
| | | | | | | | | | | If we two sections reside in the same PT_LOAD segment, we compute second section using the following formula: Off2 = Off1 + VA2 - VA1. This allows OS kernel allocating sections correctly when loading an image. Differential revision: https://reviews.llvm.org/D25014 llvm-svn: 282705
* Avoid duplicated code.Rafael Espindola2016-09-221-0/+6
| | | | | | | This also fixes the linker script accounting for the ELF header in some places but not in others. llvm-svn: 282173
* Use murmurhash2 instead of fnv.Rafael Espindola2016-09-141-2/+3
| | | | | | It is substantially faster by processing 8 bytes at a time. llvm-svn: 281454
* Enable merging of SHF_MERGE sections with linker scripts.Rafael Espindola2016-09-131-0/+3
| | | | | | | | | This also fixes the related problem of non SHF_MERGE sections with different flags not being merged. Fixes pr30355. llvm-svn: 281338
* Turn createKey into a static helper. NFC.Rafael Espindola2016-09-131-2/+0
| | | | llvm-svn: 281325
* [ELF][MIPS] Fix initialization of TLS-related GOT entriesSimon Atanasyan2016-09-081-1/+1
| | | | | | | | | | | | | | This patch allows static linking of TLS code. To do that it fixes GOT entries initialization. If TLS-related GOT entry created for a preemptible symbol i.e. has a corresponding dynamic relocation, leave the entry initialized by zero. Write down adjusted TLS symbol's values otherwise. For the adjustments calculation use offsets for thread-local storage. https://www.linux-mips.org/wiki/NPTL llvm-svn: 280914
OpenPOWER on IntegriCloud