summaryrefslogtreecommitdiffstats
path: root/lld/ELF/InputSection.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Remove unnecessary template. NFC.Rafael Espindola2017-03-081-7/+2
| | | | llvm-svn: 297287
* Convert a few more uses of uintX_t to uint64_t.Rafael Espindola2017-03-081-2/+1
| | | | llvm-svn: 297286
* Remove redundant member of InputSectionBase. NFC.Rafael Espindola2017-03-081-1/+6
| | | | | | With this InputSectionBase is now 144 bytes. llvm-svn: 297278
* Rename remaining uses of Addralign to Alignment.Rafael Espindola2017-03-071-5/+5
| | | | llvm-svn: 297146
* Remove Config->Rela and define Config->isRela() instead.Rui Ueyama2017-03-071-2/+2
| | | | llvm-svn: 297108
* Remove Config->Mips64EL and define Config->isMips64EL() instead.Rui Ueyama2017-03-071-3/+3
| | | | llvm-svn: 297107
* Make Discarded a InputSectionBase.Rafael Espindola2017-03-061-3/+1
| | | | | | NFC, just a bit simpler. llvm-svn: 297087
* Detemplate EhInputSection. NFC.Rafael Espindola2017-03-061-17/+29
| | | | llvm-svn: 297077
* Detemplate merge (input and synthetic) sections. NFC.Rafael Espindola2017-03-061-32/+32
| | | | llvm-svn: 297061
* De-template DefinedRegular.Rui Ueyama2017-02-281-7/+7
| | | | | | Differential Revision: https://reviews.llvm.org/D30348 llvm-svn: 296508
* De-template SyntheticSection.Rui Ueyama2017-02-271-2/+2
| | | | | | This class didn't use ELFT. llvm-svn: 296313
* Move SymbolTable<ELFT>::Sections out of the class.Rui Ueyama2017-02-271-0/+2
| | | | | | | | | | 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
* Remove useless template so that Out<ELFT> becomes just Out.Rui Ueyama2017-02-271-8/+8
| | | | llvm-svn: 296307
* Merge OutputSectionBase and OutputSection. NFC.Rafael Espindola2017-02-241-5/+5
| | | | | | | Now that all special sections are SyntheticSections, we only need one OutputSection class. llvm-svn: 296127
* Convert EhOutputSection to be a synthetic section.Rafael Espindola2017-02-231-1/+3
| | | | | | | | 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-34/+55
| | | | | | | | | 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
* [ELF] Ignore R_*_NONE relocs when relocating non-alloc sectionsPetr Hosek2017-02-231-1/+5
| | | | | | | | | We shouldn't report an error for R_*_NONE relocs since we're emitting them when writing relocations to discarded sections. Differential Revision: https://reviews.llvm.org/D30279 llvm-svn: 295936
* Add another missing instantiation.Rafael Espindola2017-02-231-0/+5
| | | | llvm-svn: 295932
* Add missing template instantiations.Rafael Espindola2017-02-231-0/+10
| | | | llvm-svn: 295929
* Trying to fix the windows build.Rafael Espindola2017-02-231-2/+2
| | | | llvm-svn: 295925
* Merge InputSectionData and InputSectionBase.Rafael Espindola2017-02-231-7/+7
| | | | | | | 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-65/+79
| | | | | | | Removing this template is not a big win by itself, but opens the way for removing more templates. llvm-svn: 295923
* Addends should always be signed.Rafael Espindola2017-02-161-6/+5
| | | | | | | | | | In the target dependent code we already always return a int64_t. In the target independent code we carefully use uintX_t, which has the same result given 2 complement rules. This just simplifies the code to use int64_t everywhere. llvm-svn: 295263
* Set the correct r_offset even when creating a R_*_NONE.Rafael Espindola2017-02-151-6/+7
| | | | | | With this lld can use its own -r output when a fde is discarded. llvm-svn: 295143
* Handle .eh_frame pointing to discarded section in -r.Rafael Espindola2017-02-151-2/+13
| | | | | | | | | | | This is a really horrible case. If a .eh_frame points to a discarded section, it is not clear what is the correct thing to do. It looks like ld.bfd discards the entire .eh_frame content and gold discards the second relocation, leaving one frame with an fde that refers to a bogus location. This is similar to what gold does. llvm-svn: 295133
* Revert "Relax the restriction on what relocations can be in a non-alloc ↵Rafael Espindola2017-02-151-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | section." This reverts commit r295102. In the link of seabios the assumption seems to be that the section has an actual address, so this is not sufficient. Changing the assembly code to add a "a" flag seems like the correct thing to do instead of extending this hack. Sorry about the noise. Original message: Relax the restriction on what relocations can be in a non-alloc section. The main thing that they can't have is relocations that require the creation of gots or plt. For now also accept R_PC. Found while linking seabios. llvm-svn: 295130
* Relax the restriction on what relocations can be in a non-alloc section.Rafael Espindola2017-02-141-2/+3
| | | | | | | | | The main thing that they can't have is relocations that require the creation of gots or plt. For now also accept R_PC. Found while linking seabios. llvm-svn: 295102
* Create only one section symbol per section.Rafael Espindola2017-02-111-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Unfortunately some consumers of our .o files produced with -r expect only one section symbol per section. That is true of at least of go's own linker. Combining them is a somewhat convoluted process. We have to create a symbol for every section since we don't know which ones will be needed. The relocation sections also have to be written first to handle the Elf_Rel addend. I did consider a completely different approach: We could remove the -r special case of relocation sections when reading. We would instead have a copyRelocs function that is used instead of scanRelocs. It would create a DynamicReloc for each relocation and a RelocationSection for each input relocation section. A complication of such change is that DynamicReloc would have to take a section index and a input section instead of a symbol since with -emit-relocs some DynamicReloc would hold relocations referring to the dynamic symbol table and other to the static symbol table. That would be a pretty big change, and if we do it it is probably better to do it as a refactoring. llvm-svn: 294816
* Recommit r294464 "[ELF] - Added partial support for --emit-relocs (no ↵George Rimar2017-02-081-5/+10
| | | | | | | | | | | | | | | | | | | | | | --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-10/+5
| | | | | | | | | --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-5/+10
| | | | | | | | | | | | | | | | | | /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
* Don't worry about dropping SHF_MERGE.Rafael Espindola2017-02-031-7/+0
| | | | | | | Now that it doesn't impact which sections are merged, this is not a problem. llvm-svn: 294054
* Replace MergeOutputSection with a synthetic section.Rafael Espindola2017-02-031-2/+13
| | | | | | | | | | | | | | 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] Use SyntheticSections for ThunksPeter Smith2017-02-011-37/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | Thunks are now implemented by redirecting the relocation to the symbol S, to a symbol TS in a Thunk. The Thunk will transfer control to S. This has the following implications: - All the side-effects of Thunks happen within createThunks() - Thunks are no longer stored in InputSections and Symbols no longer need to hold a pointer to a Thunk - The synthetic Thunk sections need to be merged into OutputSections This implementation is almost a direct conversion of the existing Thunks with the following exceptions: - Mips LA25 Thunks are placed before the InputSection that defines the symbol that needs a Thunk. - All ARM Thunks are placed at the end of the OutputSection of the first caller to the Thunk. Range extension Thunks are not supported yet so it is optimistically assumed that all Thunks can be reused. This is a recommit of r293283 with a fixed comparison predicate as std::merge requires a strict weak ordering. Differential revision: https://reviews.llvm.org/D29327 llvm-svn: 293757
* Revert "[ELF][ARM] Use SyntheticSections for Thunks"Rui Ueyama2017-01-281-0/+37
| | | | | | This reverts commit r293283 because it broke MSVC build. llvm-svn: 293352
* [ELF][ARM] Use SyntheticSections for ThunksPeter Smith2017-01-271-37/+0
| | | | | | | | | | | | | | | | | | | | | | | | Thunks are now implemented by redirecting the relocation to the symbol S, to a symbol TS in a Thunk. The Thunk will transfer control to S. This has the following implications: - All the side-effects of Thunks happen within createThunks() - Thunks are no longer stored in InputSections and Symbols no longer need to hold a pointer to a Thunk - The synthetic Thunk sections need to be merged into OutputSections This implementation is almost a direct conversion of the existing Thunks with the following exceptions: - Mips LA25 Thunks are placed before the InputSection that defines the symbol that needs a Thunk. - All ARM Thunks are placed at the end of the OutputSection of the first caller to the Thunk. Range extension Thunks are not supported yet so it is optimistically assumed that all Thunks can be reused. Differential Revision: https://reviews.llvm.org/D29129 llvm-svn: 293283
* [ELF] - Added additional comments on top of r292789 (D29021)George Rimar2017-01-241-0/+4
| | | | | | It was requested during post commit review. llvm-svn: 292903
* [ELF] - Stop handling local symbols in a special way.George Rimar2017-01-231-1/+2
| | | | | | | | | | | | | | | | | | | | Previously we stored kept locals in a KeptLocalSyms arrays, belonged to files. Patch makes SymbolTableSection to store locals in Symbols member, that already present and was used for globals. SymbolTableSection already had NumLocals counter member, so change itself is trivial. That allows to simplify handling of -r, Body::DynsymIndex is no more used as "symbol table index" for relocatable output. Change was suggested during review of D28773 and opens road for D28612. Differential revision: https://reviews.llvm.org/D29021 llvm-svn: 292789
* Do not use the same name for both a class and a variable.Rui Ueyama2017-01-121-3/+3
| | | | llvm-svn: 291835
* Improve an error message and remove fatal(Error &, const Twine &)Rui Ueyama2017-01-121-1/+2
| | | | llvm-svn: 291834
* Remove dead code.Rui Ueyama2017-01-121-6/+1
| | | | llvm-svn: 291812
* [ELF] - Do not crash if user section has name equal to one of synthetic ↵George Rimar2017-01-121-1/+4
| | | | | | | | | | | | | | sections. Previously we just crashed when had user defined section .shstrtab, for example. Which name equals to synthetic one, but have different type. Testcase reveals an issue. Differential revision: https://reviews.llvm.org/D28559 llvm-svn: 291765
* [ELF] - Reuse Decompressor class.George Rimar2017-01-121-55/+8
| | | | | | | | | | | Intention of change is to get rid of code duplication. Decompressor was introduced in D28105. Change allows to get rid of few methods relative to decompression. Differential revision: https://reviews.llvm.org/D28106 llvm-svn: 291758
* Merge elf::toString and coff::toString.Rui Ueyama2017-01-061-5/+5
| | | | | | The two overloaded functions hid each other. This patch merges them. llvm-svn: 291222
* Remove `Compressed` member from InputSectionData.Rui Ueyama2016-12-201-8/+5
| | | | | | | This value is used only once, and we can compute a value. So we don't need to save it. llvm-svn: 290164
* 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
* Rename InputSection.cpp:getSymVA to getRelocTargetVA.Sean Silva2016-12-141-12/+12
| | | | | | | This name was really confusing because there is also another static helper Symbols.cpp:getSymVA which has the same name. llvm-svn: 289733
* Move Memory.{h,cpp} to lld/Support so that we can use them from COFF.Rui Ueyama2016-12-081-2/+1
| | | | llvm-svn: 289084
* Inline MergeInputSection::getData().Rui Ueyama2016-12-061-10/+0
| | | | | | | | | This change seems to make LLD 0.6% faster when linking Clang with debug info. I don't want us to have lots of local optimizations, but this function is very hot, and the improvement is small but not negligible, so I think it's worth doing. llvm-svn: 288757
* ELF/AArch64: consolidate getAArch64Page implementationAdhemerval Zanella2016-12-051-7/+0
| | | | | | | This patch avoid getAArch64Page code duplication by removing the implementation at InputSection. llvm-svn: 288668
OpenPOWER on IntegriCloud