summaryrefslogtreecommitdiffstats
path: root/lld/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* ArrayRef-ify ParseArgsDavid Blaikie2015-06-215-9/+9
| | | | llvm-svn: 240235
* Fix no-asserts build failure due to unused variable, and cleanup some ↵David Blaikie2015-06-191-1/+3
| | | | | | unique_ptr usage while I'm here llvm-svn: 240169
* Simplify Pass::perform to take a SimpleFile& instead of unique_ptr<SimpleFile>&David Blaikie2015-06-1925-132/+130
| | | | | | | | None of the implementations replace the SimpleFile with some other file, they just modify the SimpleFile in-place, so a direct reference to the file is sufficient. llvm-svn: 240167
* [lld] Allow LLD passes to return error codes.Lang Hames2015-06-1925-39/+77
| | | | llvm-svn: 240147
* [Mips] Write inline some more relocation calculationsSimon Atanasyan2015-06-171-112/+20
| | | | | | No functional changes. llvm-svn: 239961
* [Mips] Support R_MICROMIPS_GPREL16 / R_MICROMIPS_GPREL7_S2 relocations handlingSimon Atanasyan2015-06-172-0/+14
| | | | llvm-svn: 239960
* [Mips] Support R_MIPS_16 relocation handlingSimon Atanasyan2015-06-171-0/+3
| | | | llvm-svn: 239959
* [Mips] Do not use functions to calculate trivial relocationsSimon Atanasyan2015-06-171-15/+2
| | | | | | No functional changes. llvm-svn: 239957
* [ELF] Now that there's an API for ELF symbol types in LLVM, use it.Davide Italiano2015-06-172-24/+3
| | | | | | | | Common symbols will be handled in a separate patch because it seems Hexagon redefines the notion of common symbol, which I'm not (yet) very familiar with. llvm-svn: 239951
* [ELF/x86_64] Fix initial-exec TLS accessAdhemerval Zanella2015-06-177-16/+122
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current approach for initial-exec in ELF/x86_64 is to create a GOT entry and change the relocation to R_X86_64_PC32 to be handled as a GOT offfset. However there are two issues with this approach: 1. the R_X86_64_PC32 is not really required since the GOT relocation will be handle dynamically and 2. the TLS symbols are not being exported externally and then correct realocation are not being applied. This patch fixes the R_X86_64_GOTTPOFF handling by just emitting a R_X86_64_TPOFF64 dynamically one; it also sets R_X86_64_TPOFF64 to be handled by runtime one. For second part, the patches uses a similar strategy used for aarch64, by reimplementing buildDynamicSymbolTable from X86_64ExecutableWriter and adding the TLS symbols in the dynamic symbol table. Some tests had to be adjusted due the now missing R_X86_64_PC32 relocation. With this test the simple testcase: * t1.c: __thread int t0; __thread int t1; __thread int t2; __thread int t3; * t0.c: extern __thread int t0; extern __thread int t1; extern __thread int t2; extern __thread int t3; __thread int t4; __thread int t5; __thread int t6; __thread int t7; int main () { t0 = 1; t1 = 2; t2 = 3; t3 = 4; t4 = 5; t5 = 6; t6 = 7; t7 = 8; printf ("%i %i %i %i\n", t0, t1, t2, t3); printf ("%i %i %i %i\n", t4, t5, t6, t7); return 0; } Shows correct output for x86_64. llvm-svn: 239908
* [ELF] Fix wrong TBSS sizeAdhemerval Zanella2015-06-171-4/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes the wrong .tbss segment size generated for cases where multiple modules have non initialized threads variables. For instance: * t0.c __thread int x0; __thread int x1; __thread int x2; extern __thread int e0; extern __thread int e1; extern __thread int e2; extern __thread int e3; int foo0 () { return x0; } int main () { return x0; } * t1.c __thread int e0; __thread int e1; __thread int e2; __thread int e3; lld is generating (for aarch64): [14] .tbss NOBITS 0000000000401000 00001000 0000000000000010 0000000000000000 WAT 0 0 4 Where is just taking in consideration the largest tbss segment, not all from all objects. ld generates a correct output: [17] .tbss NOBITS 0000000000410dec 00000dec 000000000000001c 0000000000000000 WAT 0 0 4 This issue is at 'lib/ReaderWriter/ELF/SegmentChunks.cpp' where Segment<ELFT>::assignVirtualAddress is setting wrong slice values, not taking care of although tbss segments file size does noy play role in other segment virtual address placement, its size should still be considered. llvm-svn: 239906
* [LinkerScript] Add matching of output sections to segmentsDenis Protivensky2015-06-154-4/+91
| | | | | | | | | | | Add method to query segments for specified output section name. Return error if the section is assigned to unknown segment. Check matching of sections to segments during layout on the subject of correctness. NOTE: no actual functionality of using custom segments is implemented. Differential Revision: http://reviews.llvm.org/D10359 llvm-svn: 239719
* Don't use std::errc.Rafael Espindola2015-06-131-6/+7
| | | | | | | | | | | | | | | | | | | | | As noted on Errc.h: // * std::errc is just marked with is_error_condition_enum. This means that // common patters like AnErrorCode == errc::no_such_file_or_directory take // 4 virtual calls instead of two comparisons. And on some libstdc++ those virtual functions conclude that ------------------------ int main() { std::error_code foo = std::make_error_code(std::errc::no_such_file_or_directory); return foo == std::errc::no_such_file_or_directory; } ------------------------- should exit with 0. llvm-svn: 239685
* [Mips] Support R_MIPS_PC16 relocation handlingSimon Atanasyan2015-06-131-2/+15
| | | | llvm-svn: 239677
* [Mips] Use standard relocations R_MIPS_HI16/LO16 instead of custom variantsSimon Atanasyan2015-06-134-22/+8
| | | | | | No functional changes. llvm-svn: 239676
* Update for llvm api change.Rafael Espindola2015-06-133-36/+9
| | | | llvm-svn: 239671
* [Mips] Handle TLS relocations in -static linking modeSimon Atanasyan2015-06-123-23/+42
| | | | llvm-svn: 239615
* [Mips] Define _gpxxx symbols in both static/dynamic linking modesSimon Atanasyan2015-06-121-8/+4
| | | | llvm-svn: 239614
* [Mips] Setup EI_ABIVERSION flagSimon Atanasyan2015-06-123-4/+20
| | | | | | | - Set EI_ABIVERSION to '1' in case of non-PIC executable. - Set EI_ABIVERSION to '3' in case of using FP64/FP64A floating point ABI. llvm-svn: 239613
* [Mips] Factor out some bit manipulation code into separate routinesSimon Atanasyan2015-06-061-7/+13
| | | | | | No functional changes. llvm-svn: 239226
* [Mips] Check symbol alignment for some MIPS relocations.Simon Atanasyan2015-06-061-10/+13
| | | | llvm-svn: 239225
* [Mips] Perform an overflow checking for relocations resultsSimon Atanasyan2015-06-061-48/+80
| | | | llvm-svn: 239224
* [Mips] Rearrange relocation related cases in the `switch` operatorSimon Atanasyan2015-06-061-12/+12
| | | | | | No functional changes. llvm-svn: 239223
* [Mips] Use signed/unsigned types in relocation calculations consistentlySimon Atanasyan2015-06-061-52/+41
| | | | | | No functional changes. llvm-svn: 239222
* [Mips] Handle all grouped relocations in a uniform waySimon Atanasyan2015-06-061-36/+56
| | | | | | No functional changes. llvm-svn: 239221
* [ELF/AArch64] Fix build issue on MSVCAdhemerval Zanella2015-06-032-2/+2
| | | | | | This patch fixes a build issue from r238981. llvm-svn: 238986
* [ELF/AArch64] Fix TLS initial executable relocationAdhemerval Zanella2015-06-039-36/+193
| | | | | | | | | | | | | | | | | | This patch fixes the TLS initial executable for AArch64. Current implementation have two issues: 1. does not generate dynamic R_AARCH64_TLS_TPREL64 relocation for the external module symbols, and 2. does not export the TLS initial executable symbol in dynamic symbol table. The fix follows the MIPS strategy to add a arch-specific GOTSection class to keep track of TLS symbols required to be place in dynamic symbol table. It also overrides the buildDynamicSymbolTable for ExecutableWrite class to add the symbols. It also adds some refactoring on AArch64RelocationPass.cpp based on ARM backend. llvm-svn: 238981
* [ELF/AArch64] Fix correct TCB aligment calculationAdhemerval Zanella2015-06-033-9/+23
| | | | | | | | | | | | | | This patch fixes the TLS local relocations alignment done by @238258. As pointed out, the TLS size should not be considered, but rather the TCB size based on maximum output segment alignment. Although it has not shown in the TLS simple cases for test-suite, more comprehensible tests with more local TLS variable showed wrong relocations values being generated. The local TLS testcase is expanded to add more tls variable (both exported and static) initialized or not. llvm-svn: 238960
* [Mips] Fix enumeral vs. non-enumeral warning in ternary. NFCDenis Protivensky2015-06-021-5/+5
| | | | | | That's a weird gcc's complain. llvm-svn: 238812
* [Mips] Add a couple of MipsAbiInfoHandler functions to check linked code typeSimon Atanasyan2015-05-313-17/+34
| | | | | | No functional changes. llvm-svn: 238689
* [Mips] Do not put the .reginfo section into the separate segmentSimon Atanasyan2015-05-315-11/+19
| | | | | | | The .reginfo should not belong to the separate segment if there is a .MIPS.abiflags section. llvm-svn: 238688
* [Mips] Sort segments so PT_MIPS_ABIFLAGS goes right after the PT_INTERPSimon Atanasyan2015-05-315-2/+30
| | | | llvm-svn: 238687
* [Mips] Reading, merging and writing .MIPS.abiflags sectionSimon Atanasyan2015-05-3110-80/+680
| | | | | | http://dmz-portal.mips.com/wiki/MIPS_O32_ABI_-_FR0_and_FR1_Interlinking llvm-svn: 238686
* [Mips] Delete MipsReginfo structure. Use the Elf_Mips_RegInfo instead.Simon Atanasyan2015-05-316-89/+30
| | | | llvm-svn: 238685
* [Mips] Collect all ABI related info in the single MipsAbiInfoHandler classSimon Atanasyan2015-05-3112-143/+151
| | | | | | | | New MipsAbiInfoHandler merges and hold both ELF header flags and registries usage masks. In the future commits it will manage some additional information. llvm-svn: 238684
* COFF: Add a new PE/COFF port.Rui Ueyama2015-05-281-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is an initial patch for a section-based COFF linker. The patch has 2300 lines of code including comments and blank lines. Before diving into details, you want to start from reading README because it should give you an overview of the design. All important things are written in the README file, so I write summary here. - The linker is already able to self-link on Windows. - It's significantly faster than the existing implementation. The existing one takes 5 seconds to link LLD on my machine, while the new one only takes 1.2 seconds, even though the new one is not multi-threaded yet. (And a proof-of-concept multi- threaded version was able to link it in 0.5 seconds.) - It uses much less memory (250MB vs. 2GB virtual memory space to self-host). - IMHO the new code is much simpler and easier to read than the existing PE/COFF port. http://reviews.llvm.org/D10036 llvm-svn: 238458
* Fix unused variable warnings.Michael J. Spencer2015-05-281-0/+9
| | | | llvm-svn: 238384
* Add PHDR and FILL parsing.Michael J. Spencer2015-05-281-7/+208
| | | | llvm-svn: 238383
* [Mips] Move member function definitions to cpp filesSimon Atanasyan2015-05-2715-774/+1009
| | | | | | No functional changes. llvm-svn: 238310
* [ELF][Mips] Do not merge ELF flags in the `isCompatible` routineSimon Atanasyan2015-05-276-10/+11
| | | | | | | | We do not need to merge ELF flags from DSO. But `isCompatible` is called for all input files. So this change move ELF flags merging into the MipsELFFile class. llvm-svn: 238304
* [Mips] Factor out look up of Elf_Mips_RegInfo structure into the separate ↵Simon Atanasyan2015-05-271-21/+26
| | | | | | | | function No functional changes. llvm-svn: 238303
* [ELF/AArch64] Fix local TLS relocationsAdhemerval Zanella2015-05-264-7/+35
| | | | | | | | | | | | | This patch fixes the R_AARCH64_TLSLE_ADD_TPREL_HI12 and R_AARCH64_TLSLE_ADD_TPREL_LO12_NC handling by using the correct offset by using the target layout along with aarch64 alignments requirements. It fixes the TLS test-suite SingleSource failures for aarch64: * SingleSource/UnitTests/Threads/2010-12-08-tls.execution_time * SingleSource/UnitTests/Threads/tls.execution_time llvm-svn: 238258
* [ARM] Fix enum type cast in switchDenis Protivensky2015-05-261-1/+1
| | | | | | | | It caused warning in clang assuming the default branch would never be reached with the given switch key type. llvm-svn: 238194
* [ARM] Move out .ARM.exidx related things to ARM backendDenis Protivensky2015-05-266-17/+54
| | | | llvm-svn: 238191
* [Mips] Use structures declared in the llvm/Object/ELFTypes.hSimon Atanasyan2015-05-263-53/+13
| | | | | | No functional changes. llvm-svn: 238189
* [Mips] Add Elf_Mips_Options::getRegInfoDesc() function to retrieve an ↵Simon Atanasyan2015-05-262-3/+9
| | | | | | | | ODK_REGINFO descriptor No functional changes. llvm-svn: 238176
* [Mips] Make the code shorter - use LLVM_ELF_IMPORT_TYPES_ELFT macroSimon Atanasyan2015-05-261-2/+1
| | | | | | No functional changes. llvm-svn: 238175
* [ELF] Add support for -z origin/now options.Davide Italiano2015-05-262-2/+21
| | | | | | Differential Revision: http://reviews.llvm.org/D9963 llvm-svn: 238169
* [ELF] Fix lld when no unique sections is usedSimon Atanasyan2015-05-242-6/+6
| | | | | | | | | Original patch of Shankar Easwaran with additional test case. The yaml2obj does not allow to create an object file with non-unique sections names so the fix uses a binary input object file in the test case. llvm-svn: 238115
* Remove redundant std::move on functions that return a unique_ptr.Benjamin Kramer2015-05-221-4/+4
| | | | llvm-svn: 238034
OpenPOWER on IntegriCloud