summaryrefslogtreecommitdiffstats
path: root/lld/ELF/OutputSections.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Don't print DISCARD sections as gced.Rafael Espindola2017-02-171-0/+7
| | | | | | | | This is a small difference I noticed to gold and bfd. When given --print-gc-sections, we print sections a linkerscript marks DISCARD. The other linkers don't. llvm-svn: 295467
* Move specialization to try to fix the bots.Rafael Espindola2017-02-161-10/+0
| | | | | | | I cannot reproduce the issue locally, but for some reason some bots want to instantiate this from the header. llvm-svn: 295365
* Share more output section creation code.Rafael Espindola2017-02-161-20/+29
| | | | | | | We can do this now that the linker script and the writer agree on which sections should be combined. llvm-svn: 295341
* Fix crash with -emit-relocs -shared.Rafael Espindola2017-02-161-1/+5
| | | | | | | The code to handle the input SHT_REL/SHT_RELA sections was getting confused with the linker generated relocation sections. llvm-svn: 295322
* Make lld able to handle gold's -r output.Rafael Espindola2017-02-151-1/+1
| | | | | | | | This is still not sufficient for lld to handle its own output when a fde points to a discarded section. I am investigating if it is better to change the -r output or make lld able to read the current version. llvm-svn: 295141
* Recommit r294464 "[ELF] - Added partial support for --emit-relocs (no ↵George Rimar2017-02-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | --gc-section case, no /DISCARD/ support) #3" with temporarily file name fix in testcase. Original commit message: -q, --emit-relocs - Generate relocations in output Simplest implementation: * no GC case, * no "/DISCARD/" linkerscript command support. This patch is extracted from D28612 / D29636, Relative to PR31579. Differential revision: https://reviews.llvm.org/D29663 llvm-svn: 294469
* Reverted r294464 "[ELF] - Added partial support for --emit-relocs (no ↵George Rimar2017-02-081-1/+1
| | | | | | | | | --gc-section case, no /DISCARD/ support) #3" Broked build bot: http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/5835/steps/test/logs/stdio llvm-svn: 294466
* [ELF] - Added partial support for --emit-relocs (no --gc-section case, no ↵George Rimar2017-02-081-1/+1
| | | | | | | | | | | | | | | | | | /DISCARD/ support) #3 -q, --emit-relocs - Generate relocations in output Simplest implementation: * no GC case, * no "/DISCARD/" linkerscript command support. This patch is extracted from D28612 / D29636, Relative to PR31579. Differential revision: https://reviews.llvm.org/D29663 llvm-svn: 294464
* Revert "Simplify symbol computation for non alloc sections."Rafael Espindola2017-02-081-1/+1
| | | | | | | This reverts commit r294346. Looks like it regressed the build of magenta. llvm-svn: 294460
* Simplify symbol computation for non alloc sections.Rafael Espindola2017-02-071-1/+1
| | | | | | | We now just keep the address the section would have if it was allocatable. Only the writer ignores it at the very end. llvm-svn: 294346
* Simplify. NFC.Rafael Espindola2017-02-031-9/+3
| | | | llvm-svn: 294057
* Stop propagating Entsize.Rafael Espindola2017-02-031-2/+0
| | | | | | | Now that we combine multiple synthetic merge section into one output section there is no point in trying to propagate a value. llvm-svn: 294048
* Replace MergeOutputSection with a synthetic section.Rafael Espindola2017-02-031-93/+8
| | | | | | | | | | | | | | With a synthetic merge section we can have, for example, a single .rodata section with stings, fixed sized constants and non merge constants. I can be simplified further by not setting Entsize, but that is probably better done is a followup patch. This should allow some cleanup in the linker script code now that every output section command maps to just one output section. llvm-svn: 294005
* [ELF] Bypass section type check #2Eugene Leviant2017-01-311-8/+19
| | | | | | Differential revision: https://reviews.llvm.org/D29278 llvm-svn: 293613
* Revert commits r293276 and r293278.Rafael Espindola2017-01-271-5/+4
| | | | | | | | | | | | | | [ELF] Fixed formatting. NFC and [ELF] Bypass section type check Differential revision: https://reviews.llvm.org/D28761 They do the opposite of what was asked for in the code review. llvm-svn: 293320
* [ELF] Fixed formatting. NFCEugene Leviant2017-01-271-4/+4
| | | | llvm-svn: 293278
* [ELF] Bypass section type checkEugene Leviant2017-01-271-8/+9
| | | | | | Differential revision: https://reviews.llvm.org/D28761 llvm-svn: 293276
* Implement -Map.Rafael Espindola2017-01-131-0/+14
| | | | | | | The format is not exactly the same as the one in bfd since bfd always follows a linker script and prints it along. llvm-svn: 291958
* Allow mixing nobits and progbits.Rafael Espindola2017-01-121-1/+6
| | | | | | | | | The effect is that the nobits section gets space allocated on disk. Both bfd and gold allow this with linker scripts. To try to keep things simple in lld, always allow it for now. llvm-svn: 291795
* Move code to the .cpp file. NFC.Rafael Espindola2017-01-051-0/+14
| | | | llvm-svn: 291113
* Detemplate SectionKey. NFC.Rafael Espindola2017-01-051-24/+11
| | | | llvm-svn: 291110
* Change which input sections we concatenateRafael Espindola2017-01-051-14/+69
| | | | | | | | | | | | | | | | | | | | | 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
* Remove lld/Support/Memory.h.Rui Ueyama2016-12-181-1/+1
| | | | | | | | | | | | I thought for a while about how to remove it, but it looks like we can just copy the file for now. Of course I'm not happy about that, but it's just less than 50 lines of code, and we already have duplicate code in Error.h and some other places. I want to solve them all at once later. Differential Revision: https://reviews.llvm.org/D27819 llvm-svn: 290062
* Move Memory.{h,cpp} to lld/Support so that we can use them from COFF.Rui Ueyama2016-12-081-1/+1
| | | | llvm-svn: 289084
* Factor out common code to a header.Rui Ueyama2016-12-031-5/+2
| | | | llvm-svn: 288599
* [ELF] Refactor target error messagesEugene Leviant2016-11-291-0/+1
| | | | | | Differential revision: https://reviews.llvm.org/D27097 llvm-svn: 288114
* Split MergeOutputSection::finalize.Rui Ueyama2016-11-261-26/+33
| | | | llvm-svn: 287977
* [ELF] EhOutputSection improvementsEugene Leviant2016-11-251-7/+7
| | | | | | Differential revision: https://reviews.llvm.org/D27098 llvm-svn: 287914
* [ELF] Add terminating sentinel .ARM.exidx table entryPeter Smith2016-11-241-0/+4
| | | | | | | | | | | | | | | | | | | | | The .ARM.exidx table has an entry for each function with the first entry giving the start address of the function, the table is sorted in ascending order of function address. Given a PC value, the unwinder will search the table for the entry that contains the PC value. If the table entry happens to be the last, the range of the addresses that the final unwinding table describes will extend to the end of the address space. To prevent an incorrect address outside the address range of the program matching the last entry we follow ld.bfd's example and add a sentinel EXIDX_CANTUNWIND entry at the end of the table. This gives the final real table entry an upper bound. In addition the llvm libunwind unwinder currently depends on the presence of a sentinel entry (PR31091). Differential revision: https://reviews.llvm.org/D26977 llvm-svn: 287869
* [ELF] Print error location in .eh_frame parserEugene Leviant2016-11-231-1/+1
| | | | | | Differential revision: https://reviews.llvm.org/D26914 llvm-svn: 287750
* Move a function definition to SyntheticSections.cpp.Rui Ueyama2016-11-211-5/+0
| | | | | | This should have been moved along with r287554. llvm-svn: 287564
* [ELF] Convert Version*** sections to input sectionsEugene Leviant2016-11-211-179/+0
| | | | | | Differential revision: https://reviews.llvm.org/D26918 llvm-svn: 287554
* [ELF] Convert EhFrameHeader to input sectionEugene Leviant2016-11-211-47/+2
| | | | | | Differential revision: https://reviews.llvm.org/D26906 llvm-svn: 287549
* [ELF] Convert GdbIndexSection to input sectionEugene Leviant2016-11-211-50/+0
| | | | | | Differential revision: https://reviews.llvm.org/D26854 llvm-svn: 287526
* Remove unused #include.Rui Ueyama2016-11-191-1/+0
| | | | llvm-svn: 287467
* Change filler type from ArrayRef<uint8_t> to uint32_t.Rui Ueyama2016-11-191-6/+11
| | | | | | | Filler expressions in linker script "=fillexp" are always handled as 32-bit integers. Thus the new type is more natural. llvm-svn: 287445
* Simplify. NFC.Rui Ueyama2016-11-181-9/+5
| | | | llvm-svn: 287372
* Simplify handling of SHF_LINK_ORDER.Rafael Espindola2016-11-181-0/+16
| | | | | | | It seems a lot simpler to just sort the sections and let the relocations do the rest. llvm-svn: 287365
* [ELF] Convert PltSection to input sectionEugene Leviant2016-11-181-37/+0
| | | | | | Differential revision: https://reviews.llvm.org/D26842 llvm-svn: 287346
* [ELF] Convert HashTableSection to input sectionEugene Leviant2016-11-181-44/+0
| | | | | | Differential revision: https://reviews.llvm.org/D26834 llvm-svn: 287326
* [ELF] Convert GnuHashTableSection to input sectionEugene Leviant2016-11-181-152/+0
| | | | | | Differential revision: https://reviews.llvm.org/D26792 llvm-svn: 287322
* Simplify MergeOutputSection.Rui Ueyama2016-11-181-24/+31
| | | | | | | | | | | | | | | | | 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] Rename an historical leftover, `Chunk` is now `InputSection`.Davide Italiano2016-11-181-1/+1
| | | | llvm-svn: 287297
* [ELF] Use std::for_each() and hoist common code in a lambda.Davide Italiano2016-11-181-7/+5
| | | | llvm-svn: 287296
* Always compute sh_link for SHF_LINK_ORDER sections.Rafael Espindola2016-11-171-13/+7
| | | | | | | | Since the output has a section table too, it is meaningful to compute the sh_link. In a more practical note, the binutils' strip crashes if sh_link is not set for SHT_ARM_EXIDX. llvm-svn: 287280
* [ELF] Convert SymbolTableSection to input sectionEugene Leviant2016-11-171-198/+11
| | | | | | Differential revision: https://reviews.llvm.org/D26740 llvm-svn: 287216
* [ELF] Convert RelocationSection to input sectionEugene Leviant2016-11-161-102/+15
| | | | | | Differential revision: https://reviews.llvm.org/D26669 llvm-svn: 287092
* [ELF] Convert DynamicSection to input section.Eugene Leviant2016-11-151-184/+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] - format. NFC.George Rimar2016-11-141-2/+1
| | | | llvm-svn: 286805
OpenPOWER on IntegriCloud