summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter
Commit message (Collapse)AuthorAgeFilesLines
...
* Remove dead code.Rui Ueyama2015-04-142-10/+0
| | | | llvm-svn: 234854
* ELF: Remove ELFT and LinkingContext template parameters from ELFReader.Rui Ueyama2015-04-1424-68/+162
| | | | | | | | | | | | | | | | | | | Previously, ELFReader takes three template arguments: EFLT, LinkingContextT and FileT. FileT is itself templated. So it was a bit complicated. Maybe too much. Most architectures don't actually need to be parameterized for ELFT. For example, x86 is always ELF32LE and x86-64 is ELF64LE. However, because ELFReader requires a ELFT argument, we needed to parameterize a class even if not needed. This patch removes the parameter from the class. So now we can de-templatize such classes (I didn't do that in this patch, though). This patch also removes ContextT parameter since it didn't have to be passed as a template argument. llvm-svn: 234853
* Define make_dynamic_error_code(const char *).Rui Ueyama2015-04-149-40/+37
| | | | | | | | | | | | The function took either StringRef or Twine. Since string literals are ambiguous when resolving the overloading, many code calls used this function with explicit type conversion. That led awkward code like make_dynamic_error_code(Twine("Error occurred")). This patch adds a function definition for string literals, so that you can directly call the function with literals. llvm-svn: 234841
* ELF: Remove almost empty class.Rui Ueyama2015-04-144-32/+4
| | | | llvm-svn: 234834
* Remove unused variable.Rui Ueyama2015-04-142-3/+1
| | | | llvm-svn: 234831
* ELF: Use less templates for ELF types.Rui Ueyama2015-04-149-83/+61
| | | | | | | These classes are templated but actually instantiated for only one ELF type. llvm-svn: 234830
* ELF: Define ELF{32,64}{LE,BE} types and use them everywhere.Rui Ueyama2015-04-1430-163/+106
| | | | llvm-svn: 234823
* ELF: Remove useless templates that takes always the same ELF type.Rui Ueyama2015-04-146-48/+39
| | | | llvm-svn: 234820
* ELF: Fix headers including each other.Rui Ueyama2015-04-132-84/+68
| | | | | | | HexagonSectionChunks.h and HexagonTargetHandler.h include each other. This patch removes the former and merge it with the latter. llvm-svn: 234817
* ELF: Move definitions from {Dynamic,ELF}File.h to .cpp files.Rui Ueyama2015-04-135-811/+897
| | | | | | | | | | | | | | | | | | | DynamicFile and ELFFile are instantiated for four different types, ELF{32,64}{BE,LE}. Because the classes are instantiated in each compilation unit, including the header file makes object files 10MB larger. On Windows, issue of excessive template instantiation is critical, since the regular COFF file supports only up to 65534 sections. (We could use the extended COFF file format, but generating that much COMDAT sections is not a good thing in the first place because it means long compile time and long link time.) I confirmed that this change makes AArch64TargetHandler.cpp.o from 21MB to 8.5MB. It feels still too large, but I think it's a good start. llvm-svn: 234808
* ELF: Simplify alignment check. NFC.Rui Ueyama2015-04-131-4/+1
| | | | llvm-svn: 234791
* ELF: s/ELFTy/ELFT/ for consistency.Rui Ueyama2015-04-135-20/+20
| | | | llvm-svn: 234790
* Remove else after return.Rui Ueyama2015-04-131-3/+2
| | | | llvm-svn: 234784
* Fix formatting and remove excessive parentheses.Rui Ueyama2015-04-131-7/+9
| | | | llvm-svn: 234781
* [Mips] Rollback explicit instantiation of MipsELFFile template classSimon Atanasyan2015-04-133-37/+0
| | | | | | | This is a follow-up to r234728 and r234729. It looks like explicit instantiation of `MipsELFFile` is redundant and triggers Visual C++ warning. llvm-svn: 234756
* ELF/Aarch64: Add overflow checks for relocation writesAdhemerval Zanella2015-04-131-19/+32
| | | | | | | | | This patch adds support for overflow checking when processing R_AARCH64_CALL26, R_AARCH64_JUMP26, R_AARCH64_CONDBR19, R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21, and R_AARCH64_TLSLE_ADD_TPREL_HI12 relocations. llvm-svn: 234749
* ELF/AArch64: Add tests for ADR_PREL_LO21Adhemerval Zanella2015-04-131-6/+7
| | | | | | | Add default and overflow checking when processing R_AARCH64_ADR_PREL_LO21 relocations. llvm-svn: 234747
* [PATCH 08/10] ELF/Aarch64: Add R_AARCH64_ADR_GOT_PAGE and ↵Adhemerval Zanella2015-04-132-9/+16
| | | | | | | | | R_AARCH64_LD64_GOT_LO12_NC checks This patch adds R_AARCH64_ADR_GOT_PAGE overflow and R_AARCH64_LD64_GOT_LO12_NC unaligned value checks. llvm-svn: 234746
* ELF/Aarch64: Internal variable cleanupAdhemerval Zanella2015-04-131-28/+17
| | | | | | | This patch makes the AArch64GotAtomContent, AArch64Plt0AtomContent, and AArch64PltAtomContent static and also cleanup their formatting. llvm-svn: 234745
* ELF/AArch64: Check ADR_PREL_PG_HI21 for overflowAdhemerval Zanella2015-04-131-5/+8
| | | | | | | | | Add support for overflow checking when processing R_AARCH64_ADR_PREL_PG_HI21 relocations and add test. Patch Will Newton. llvm-svn: 234743
* ELF/AArch64: Add support for R_AARCH64_PREL16Adhemerval Zanella2015-04-131-1/+17
| | | | | | | | Add support for the R_AARCH64_PREL16 relocation type and add tests. Patch by Will Newton. llvm-svn: 234742
* ELF/AArch64: Add support for R_AARCH64_PREL64Adhemerval Zanella2015-04-131-0/+15
| | | | | | | | Add support for the R_AARCH64_PREL64 relocation type and add tests. Patch by Will Newton. llvm-svn: 234741
* ELF/AArch64: Add support for checking PREL32 for overflowAdhemerval Zanella2015-04-131-10/+19
| | | | | | | | | Add support for overflow checking when processing R_AARCH64_PREL32 relocations and add tests. Patch by Will Newton. llvm-svn: 234740
* ELF/AArch64: Add support for R_AARCH64_ABS16Adhemerval Zanella2015-04-131-0/+17
| | | | | | | | Add support for the R_AARCH64_ABS16 relocation type and add tests. Patch by Will Newton. llvm-svn: 234739
* Speculative build fix for lld on WindowsHans Wennborg2015-04-132-3/+2
| | | | | | | | | | | | | | | | I can't access my Windows machine at the moment, but the build was breaking with: c:\b\build\slave\crwinclanglld\build\src\third_party\llvm\tools\lld\lib\readerwriter\elf\mips\MipsTargetLayout.h(38) : error C2440: 'return' : cannot convert from 'lld::elf::MipsGOTSection<ELFT> *' to 'lld::elf::AtomSection<ELFT> *' with [ ELFT=lld::elf::Mips32ELType ] Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast I think this regressed caused in 234727: that the forward-declarations of MipsGOTSection<> is not enough. llvm-svn: 234736
* [ARM] Use std::call_once for thread safe initializationDenis Protivensky2015-04-131-20/+18
| | | | | | Thanks to r234628 & r234631 llvm-svn: 234733
* [ARM] Replace branch to unreachable with assertionDenis Protivensky2015-04-131-3/+2
| | | | llvm-svn: 234732
* [Mips] Explicitly instantiate MipsELFFile template classSimon Atanasyan2015-04-133-0/+37
| | | | | | Use explicit instantiation to reduce object files size. llvm-svn: 234729
* [Mips] Create MipsTargetHandler class object using factory functionsSimon Atanasyan2015-04-135-6/+47
| | | | | | | | | | | | | Right now MIPS instantiates MipsTargetHandler using Mips32ELType and Mips64ELType. And in the future we can add a couple more types. That leads to the large object file size because compiler has to create copies of MipsTargetHandler and all realted classes for each types used for instantiation. The patch introduces two factory functions and puts each of them into the separate cpp file. That allows to reduce size of single object file. llvm-svn: 234728
* [Mips] Move `MipsTargetLayout` class to the separate headerSimon Atanasyan2015-04-134-75/+97
| | | | llvm-svn: 234727
* [Mips] Support R_MICROMIPS_GOT_HI/LO16 and R_MICROMIPS_CALL_HI/LO16 relocationsSimon Atanasyan2015-04-132-3/+26
| | | | llvm-svn: 234726
* [Mips] Support R_MIPS_CALL_HI16 / R_MIPS_CALL_LO16 relocations handlingSimon Atanasyan2015-04-132-4/+14
| | | | llvm-svn: 234725
* [Mips] Support R_MIPS_GOT_HI16 / R_MIPS_GOT_LO16 relocations handlingSimon Atanasyan2015-04-132-2/+26
| | | | llvm-svn: 234724
* Revert r234649 "PECOFF: Use C++11 braced init list to make Version objects."Nico Weber2015-04-111-6/+8
| | | | | | | | | | | | | | This doesn't compile with MSVC 2013: include\lld/ReaderWriter/PECOFFLinkingContext.h(356) : error C2797: 'lld::PECOFFLinkingContext::_imageVersion': list initialization inside member initializer list or non-static data member initializer is not implemented include\lld/ReaderWriter/PECOFFLinkingContext.h(357) : error C2797: 'lld::PECOFFLinkingContext::_imageVersion': list initialization inside member initializer list or non-static data member initializer is not implemented llvm-svn: 234676
* Replace a macro with an inline function.Rui Ueyama2015-04-101-4/+4
| | | | llvm-svn: 234650
* PECOFF: Use C++11 braced init list to make Version objects.Rui Ueyama2015-04-101-8/+6
| | | | llvm-svn: 234649
* Do s/_context/_ctx/g globally.Rui Ueyama2015-04-108-88/+80
| | | | | | | | I believe this patch eliminates all remaining uses of _context or _linkingContext variable names. Consistent naming improves readability. llvm-svn: 234645
* Remove the Native file format.Rui Ueyama2015-04-108-1722/+5
| | | | | | | | | | | | | The Native file format was designed to be the fastest on-memory or on-disk file format for object files. The problem is that no one is working on that. No LLVM tools can produce object files in the Native, thus the feature of supporting the format is useless in the linker. This patch removes the Native file support. We can add it back if we really want it in future. llvm-svn: 234641
* ELF: Simplify assignments to "result"Rui Ueyama2015-04-101-22/+22
| | | | | | | This file is not -Wconversion-clean, and seems like we don't care about that except these lines. Fix these lines for simplicity. llvm-svn: 234637
* [Mips] Add -pcrel-eh-reloc command line optionSimon Atanasyan2015-04-101-0/+3
| | | | | | | | This MIPS specific option controls R_MIPS_EH relocation handling. If -pcrel-eh-reloc is specified R_MIPS_EH relocation should be handled like R_MIPS_PC32 relocation. llvm-svn: 234635
* [Mips] Support R_MIPS_EH relocation handlingSimon Atanasyan2015-04-102-2/+6
| | | | | | | The patch supports just the R_MIPS_EH relocation handling and does not implement full specification of compact exception tables for MIPS ABIs. llvm-svn: 234634
* [Mips] Replace MipsTargetHandler member function getGP() by getGPAddr()Simon Atanasyan2015-04-103-12/+11
| | | | | | | When we call getGP() we need in fact _gp symbol address. Let's cache its value and return it directly from the new getGPAddr() function. llvm-svn: 234632
* [Mips] Use std::call_once for thread safe initializationSimon Atanasyan2015-04-101-7/+10
| | | | | | The commit is inspired by r234628. Thanks Rui for the idea. llvm-svn: 234631
* [Mips] Fix typo in the commentSimon Atanasyan2015-04-101-1/+1
| | | | llvm-svn: 234630
* Fix minor threading issue.Rui Ueyama2015-04-101-6/+7
| | | | | | | | Because calls of applyRelocation is parallelized, all functions called from that need to be thread-safe. This piece of code didn't use any synchronization mechanism, so it was not safe. llvm-svn: 234628
* [ARM] Implement PLT for dynamic passDenis Protivensky2015-04-102-0/+109
| | | | | | | | | This includes implementation of PLT0 entry. For testing, libfn.so binary is added since there's no way to link shared objects with lld yet. llvm-svn: 234588
* [ARM] Rework GOT/PLT entry generationDenis Protivensky2015-04-101-21/+23
| | | | | | | Use consistent naming: commonly used generator methods don't have 'Entry' suffices. llvm-svn: 234585
* [ARM] Replace dyn_cast with isa checkDenis Protivensky2015-04-101-1/+1
| | | | llvm-svn: 234582
* [ARM] Improve veneer handling and introduce handlePlain methodDenis Protivensky2015-04-101-1/+13
| | | | | | Handle veneers only for call-like relocations. llvm-svn: 234580
* [ARM] Remove unused variable in dynamic passDenis Protivensky2015-04-101-1/+1
| | | | llvm-svn: 234576
OpenPOWER on IntegriCloud