summaryrefslogtreecommitdiffstats
path: root/lld/ELF/InputFiles.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Bitcode: Clean up error handling for certain bitcode query functions.Peter Collingbourne2016-11-111-2/+2
| | | | | | | | | | | | | The functions getBitcodeTargetTriple(), isBitcodeContainingObjCCategory(), getBitcodeProducerString() and hasGlobalValueSummary() now return errors via their return value rather than via the diagnostic handler. To make this work, re-implement these functions using non-member functions so that they can be used without the LLVMContext required by BitcodeReader. Differential Revision: https://reviews.llvm.org/D26532 llvm-svn: 286623
* Mirror the llvm changes that split Bitcode/ReaderWriter.hTeresa Johnson2016-11-111-1/+1
| | | | | | | | | | | The change in D26502 splits ReaderWriter.h, which contains the APIs into both the BitReader and BitWriter libraries, into BitcodeReader.h and BitcodeWriter.h. Change lld uses to the appropriate split header, removing it completely in one case where it wasn't needed. llvm-svn: 286568
* Parse relocations only once.Rafael Espindola2016-11-101-12/+21
| | | | | | | | | | | | | | | | Relocations are the last thing that we wore storing a raw section pointer to and parsing on demand. With this patch we parse it only once and store a pointer to the actual data. The patch also changes where we store it. It is now in InputSectionBase. Not all sections have relocations, but most do and this simplifies the logic. It also means that we now only support one relocation section per section. Given that that constraint is maintained even with -r with gold bfd and lld, I think it is OK. llvm-svn: 286459
* Remove an overloaded function to simplify.Rui Ueyama2016-11-091-6/+6
| | | | | | | This version of addRegular is almost identical to the other except it lacked "size" parameter. llvm-svn: 286416
* [ELF][MIPS] Convert .MIPS.abiflags section to synthetic input sectionSimon Atanasyan2016-11-091-6/+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-20/+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
* Make Discarded a InputSection.Rafael Espindola2016-11-091-1/+1
| | | | | | | It was quite confusing that it had SectionKind of Regular, but was not actually a InputSection. llvm-svn: 286379
* Remove dead arguments. NFC.Rafael Espindola2016-11-081-7/+5
| | | | llvm-svn: 286242
* [LTO] Don't leak BitcodeFiles. Found by the asan bot.Davide Italiano2016-11-081-1/+1
| | | | llvm-svn: 286194
* [ELF] Don't leak the ".data" section. Fixes an asan failure.Davide Italiano2016-11-081-1/+1
| | | | llvm-svn: 286193
* Simplify now that this is only used for global symbols.Rafael Espindola2016-11-031-4/+2
| | | | llvm-svn: 285966
* Now that the ELFFile constructor does nothing, create it when needed.Rafael Espindola2016-11-031-16/+17
| | | | | | This avoids duplicating the buffer in InputFile. llvm-svn: 285965
* Update for llvm change.Rafael Espindola2016-11-031-10/+7
| | | | llvm-svn: 285962
* Simplify by directly using this->Symbols. NFC.Rui Ueyama2016-11-031-4/+2
| | | | llvm-svn: 285952
* Change how we store the symbol table.Rafael Espindola2016-11-031-26/+18
| | | | | | | | | Instead of remembering a raw Elf_Shdr, store the symbol table proper and the index of the first non local. This moves error handling upfront and simplifies it. llvm-svn: 285933
* Initialize the StringTable early and do it only once.Rafael Espindola2016-11-031-13/+10
| | | | llvm-svn: 285926
* Use the getSectionIndex from llvm.Rafael Espindola2016-11-031-6/+1
| | | | llvm-svn: 285918
* Use existing ELFObj function. NFC.Rafael Espindola2016-11-031-4/+1
| | | | llvm-svn: 285913
* Update for llvm change.Rafael Espindola2016-11-031-1/+1
| | | | llvm-svn: 285911
* Update for llvm change.Rafael Espindola2016-11-031-2/+2
| | | | llvm-svn: 285906
* Pass the section table around instead of recomputing it.Rafael Espindola2016-11-031-12/+16
| | | | llvm-svn: 285904
* We already have the sections, pass them to getSHNDXTable.Rafael Espindola2016-11-031-3/+4
| | | | llvm-svn: 285897
* [ELF] - Update after LLVM change (r285886)George Rimar2016-11-031-1/+1
| | | | llvm-svn: 285888
* Pass the sections to getShtGroupSignature.Rafael Espindola2016-11-031-3/+8
| | | | | | This avoids fetching it again from the object. llvm-svn: 285875
* Fix Windows buildbot.Rui Ueyama2016-11-021-3/+3
| | | | llvm-svn: 285854
* Reduce number of classes by merging DIHelper with ObjectFile.Rui Ueyama2016-11-021-35/+21
| | | | | | | | | | DIHelper is a class having only one member, and ObjectFile has a unique pointer to a DIHelper. So we can directly have ObjectFile have the member. Differential Revision: https://reviews.llvm.org/D26223 llvm-svn: 285850
* Pass the section table to getSectionStringTable. NFC.Rafael Espindola2016-11-021-1/+1
| | | | | | This will let us simplify the llvm side. llvm-svn: 285816
* Don't use getNumSections.Rafael Espindola2016-11-021-3/+4
| | | | | | It is just the size of sections() which we were already calling. llvm-svn: 285811
* Update for llvm change.Rafael Espindola2016-11-021-3/+3
| | | | llvm-svn: 285808
* Simplify SHF_LINK_ORDER handling. NFC.Rafael Espindola2016-11-021-19/+9
| | | | | | | | | While ARM is the only currently user we support this is a general feature. This avoids a second walk over the sections. llvm-svn: 285805
* [ELF] - Check that .dynsym is present in DSO if SHT_GNU_versym section is.George Rimar2016-11-021-0/+3
| | | | | | | | | | | | | | | When we have SHT_GNU_versym section, it is should be associated with symbol table section. Usually (and in out implementation) it is .dynsym. In case when .dynsym is absent (due to broken object for example), lld crashes in parseVerdefs() when accesses null pointer: Versym = reinterpret_cast<const Elf_Versym *>(this->ELFObj.base() + VersymSec->sh_offset) + this->Symtab->sh_info; DIfferential revision: https://reviews.llvm.org/D25553 llvm-svn: 285796
* Provide a convenient function to allocate and initialize objects.Rui Ueyama2016-11-011-11/+8
| | | | | | You can now write make<T>(Args) instead of new (alloc<T>()) T(Args). llvm-svn: 285760
* Don't fetch the section string table multiple times. NFC.Rafael Espindola2016-11-011-3/+5
| | | | llvm-svn: 285755
* Replace GAlloc with a template function.Rafael Espindola2016-11-011-19/+8
| | | | | | | | | This patch replaces GAlloc<ELFT>::<sometype>.Allocate() with alloc<sometype<ELFT>>(). Patch by Rui! llvm-svn: 285748
* Allow fetching source line, when multiple "AX" sections presentEugene Leviant2016-11-011-4/+30
| | | | | | Differential revision: https://reviews.llvm.org/D26070 llvm-svn: 285680
* Consolidate BumpPtrAllocators.Rui Ueyama2016-10-281-19/+18
| | | | | | | | | | | Previously, we have a lot of BumpPtrAllocators, but all these allocators virtually have the same lifetime because they are not freed until the linker finishes its job. This patch aggregates them into a single allocator. Differential revision: https://reviews.llvm.org/D26042 llvm-svn: 285452
* Define ~DIHelper::DIHelper() in .cpp.Rui Ueyama2016-10-271-0/+2
| | | | llvm-svn: 285347
* Don't create a dummy ELF to process a binary file.Rafael Espindola2016-10-271-13/+26
| | | | | | | Now that it is easy to create input section and symbols, this is simple. llvm-svn: 285322
* Store OSABI in Config.Rafael Espindola2016-10-271-0/+1
| | | | | | This allows us to set a value for it based on -m. llvm-svn: 285294
* Use fewer allocators.Rafael Espindola2016-10-271-4/+8
| | | | | | | | | | | | | | Instead of having 3 section allocators per file, have 3 for all files. This is a substantial performance improvement for some cases. Linking chromium without gc speeds up by 1.065x. This requires using _exit in fatal since we have to avoid destructing an InputSection if fatal is called from the constructor. Thanks to Rui for the suggestion. llvm-svn: 285290
* Reduce the number of allocators.Rafael Espindola2016-10-261-14/+15
| | | | | | | | | | We used to have one allocator per file, which reduces the advantage of using an allocator in the first place. This is a small speed up is most cases. The largest speedup was in 1.014X in chromium no-gc. The largest slowdown was scylla at 1.003X. llvm-svn: 285205
* [ELF] Better error reporting for undefined symbolsEugene Leviant2016-10-261-0/+48
| | | | | | | | | | | This patch make lld show following details for undefined symbol errors: - file (line) - file (function name) - file (section name + offset) Differential revision: https://reviews.llvm.org/D25826 llvm-svn: 285186
* Update for llvm change.Rafael Espindola2016-10-251-21/+14
| | | | llvm-svn: 285062
* Use a CachedHashString for comdats too.Rafael Espindola2016-10-211-14/+17
| | | | | | | We were already using it in the larger sets/maps. This provides about 1% speedup in linking xul and chromium. llvm-svn: 284862
* Move code from InputFile to ELFCreator to decouple the two files.Rui Ueyama2016-10-201-37/+5
| | | | | | | Now that only one non-member function is exported from ELFCreator.h. All the details are handled internally in ELFCreator.cpp file. llvm-svn: 284786
* [ELF] - Applied clang format. NFC.George Rimar2016-10-201-1/+1
| | | | llvm-svn: 284705
* Add a helper function to define symbols.Rui Ueyama2016-10-201-18/+14
| | | | | | | Also replace std::copy with memcpy because in other places we are using memcpy. llvm-svn: 284700
* Rename variables so that they are more in line with rest of the code.Rui Ueyama2016-10-201-7/+7
| | | | llvm-svn: 284699
* Remove std:: from std::size_t.Rui Ueyama2016-10-201-1/+1
| | | | llvm-svn: 284687
* Avoid using getComdatSymbolTable.Rafael Espindola2016-10-171-12/+17
| | | | | | | | | | This is not particularly efficient, but does avoid exposing Comdat* out of LTO.h. I will send a patch for review with a more efficient interface that should map nicely to a bitcode symbol table. llvm-svn: 284413
OpenPOWER on IntegriCloud