summaryrefslogtreecommitdiffstats
path: root/lld/ELF/Writer.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [ELF] - Step to combine LinkerScript and LinkerScriptBaseGeorge Rimar2017-03-141-16/+2
| | | | | | | | | | | | | We can move all not templated functionality to LinkerScriptBase. Patch do that for hasPhdrsCommands() and shows how it helps to detemplate things in other places. Probably we should be able to merge these 2 classes into single one after such steps. Even if not, it still looks as reasonable cleanup for me. Differential revision: https://reviews.llvm.org/D30895 llvm-svn: 297714
* [ELF] Fix crash when .eh_frame(_hdr) is discardedEugene Leviant2017-03-141-1/+2
| | | | | | | | | lld crashes when .eh_frame or .eh_frame_hdr section is discarded in linker script and there is no PHDRS directive. Differential revision: https://reviews.llvm.org/D30885 llvm-svn: 297712
* ELF: Resolve _end symbols correctly.Peter Collingbourne2017-03-131-4/+9
| | | | | | | | | Fix a bug introduced in r297313 which caused them to resolve to the end of the ELF header in PIEs and DSOs. Differential Revision: https://reviews.llvm.org/D30843 llvm-svn: 297638
* [ELF] - Remove unnecessary template. NFC.George Rimar2017-03-131-2/+2
| | | | llvm-svn: 297622
* [ELF] Propely handle .eh_frame in linker scriptsPetr Hosek2017-03-101-0/+25
| | | | | | | | | | | Using .eh_frame input section pattern in linker script currently causes a crash; this is because .eh_frame input sections require special handling since they're all combined into a synthetic section rather than regular output section. Differential Revision: https://reviews.llvm.org/D30627 llvm-svn: 297501
* [ELF] - Do not try to create .eh_frame_hdr for relocatable output.George Rimar2017-03-091-5/+4
| | | | | | | | | | | | | .eh_frame_hdr is a header constructed for .eh_frame sections. We do not proccess .eh_frame when doing relocatable output, so should not try to create .eh_frame_hdr too. Previous behavior without this patch is segfault. Fixes PR32118. Differential revision: https://reviews.llvm.org/D30566 llvm-svn: 297365
* Remove DefinedSynthetic.Rafael Espindola2017-03-081-39/+37
| | | | | | | | | | | | | With this we have a single section hierarchy. It is a bit less code, but the main advantage will be in a future patch being able to handle foo = symbol_in_obj; in a linker script. Currently that fails since we try to find the output section of symbol_in_obj. With this we should be able to just return an InputSection from the expression. llvm-svn: 297313
* Use uint32_t for alignment in more places, NFC.Rafael Espindola2017-03-081-2/+2
| | | | llvm-svn: 297305
* Revert r297008: [ELF] - Make Bss and BssRelRo sections to be synthetic (#2).Rui Ueyama2017-03-081-17/+25
| | | | | | | This reverts commit r297008 because it's reported that that change broke AArch64 bots. llvm-svn: 297297
* Convert a few more uses of uintX_t to uint64_t.Rafael Espindola2017-03-081-4/+4
| | | | llvm-svn: 297286
* Convert a few uses of uintX_t to uint64_t.Rafael Espindola2017-03-081-1/+1
| | | | llvm-svn: 297282
* Finalize content of synthetic sections prior to Thunk CreationPeter Smith2017-03-081-18/+33
| | | | | | | | | | | | This change moves the calls to finalizeContent() for each synthetic section before createThunks(). This will allow us to assign addresses prior to calling createThunks(). As addition of thunks may add to the static symbol table and may affect the size of the mips got section we introduce a couple of additional member functions to update these values. Differential revision: https://reviews.llvm.org/D29983 llvm-svn: 297277
* Rename Addralign to Alignment.Rafael Espindola2017-03-071-3/+3
| | | | | | It now matches the name used in InputSectionBase. llvm-svn: 297144
* Remove Config->Rela and define Config->isRela() instead.Rui Ueyama2017-03-071-4/+4
| | | | llvm-svn: 297108
* Detemplate EhInputSection. NFC.Rafael Espindola2017-03-061-1/+1
| | | | llvm-svn: 297077
* Detemplate merge (input and synthetic) sections. NFC.Rafael Espindola2017-03-061-6/+6
| | | | llvm-svn: 297061
* [ELF] - Make Bss and BssRelRo sections to be synthetic (#2).George Rimar2017-03-061-25/+17
| | | | | | | | | | | | | | | In compare with D30458, this makes Bss/BssRelRo to be pure synthetic sections. That removes CopyRelSection class completely, making Bss/BssRelRo to be just regular synthetics. SharedSymbols involved in creating copy relocations are converted to DefinedRegular, what also simplifies things. Differential revision: https://reviews.llvm.org/D30541 llvm-svn: 297008
* [ELF] - Reset output section size when assigning offsets.George Rimar2017-03-011-1/+0
| | | | | | | | | | | | | | | | | In many places we reset Size to 0 before calling assignOffsets() manually. Sometimes we don't do that. It looks we can just always do that inside. Previous code had: template <class ELFT> void OutputSection::assignOffsets() { uint64_t Off = Size; And tests feels fine with Off = 0. I think Off = Size make no sence. Differential revision: https://reviews.llvm.org/D30463 llvm-svn: 296609
* Minor refactoring. NFC.Rui Ueyama2017-02-281-4/+5
| | | | llvm-svn: 296511
* Use make<> instead of new (BAlloc). NFC.Rui Ueyama2017-02-281-4/+4
| | | | | | We converted them before, but there were a few remaining occurrences. llvm-svn: 296510
* De-template DefinedRegular.Rui Ueyama2017-02-281-23/+20
| | | | | | Differential Revision: https://reviews.llvm.org/D30348 llvm-svn: 296508
* [ELF] - Remove ElfSym::EhdrStart member. NFC.George Rimar2017-02-281-2/+1
| | | | | | We do not use it later, so don't have to store. llvm-svn: 296466
* Merge SymbolTableSection::add{Global,Local} into one function.Rui Ueyama2017-02-281-4/+4
| | | | | | | | Previously, these two functions put their symbols in different queues. Now that the queues have been merged. So there's no point to keep two separate functions. llvm-svn: 296435
* Rename SyntheticSection::finalize -> finalizeContents.Rui Ueyama2017-02-271-1/+1
| | | | | | | In LLD source code, too many functions are called "finalize", although what they do are different. This patch gives it a better name. llvm-svn: 296314
* De-template SyntheticSection.Rui Ueyama2017-02-271-5/+4
| | | | | | This class didn't use ELFT. llvm-svn: 296313
* De-template InterpSection because it doesn't use ELFT.Rui Ueyama2017-02-271-1/+1
| | | | llvm-svn: 296311
* Move SymbolTable<ELFT>::Sections out of the class.Rui Ueyama2017-02-271-8/+6
| | | | | | | | | | The list of all input sections was defined in SymbolTable class for a historical reason. The list itself is not a template. However, because SymbolTable class is a template, we needed to pass around ELFT to access the list. This patch moves the list out of the class so that it doesn't need ELFT. llvm-svn: 296309
* De-template OutputSectionFactory.Rui Ueyama2017-02-271-2/+2
| | | | | | | Since OutputSection is no longer a template, it doesn't make much sense to tempalte its factory class. llvm-svn: 296308
* Remove useless template so that Out<ELFT> becomes just Out.Rui Ueyama2017-02-271-38/+36
| | | | llvm-svn: 296307
* De-template SharedSymbol.Rui Ueyama2017-02-261-2/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D30351 llvm-svn: 296303
* Rename OMagic -> Omagic for consistency.Rui Ueyama2017-02-251-1/+1
| | | | llvm-svn: 296225
* Merge OutputSectionBase and OutputSection. NFC.Rafael Espindola2017-02-241-93/+87
| | | | | | | Now that all special sections are SyntheticSections, we only need one OutputSection class. llvm-svn: 296127
* Delete trivial getter.Rafael Espindola2017-02-241-17/+16
| | | | llvm-svn: 296123
* [ELF] Make __ehdr_start point to ELF file headersPetr Hosek2017-02-241-3/+3
| | | | | | | | | | | __ehdr_start should be pointing to ELF file headers, not program headers. This is a reland of D30319. Differential Revision: https://reviews.llvm.org/D30323 llvm-svn: 296085
* Revert "[ELF] Make __ehdr_start point to ELF file headers"Petr Hosek2017-02-241-2/+2
| | | | | | This reverts commit r296079. llvm-svn: 296083
* [ELF] Make __ehdr_start point to ELF file headersPetr Hosek2017-02-241-2/+2
| | | | | | | | | __ehdr_start should be pointing to ELF file headers, not program headers. Differential Revision: https://reviews.llvm.org/D30319 llvm-svn: 296079
* Convert EhOutputSection to be a synthetic section.Rafael Espindola2017-02-231-7/+11
| | | | | | | | With this we complete the transition out of special output sections, and with the previous patches it should be possible to merge OutputSectionBase and OuputSection. llvm-svn: 296023
* Make InputSection a class. NFC.Rafael Espindola2017-02-231-4/+4
| | | | | | | | | With the current design an InputSection is basically anything that goes directly in a OutputSection. That includes plain input section but also synthetic sections, so this should probably not be a template. llvm-svn: 295993
* Always add PT_GNU_STACK.Rui Ueyama2017-02-231-3/+9
| | | | | | | If -z stack-size is given, we need to add PT_GNU_STACK even if -z execstack is not given. llvm-svn: 295945
* Merge InputSectionData and InputSectionBase.Rafael Espindola2017-02-231-4/+4
| | | | | | | Now that InputSectionBase is not a template there is no reason to have the two. llvm-svn: 295924
* Convert InputSectionBase to a class.Rafael Espindola2017-02-231-17/+16
| | | | | | | Removing this template is not a big win by itself, but opens the way for removing more templates. llvm-svn: 295923
* Reduce templating a bit. NFC.Rafael Espindola2017-02-231-2/+2
| | | | llvm-svn: 295909
* [ELF] Allow local symbols to be added after global symbolsPeter Smith2017-02-201-7/+7
| | | | | | | | | | | | This change moves the SymbolBodies with isLocal() == true before the global symbols then calculating NumLocals rather than assuming all locals are added before globals and the first NumLocals have isLocal() == true. This permits Thunks to be moved after the pass that adds global symbols from synthetics to the symbol table. Differential revision: https://reviews.llvm.org/D30085 llvm-svn: 295650
* Don't print DISCARD sections as gced.Rafael Espindola2017-02-171-14/+0
| | | | | | | | 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
* Add static. NFC.Rafael Espindola2017-02-171-1/+1
| | | | llvm-svn: 295448
* Add a comment.Rui Ueyama2017-02-171-0/+3
| | | | llvm-svn: 295388
* Merge reloc sections in -emit-reloc mode.Rafael Espindola2017-02-171-0/+9
| | | | | | | | | | | | | Without this we would produce two relocation sections pointing to the same section, which gnu tools reject. This fixes pr31986. The implementation of -r/--emit-reloc is getting fairly complicated. But lets get the test passing before trying to refactor it. llvm-svn: 295385
* Share more output section creation code.Rafael Espindola2017-02-161-21/+3
| | | | | | | We can do this now that the linker script and the writer agree on which sections should be combined. llvm-svn: 295341
* Add comments.Rui Ueyama2017-02-161-0/+10
| | | | llvm-svn: 295283
* Add comments.Rui Ueyama2017-02-161-0/+3
| | | | llvm-svn: 295280
OpenPOWER on IntegriCloud