summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/ELF
Commit message (Collapse)AuthorAgeFilesLines
...
* elf: Make error output from AtomSection<ELFT>::write() deterministic.Nico Weber2015-07-122-12/+19
| | | | | | | | | | | | | | | | The function uses parallel_for() and then writes error messages from the parallel loop's body. This produces nondetermistic error messages. Instead, copy error messages to a vector and sort it by the atom's file offsets before printing all error messages after the parallel_for(). This results in a few string copies, but only in the error case. (And passing tests seem more important than performance.) This makes tests elf/AArch64/rel-prel16-overflow.test and elf/AArch64/rel-prel32-overflow.test pass on Windows: Both tests check that atom error messages are emitted in a certain order, and on Windows they happened to be emitted in a different order before this patch. llvm-svn: 241988
* [ELF/AArch64] Set correct loader name in linking contextAdhemerval Zanella2015-07-031-3/+3
| | | | | | | | This patch reimplements ELFLinkingContext::getDefaultInterpreter for aarch64 with correct loader name. It is required to exclude the loader from DT_NEEDED in shared library creation. llvm-svn: 241371
* [ELF/AArch64] Set correct loader name in linking contextAdhemerval Zanella2015-07-031-0/+5
| | | | | | | | This patch reimplements ELFLinkingContext::getDefaultInterpreter for aarch64 with correct loader name. It is required to exclude the loader from DT_NEEDED in shared library creation. llvm-svn: 241370
* Use getDynamicSymbolName/getStaticSymbolName instead of a constant argument.Rafael Espindola2015-07-032-3/+3
| | | | llvm-svn: 241346
* [Mips] Factor out symbol type checking (PIC/non-PIC) into the separate functionSimon Atanasyan2015-07-033-4/+9
| | | | | | No functional changes. llvm-svn: 241342
* [ELF] Define __start_XXX/__stop_XXX symbols where XXX is a section nameSimon Atanasyan2015-07-035-14/+50
| | | | | | | | | | | | | | This is GNU ELF linker extension used particularly by LibC code. If input object files contain section named XXX, and the XXX is a valid C identifier, and there are undefined or weak symbols __start_XXX/__stop_XXX, linker should define __start_XXX/__stop_XXX symbols point to the begin/end of the XXX section correspondingly. For example, without support of this extension statically linked executables for X86_64 and Mips (maybe other) targets do not flush IO buffers at the end of executing. llvm-svn: 241341
* [ELF] Remove dead code. NFCSimon Atanasyan2015-07-021-12/+0
| | | | llvm-svn: 241274
* [ELF] Make OutputSection::memSize `const` member function. NFCSimon Atanasyan2015-07-011-1/+1
| | | | llvm-svn: 241194
* [ELF/AArch64] Initial General-dynamic TLS supportAdhemerval Zanella2015-07-013-9/+157
| | | | | | | | | | | | | | This patch adds initial general-dynamic TLS support for AArch64. Currently no optimization is done to realx for more performance-wise models (initial-exec or local-exec). This patch also only currently handles correctly executable generation, although priliminary DSO support through PLT specific creation is also added. With this change clang/llvm bootstrap with lld is possible in static configuration (some DSO creation fails due missing Linker script support, not AArch64 specific), although make check also shows some issues. llvm-svn: 241192
* Update for llvm api change.Rafael Espindola2015-07-011-12/+27
| | | | llvm-svn: 241157
* Use copy init instead of direct init.Rafael Espindola2015-06-301-4/+4
| | | | llvm-svn: 241089
* Update for llvm change.Rafael Espindola2015-06-302-6/+6
| | | | llvm-svn: 241075
* Update for llvm api change.Rafael Espindola2015-06-291-1/+1
| | | | llvm-svn: 240997
* Update for llvm api change.Rafael Espindola2015-06-291-1/+5
| | | | llvm-svn: 240951
* Update for llvm change.Rafael Espindola2015-06-293-9/+10
| | | | llvm-svn: 240940
* [Mips] Reject R_MIPS_CALL16 against local symbolsSimon Atanasyan2015-06-261-14/+33
| | | | llvm-svn: 240765
* [Mips] Use helper functions to determine relocations purposeSimon Atanasyan2015-06-261-126/+91
| | | | | | | | That allows to remove duplicated long switch/case statements. No functional changes. llvm-svn: 240764
* [Mips] Create LA25 stubs for all branch relocationsSimon Atanasyan2015-06-261-34/+57
| | | | llvm-svn: 240763
* [ELF] Fix .init_array initializationAdhemerval Zanella2015-06-241-1/+5
| | | | | | | | | | | | | | | Some compilers may not add the section symbol in '.symtab' for the .init_array and 'ldd' just ignore it. It results in global constructor not being called in final executable. This patch add both '.init_array' and '.fini_array' to be added in Atom graph generation even when the section contains no symbol. An already existing testcase is modified to check for such scenario. The issue fixes the llvm test-suite regressions for both Single and MultiSource files. llvm-svn: 240570
* [Mips] Support R_MICROMIPS_HI0_LO16 relocation handlingSimon Atanasyan2015-06-222-1/+5
| | | | llvm-svn: 240268
* [Mips] Support R_MICROMIPS_LITERAL relocation handlingSimon Atanasyan2015-06-222-0/+5
| | | | llvm-svn: 240267
* [Mips] Support R_MIPS_LITERAL relocation handlingSimon Atanasyan2015-06-222-1/+5
| | | | llvm-svn: 240266
* [Mips] Support R_MICROMIPS_SUB relocation handlingSimon Atanasyan2015-06-221-2/+6
| | | | llvm-svn: 240265
* [Mips] Reject R_MIPS_GPREL32 against external symbolsSimon Atanasyan2015-06-221-2/+16
| | | | llvm-svn: 240264
* [Mips] Reject position-dependent relocations in case of shared library linkingSimon Atanasyan2015-06-221-10/+70
| | | | llvm-svn: 240262
* [Mips] Support R_MICROMIPS_HIGHER / R_MICROMIPS_HIGHEST relocations handlingSimon Atanasyan2015-06-221-0/+4
| | | | llvm-svn: 240260
* [Mips] Support R_MIPS_HIGHER / R_MIPS_HIGHEST relocations handlingSimon Atanasyan2015-06-221-0/+14
| | | | llvm-svn: 240259
* Simplify Pass::perform to take a SimpleFile& instead of unique_ptr<SimpleFile>&David Blaikie2015-06-198-66/+66
| | | | | | | | 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-198-9/+21
| | | | 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-152-0/+15
| | | | | | | | | | | 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
* [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
* [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
OpenPOWER on IntegriCloud