summaryrefslogtreecommitdiffstats
path: root/lld
Commit message (Collapse)AuthorAgeFilesLines
...
* [ELF] Make non-writable non-executable PROGBITS sections closer to .textFangrui Song2018-06-2646-245/+218
| | | | | | | | | | | | This generalizes the old heuristic placing SHT_DYNSYM SHT_DYNSTR first in the readonly SHF_ALLOC segment. Reviewers: espindola Subscribers: emaste, arichardson, llvm-commits Differential Revision: https://reviews.llvm.org/D48406 llvm-svn: 335674
* [PPC64] Thread-local storage general-dynamic to initial-exec relaxation.Sean Fertile2018-06-264-0/+166
| | | | | | | | | | | | | | | | | | Patch adds support for relaxing the general-dynamic tls sequence to initial-exec. the relaxation performs the following transformation: addis r3, r2, x@got@tlsgd@ha --> addis r3, r2, x@got@tprel@ha addi r3, r3, x@got@tlsgd@l --> ld r3, x@got@tprel@l(r3) bl __tls_get_addr(x@tlsgd) --> nop nop --> add r3, r3, r13 and instead of emitting a DTPMOD64/DTPREL64 pair for x, we emit a single R_PPC64_TPREL64. Differential Revision: https://reviews.llvm.org/D48090 llvm-svn: 335651
* [ELF] Assign RF_EXEC rank even if --no-rosegment or SECTIONS command is usedFangrui Song2018-06-2633-147/+148
| | | | | | | | | | | | | | | | | Summary: Currently when --no-rosegment is specified or a linker script with SECTIONS command is used, .rodata (A) .text (AX) are assigned the same rank and .rodata may be placed after .text . This increases the gap between .text and .bss and can cause pc-relative relocation overflow (e.g. gcc crtbegin.o crtbegin.S have R_X86_64_PC32 relocation from .text to .bss). This patch makes SingleRoRx affect only segment layout, not section layout. As a consequence, .rodata will be placed before .text regardless of SingleRoRx. Reviewers: espindola, ruiu, grimar, echristo, javed.absar Subscribers: emaste, arichardson, llvm-commits Differential Revision: https://reviews.llvm.org/D48405 llvm-svn: 335627
* [ELF] Move `# REQUIRES:` line to the topFangrui Song2018-06-26104-178/+104
| | | | llvm-svn: 335625
* [ELF] - Change the way of sorting local symbols.George Rimar2018-06-261-13/+13
| | | | | | | | | | | | | | | | | rLLD329787 added the stable sorting to SymbolTableBaseSection::postThunkContents. I profiled the Mozilla (response-O0.txt) from lld-speed-test package and found std::stable_sort is showing up in profile results and consuming the 3.1% of the total CPU time in the RelWithDebug build. Total time of postThunkContents is 3.54%, 238ms. This change reduces postTimeContents time to 50ms, making it to take 0.73% of Total CPU time. So, instead of sorting the local part I suggest to just rebuild it. That is what this patch does. Differential revision: https://reviews.llvm.org/D45519 llvm-svn: 335583
* [ELF] Fix sort-non-script.sFangrui Song2018-06-251-1/+1
| | | | llvm-svn: 335499
* [ELF] Change test files for style consistency. NFCFangrui Song2018-06-2510-37/+37
| | | | | | | | | * Move `REQUIRES:` line to the top * llvm-mc ... -o %t -> llvm-mc ... -o %t.o * Don't check "TEXT" "DATA" columns (they are bfd-style names that do not fit into llvm well) in llvm-objdump output llvm-svn: 335498
* [ELF] readobj -elf-output-style=GNU -> readelfFangrui Song2018-06-2512-16/+15
| | | | | | Style change for consistency. NFC llvm-svn: 335494
* [ELF] - ICF: add one more test case #3.George Rimar2018-06-251-0/+23
| | | | | | | | | | | | ICF is able to merge sections which relocations referring regular input sections or mergeable sections, so it handles InputSection and MergeInputSection cases. The following "return false" line which is executed in case of another type of the sections is uncovered by our test cases: https://github.com/llvm-mirror/lld/blob/master/ELF/ICF.cpp#L285 Patch fixes code coverage for this place. llvm-svn: 335482
* [ELF] - Rewrote comment. NFC.George Rimar2018-06-251-2/+2
| | | | llvm-svn: 335479
* [ELF] - ICF: add one more test case #2.George Rimar2018-06-251-0/+23
| | | | | | | | | | Check that ICF does not merge sections which relocations have equal addends, but different target values. This covers the following line, which was uncovered: https://github.com/llvm-mirror/lld/blob/master/ELF/ICF.cpp#L278 llvm-svn: 335477
* [ELF] - ICF: add one more test case.George Rimar2018-06-251-0/+26
| | | | | | | | | | | This test case check that ICF does not merge 2 sections which relocations efer to symbols that live in sections of the different types (regular input section and mergeable input sections in this case). It covers the following line of code, which was uncovered previously: https://github.com/llvm-mirror/lld/blob/master/ELF/ICF.cpp#L271 llvm-svn: 335475
* Revert r335460 "[ELF] - ICF: Remove dead code. NFC."George Rimar2018-06-251-0/+3
| | | | | | My mistake, it was not NFC. llvm-svn: 335471
* [ELF] - ICF: Remove dead code. NFC.George Rimar2018-06-251-3/+0
| | | | | | | | | | | | Code is dead. We use only InputSections when building the list of sections elegible for the ICF: https://github.com/llvm-mirror/lld/blob/master/ELF/ICF.cpp#L439 And 'isEligible' filters out SyntheticSections as well for us. That way the only Kind we have in the Sections vector is SectionBase::Regular, so we do not need to check sections kind at all, it is always the same. llvm-svn: 335460
* [ELF] - ICF: test we do not merge sectinons which relocations points to ↵George Rimar2018-06-251-0/+20
| | | | | | | | | | | symbols of the different types. This test case covers the following line of code: https://github.com/llvm-mirror/lld/blob/master/ELF/ICF.cpp#L261 Previously it was uncovered. llvm-svn: 335453
* [ELF] - Replace llvm::find_if with the loop. NFC.George Rimar2018-06-251-4/+3
| | | | | | Requested during post commit review. llvm-svn: 335447
* [ELF] Change llvm-objdump output for D48472: TEXT DATA -> TEXTFangrui Song2018-06-2315-25/+25
| | | | | | | | | | Reviewers: jyknight, Bigcheese, espindola Subscribers: emaste, arichardson, llvm-commits Differential Revision: https://reviews.llvm.org/D48473 llvm-svn: 335404
* [ELF] - ICF: test we do not merge sections which relocations differs only in ↵George Rimar2018-06-221-0/+20
| | | | | | | | | | | addend. This is to test the following `return false` line which was uncovered by our tests earlier: https://github.com/llvm-mirror/lld/blob/master/ELF/ICF.cpp#L255 llvm-svn: 335357
* Revert "[WebAssembly] Error on mismatched function signature in final output"Sam Clegg2018-06-227-46/+16
| | | | | | | | | | This caused a lot of issues on the WebAssembly waterfall. In particular, until with the signature of `main`. We probably want a better solution for main before we re-land. Reverts rL335192 llvm-svn: 335355
* [ELF] - Repair (re-enable) few ICF test cases.George Rimar2018-06-225-5/+5
| | | | | | | | | --verbose is not used to report ICF sections since r324755, --print-icf-sections is used instead. These tests were at fact disabled since that time. llvm-svn: 335354
* [ELF] - ICF: Add 2 more test cases.George Rimar2018-06-222-0/+92
| | | | | | | | | | These test cases covers the following condition: https://github.com/llvm-mirror/lld/blob/master/ELF/ICF.cpp#L243 It was uncovered by our tests. I was able to delete the whole `if` and no test failed. llvm-svn: 335351
* [ELF] - ICF: remove excessive check. NFC.George Rimar2018-06-221-3/+0
| | | | | | | | | | | | | | | | Change removes the excessive comparsion of the relocation arrays sizes. This code was dead, because at the higer level, equalsConstant function contains the following check: `A->NumRelocations != B->NumRelocations` where NumRelocations contains the size of the relocations array. So removed check did the same job twice. This was found with use of code coverage analysis. llvm-svn: 335346
* [ELF] - Change how we handle suplicate -wrap. [NFC]George Rimar2018-06-222-5/+9
| | | | | | | This avoids doing llvm::sort and std::unique for -wrap options. I think it is more clean way. llvm-svn: 335337
* [WebAssembly] Only mark non-hidden symbols as live if they are also definedSam Clegg2018-06-213-40/+23
| | | | | | | | | Previously we were also marking undefined symbols (i.e. imports) as live. Differential Revision: https://reviews.llvm.org/D48299 llvm-svn: 335243
* [WebAssembly] Error on mismatched function signature in final outputSam Clegg2018-06-217-16/+46
| | | | | | | | | | | | | During symbol resolution, emit warnings for function signature mismatches. During GC, if any mismatched symbol is marked as live then generate an error. This means that we only error out if the mismatch is written to the final output. i.e. if we would generate an invalid wasm file. Differential Revision: https://reviews.llvm.org/D48394 llvm-svn: 335192
* [WebAssembly] Minor cleanup to test inputs. NFC.Sam Clegg2018-06-203-26/+25
| | | | | | | | | | | Update load-undefined.test such that it doesn't rely on ret32 and ret64 having default visibility. Split out from: https://reviews.llvm.org/D48394 Differential Revision: https://reviews.llvm.org/D48403 llvm-svn: 335187
* [WebAssembly] Update function signature mismatch error message. NFC.Sam Clegg2018-06-204-6/+6
| | | | | | | | | | We don't start our error messages with capital letters. Split out from https://reviews.llvm.org/D48394 Differential Revision: https://reviews.llvm.org/D48400 llvm-svn: 335186
* [ELF][MIPS] Fill a primary-GOT as much as possibleSimon Atanasyan2018-06-202-34/+28
| | | | | | | | | While building a Global Offset Table try to fill the primary GOT as much as possible because the primary GOT can be accessed in the most effective way. If it is not possible, try to fill the last GOT in the multi-GOT list, and finally create a new GOT if both attempts failed. llvm-svn: 335140
* [ELF] Support -z initfirstFangrui Song2018-06-204-4/+8
| | | | | | | | | | | | | | | | Summary: glibc uses this option to link libpthread.so glibc/nptl/Makefile: LDFLAGS-pthread.so = -Wl,--enable-new-dtags,-z,nodelete,-z,initfirst Reviewers: ruiu, echristo, espindola Subscribers: emaste, arichardson, llvm-commits Differential Revision: https://reviews.llvm.org/D48329 llvm-svn: 335090
* [ELF][MIPS] Temporarily mark failed MIPS tests as XFAIL.Simon Atanasyan2018-06-192-0/+12
| | | | | | | | | microMIPS 64-bit is unsupported by LLVM starting from r335057. But such code can be generated by GCC. Mark failed test cases as XFAIL while decide to drop microMIPS 64-bit support from LLD too or use binary inputs for the test. llvm-svn: 335059
* [ELF] Uniquify --wrap list.Fangrui Song2018-06-182-2/+7
| | | | | | | | | | | | Summary: For --wrap foo --wrap foo, bfd/gold wrap the symbol only once but LLD would rotate it twice. Reviewers: ruiu, espindola Subscribers: emaste, arichardson, mgrang, llvm-commits Differential Revision: https://reviews.llvm.org/D48298 llvm-svn: 334991
* [ELF] - Simplify the conflict-variable-linkage-name.s test case. [NFC]George Rimar2018-06-181-18/+0
| | | | | | | | | This is a follow up requested during post commit review for "[lld] r333880 - [ELF] - Also use DW_AT_linkage_name when gathering information about variables for error messages." It removes checking of the input objects since it is really excessive. llvm-svn: 334946
* Update copyright year to 2018.Paul Robinson2018-06-181-1/+1
| | | | llvm-svn: 334936
* [ELF] Pass callables by function_refBenjamin Kramer2018-06-167-20/+20
| | | | | | | No need to create a heavyweight std::function if it's not stored. No functionality change intended. llvm-svn: 334885
* [ELF][MIPS] Fix stable_sort predicate to satisfy strict-ordering ↵Simon Atanasyan2018-06-156-21/+23
| | | | | | | | requirement. NFC Fix for PR37785. llvm-svn: 334851
* Fix wasm responsefile lld test on WindowsReid Kleckner2018-06-141-2/+2
| | | | llvm-svn: 334762
* [COFF] Fix /wholearchive: to do libpath search againReid Kleckner2018-06-142-4/+5
| | | | | | Fixes https://crbug.com/852882 llvm-svn: 334761
* [ELF][MIPS] Replace calls to MapVector::find by MapVector::lookup. NFCSimon Atanasyan2018-06-141-5/+5
| | | | llvm-svn: 334705
* [ELF][X86_64] Use R_GOTREL_FROM_END instead of R_GOTREL for R_X86_64_GOTOFF64Fangrui Song2018-06-133-21/+30
| | | | | | | | | | | | | | | | | | Summary: R_X86_64_GOTOFF64: S + A - GOT R_X86_64_GOTPC{32,64}: GOT + A - P (R_GOTONLY_PC_FROM_END) R_X86_64_GOTOFF64 should use R_GOTREL_FROM_END so that in conjunction with R_X86_64_GOTPC{32,64}, the `GOT` term is neutralized. This also matches the handling of R_386_GOTOFF (S + A - GOT). Reviewers: ruiu, espindola Subscribers: emaste, arichardson, llvm-commits Differential Revision: https://reviews.llvm.org/D48095 llvm-svn: 334672
* Remove needless bitwise-AND.Rui Ueyama2018-06-131-1/+1
| | | | | | Because applyMask ignores upper bits, we don't need to mask them. llvm-svn: 334647
* Make a function non-member because it doesn't depend on any class.Rui Ueyama2018-06-131-2/+1
| | | | llvm-svn: 334646
* Apply clang-format.Rui Ueyama2018-06-131-4/+2
| | | | llvm-svn: 334645
* [Darwin] Do not error on '-lto_library' optionBrian Gesiak2018-06-132-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Any invocation of `clang -fuse-ld=lld` that results in a link command on a macOS host currently fails, because the Darwin lld driver does not recognize the `-lto_library` option that Clang passes it. Fix the error by having the Darwin driver ignore the option. The Clang driver's macOS toolchain is written such that it will always pass the `-lto_library` option to the linker invocation on a macOS host. And although the DarwinLdDriver is written to ignore any unknown arguments, because `-lto_library` begins with `-l`, the DarwinLdDriver interprets it as a library search command, for a library named "to_library". When the DarwinLdDriver is unable to find a library specified via `-l`, it exits with a hard error. This causes any invocation of `clang -fuse-ld=lld` that results in a link command on a macOS host to fail with an error. To fix the issue, I considered two alternatives: 1. Modify the Clang Darwin toolchain to only pass `-lto_library` if lld is *not* being used. lld doesn't support LTO on Darwin anyway, so it can't use the option. However, I opted against this because, if and when lld *does* support LTO on Darwin, I'll have to make another commit to Clang in order to get it to pass the option to lld again. 2. Modify the Darwin lld driver to ignore the `-lto_library` option. Just in case users may take this to mean LTO is supported, I also added a warning. If and when lld supports LTO on Darwin, the same commit that adds support for this option can remove the warning. Option (2) seemed better to me, and is the rationale behind this commit. Test Plan: check-lld Reviewers: ruiu, smeenai, pcc Reviewed By: smeenai Subscribers: JDevlieghere, pcc, mehdi_amini, inglorion, steven_wu, llvm-commits Differential Revision: https://reviews.llvm.org/D47994 llvm-svn: 334641
* Add Hexagon SupportSid Manning2018-06-137-0/+104
| | | | | | Differential Revision: https://reviews.llvm.org/D47791 llvm-svn: 334637
* [WebAssembly] Fix broken build due to missing attributes.incAaron Smith2018-06-131-1/+9
| | | | | | | | | | WebAssembly depends on attributes.h which includes attributes.inc. Unless cmake explicitly specifies this dependency, the .inc file is sometimes generated after the build tries to use it. Patch by Stella Stamenova llvm-svn: 334581
* Use shorter names for #lo, #hi, #ha, etc. NFC.Rui Ueyama2018-06-131-15/+15
| | | | | | | | Since these functions are file-local, the new names shouldn't be ambiguous. Differential Revision: https://reviews.llvm.org/D48093 llvm-svn: 334564
* Fix /WholeArchive bug.Rui Ueyama2018-06-123-20/+54
| | | | | | | | | | `lld-link foo.lib /wholearchive:foo.lib` should work the same way as `lld-link /wholearchive:foo.lib foo.lib`. Previously, /wholearchive in the former case was ignored. Differential Revision: https://reviews.llvm.org/D47565 llvm-svn: 334552
* [COFF] Fix crash when emitting symbol tables with GCShoaib Meenai2018-06-122-1/+31
| | | | | | | | | | | | | When running with linker GC (`-opt:ref`), defined imported symbols that are referenced but then dropped by GC end up with their `Location` member being nullptr, which means `getChunk()` returns nullptr for them and attempting to call `getChunk()->getOutputSection()` causes a crash from the nullptr dereference. Check for `getChunk()` being nullptr and bail out early to avoid the crash. Differential Revision: https://reviews.llvm.org/D48092 llvm-svn: 334548
* Handle R_X86_64_GOTOFF64.Rui Ueyama2018-06-122-0/+20
| | | | | | | | | | | | | | | R_X86_64_GOTOFF64 is a relocation type to set to a distance betwween a symbol and the beginning of the .got section. Previously, we always created a dynamic relocation for the relocation type even though it can be resolved at link-time. Creating a dynamic relocation for R_X86_64_GOTOFF64 caused link failure for some programs that do have a relocation of the type in a .text section, as text relocations are prohibited in most configurations. Differential Revision: https://reviews.llvm.org/D48058 llvm-svn: 334534
* [ELF][PPC64] Support R_PPC64_DTPREL64 which may be emitted in .rela.debug_addrFangrui Song2018-06-122-0/+8
| | | | llvm-svn: 334533
OpenPOWER on IntegriCloud