summaryrefslogtreecommitdiffstats
path: root/lld/ELF/InputFiles.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Update for llvm change.Rafael Espindola2016-10-171-7/+7
| | | | llvm-svn: 284409
* [ELF] - Don't crash on multiple SHT_MIPS_REGINFO/SHT_MIPS_ABIFLAGS sections.George Rimar2016-10-171-0/+6
| | | | | | | | | | In continue of D25555, this patch fixes possible crash when we have multiple SHT_MIPS_REGINFO or SHT_MIPS_ABIFLAGS sections. yaml2obj was used to produce such objects. Differential revision: https://reviews.llvm.org/D25609 llvm-svn: 284376
* [ELF] - Do not crash when object has multiple SHT_MIPS_OPTIONSGeorge Rimar2016-10-141-0/+3
| | | | | | | | | | | | Issue was revealed by AFl and I was able to generate such object using yaml2obj. When object has more than one SHT_MIPS_OPTIONS, each except the last one is destroyed after placing into Sections array. Sections array contains dead pointers finally. LLD may crash then. Differential revision: https://reviews.llvm.org/D25555 llvm-svn: 284227
* [ThinLTO] Avoid archive member collisions.Davide Italiano2016-10-121-6/+21
| | | | | | | | This fixes PR30665. Differential Revision: https://reviews.llvm.org/D25495 llvm-svn: 284034
* Recommit r283733 "[ELF] - Do not crash if common symbol alignment set to ↵George Rimar2016-10-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | value greater than UINT32_MAX. With fix: commit changes from InputFiles.cpp too. Original commit message: We have following code in lld, that truncates the alignment value to 32 bit. Big alignment in this case may give result 0 and crash later. template <class ELFT> CommonInputSection<ELFT>::CommonInputSection(std::vector<DefinedCommon *> Syms) : InputSection<ELFT>(nullptr, &Hdr, "") { .... for (DefinedCommon *Sym : Syms) { this->Alignment = std::max<uintX_t>(this->Alignment, Sym->Alignment); ... } } Patch fixes the issue. Differential revision: https://reviews.llvm.org/D25235 llvm-svn: 283738
* [ELF][ARM] Fix formatting mistake, removed extra space before ) NFC.Peter Smith2016-10-101-1/+1
| | | | llvm-svn: 283735
* [ELF][ARM] Garbage collection support for .ARM.exidx sectionsPeter Smith2016-10-101-0/+20
| | | | | | | | | | | | | | | .ARM.exidx sections have a reverse dependency on the section they have a SHF_LINK_ORDER dependency on. In other words a .ARM.exidx section is live only if the executable section it describes is live. We implement this with a reverse dependency field in InputSection. Adding the dependency to InputSection is the simplest implementation but it could be moved out to a separate map if it were found to decrease performance for non ARM targets. Differential revision: https://reviews.llvm.org/D25234 llvm-svn: 283734
* [ELF] - Fixed assert fail when symbol table has zero sh_info value.George Rimar2016-10-071-1/+1
| | | | | | | | | | When sh_info of sumbol table value was set to zero, lld was asserting. Patch fixes the issue. Differential revision: https://reviews.llvm.org/D25016 llvm-svn: 283562
* [ELF] - Do not crash on invalid size of dynamic section.George Rimar2016-10-071-4/+4
| | | | | | | | | | | | Previously if sh_size of dynamic section was broken, lld may crash. Or even may not crash if used 32 bits host. (then value may be truncated to 32 bits when doing pointer arithmetic and could be just zero). Patch fixes the issue. Differential revision: https://reviews.llvm.org/D25327 llvm-svn: 283533
* [ELF] - Do not crash when unable to parse ELF object file.George Rimar2016-10-071-1/+1
| | | | | | | | | | | | | createELFObj() may call error(...), for example when file is too short. In that case header is not set and following line lead to crash: EMachine = ELFObj.getHeader()->e_machine; Patch fixes the issue. Differential revision: https://reviews.llvm.org/D25233 llvm-svn: 283532
* [ELF] - Make checks in ObjectFile<ELFT>::getSection() stricter.George Rimar2016-10-061-3/+8
| | | | | | | | | This patch makes the check for null section stricter, so it is only allowed for STT_SECTION symbols now. Differential revision: https://reviews.llvm.org/D25231 llvm-svn: 283426
* [ELF] Do not merge sections in case of relocatable object generationSimon Atanasyan2016-10-051-0/+9
| | | | | | | | | | | | | Do not merge sections if generating a relocatable object. It makes the code simpler because we do not need to update relocations addends to reflect changes introduced by merging. Instead of that we write such "merge" sections into separate OutputSections and keep SHF_MERGE / SHF_STRINGS flags and sh_entsize value to be able to perform merging later during a final linking. Differential Revision: http://reviews.llvm.org/D25066 llvm-svn: 283300
* Add a comment.Rui Ueyama2016-10-041-1/+4
| | | | llvm-svn: 283229
* [ELF] Don't discard excluded section if -r is usedEugene Leviant2016-10-041-1/+1
| | | | | | | This conforms to GNU ld/gold behavior and fixes crash in case excluded section also has associated relocation section llvm-svn: 283214
* [ELF] - Do not crash if common symbol has alignment 0.George Rimar2016-10-041-0/+3
| | | | | | | | | Testcase contains a common symbol with zero alignment, previously lld would crash, patch fixes that. Differential revision: https://reviews.llvm.org/D25085 llvm-svn: 283197
* [ELF] - Apply clang-format. NFC.George Rimar2016-10-031-13/+12
| | | | llvm-svn: 283101
* Remove an warning message that can be spammy.Rui Ueyama2016-09-301-7/+0
| | | | | | | | | | | | | | | | | | This was intended to warn on a usage error of an ar command. I was thinking that false positive would be rare because it has two guards: it warns only when an archive file has no symbols and contains at least one file. Turned out that false positive would probably be not that rare. You wouldn't intentionally create an object file that contains no exported symbols, but with conditional compile guards, you could create such file. If it is for a LTO build, you could create an archive file containing such file. That means there's no way to detect the usage error in a reliable manner. This patch simply removes the warning. llvm-svn: 282916
* Improve error check for an empty archive.Rui Ueyama2016-09-301-10/+8
| | | | | | | | | | | Previously, it warned on any archive file that has no symbol. It turned out that that is too noisy. With this patch, it warns on such archive file that contains no file. Differential Revision: https://reviews.llvm.org/D25111 llvm-svn: 282885
* Add comments.Rui Ueyama2016-09-291-7/+10
| | | | llvm-svn: 282807
* Rename warning -> warn.Rui Ueyama2016-09-291-4/+4
| | | | | | It's better because it's a verb. llvm-svn: 282763
* Use InputFile::Symbol instead of auto for consistency.Rui Ueyama2016-09-291-6/+4
| | | | llvm-svn: 282658
* [ELF/LTO] Switch to the new resolution-based API.Davide Italiano2016-09-291-80/+35
| | | | | | Differential Revision: https://reviews.llvm.org/D24492 llvm-svn: 282656
* Warn on empty archive files.Rui Ueyama2016-09-281-1/+10
| | | | | | Differential Revision: https://reviews.llvm.org/D25044 llvm-svn: 282633
OpenPOWER on IntegriCloud