aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2018-06-08Expand comments.linaro-local/peter.smith/icfRui Ueyama
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@334250 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-07[WebAssembly] Add --export-all flagSam Clegg
This causes all symbols to be exported in the final wasm binary even if they were not compiled with default visibility. This feature is useful for the emscripten toolchain that has a corresponding EXPORT_ALL feature which allows the JS code to interact with all C function. Differential Revision: https://reviews.llvm.org/D47806 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@334157 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-07[COFF] report file containing unsupported relocationBob Haarman
Summary: When reporting an unsupported relocation type, let's also report the file we encountered it in to aid diagnosis. Reviewers: ruiu, rnk Reviewed By: rnk Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D45911 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@334154 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-07Expand the file comment for the error handlers.Rui Ueyama
Differential Revision: https://reviews.llvm.org/D47790 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@334148 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-06[ThinLTO/lld] Document constant bool ModuleSummaryIndex parameter (NFC)Teresa Johnson
Makes this consistent with other ModuleSummaryIndex constructor calls. git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@334141 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-06Correct aligment computation for shared object symbols.Han Shen
The original computation for shared object symbol alignment is wrong when st_value equals 0. It is very unusual for dso symbols to have st_value equal 0. But when it happens, it causes obscure run time bugs. Differential Revision: https://reviews.llvm.org/D47602 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@334135 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-06Remove an unrelated file accidentally submitted as part of r334095.Rui Ueyama
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@334129 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-06[lld] Add REQUIRES: x86 where needed to testsJoel Jones
If building lld without x86 support, tests that require that support should be treated as unsupported, not errors. Tested using: 1. cmake '-DLLVM_TARGETS_TO_BUILD=AArch64;X86' make check-lld => Expected Passes : 1406 Unsupported Tests : 287 2. cmake '-DLLVM_TARGETS_TO_BUILD=AArch64' make check-lld => Expected Passes : 410 Unsupported Tests : 1283 Patch by Joel Jones Differential Revision: https://reviews.llvm.org/D47748 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@334095 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-05Do not show unrelated "-m is missing" error message.Rui Ueyama
Previously, "-m is missing" error message is shown if you pass a nonexistent file or don't pass any file at all to lld, as shown below: $ ld.lld nonexistent.o ld.lld: error: cannot open nonexistent.o: No such file or directory ld.lld: error: target emulation unknown: -m or at least one .o file required This patch eliminates the second error message because it's not related and even inaccurate (you passed a .o file though it didn't exist). git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@334024 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-04[ELF] - Fix BB.George Rimar
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@333883 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-04[ELF] - Also use DW_AT_linkage_name when gathering information about ↵George Rimar
variables for error messages. Currently, when LLD do a lookup for variables location, it uses DW_AT_name attribute. That is not always enough. Imagine code: namespace A { int bar = 0; } namespace Z { int bar = 1; } int hoho; In this case there are 3 variables and their debug attributes are following: A::bar has: DW_AT_name [DW_FORM_string] ("bar") DW_AT_linkage_name [DW_FORM_strp] ( .debug_str[0x00000006] = "_ZN1A3barE") Z::bar has: DW_AT_name [DW_FORM_string] ("bar") DW_AT_linkage_name [DW_FORM_strp] ( .debug_str[0x0000003f] = "_ZN1Z3barE") hoho has: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000004a] = "hoho") and has NO DW_AT_linkage_name attribute. Because it would be the same as DW_AT_name and DWARF producers avoids emiting excessive data. Hence LLD should also use DW_AT_linkage_name when it is available. (currently, LLD fails to report location correctly because thinks that A::bar and Z::bar are the same things) Differential revision: https://reviews.llvm.org/D47373 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@333880 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-01ELF: Ignore argument after --plugin.Peter Collingbourne
Clang passes --plugin /path/to/LLVMgold.so to the linker when -flto is passed. After r333607 we only ignore --plugin as a joined argument, which means that the following argument (/path/to/LLVMgold.so) is interpreted as an input file. This means that either every LTO'd program ends up being linked with the gold plugin or we error out if the plugin does not exist. The fix is to use Eq to ignore both --plugin=foo and --plugin foo as before. Differential Revision: https://reviews.llvm.org/D47657 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@333793 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-01Show choices of multiple-choice options in `ld.lld --help` message.Rui Ueyama
Differential Revision: https://reviews.llvm.org/D47656 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@333792 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-01[PPC64] Add support for initial-exec TLS modelZaara Syeda
This patch adds the relocations needed support the initial-exec TLS model: R_PPC64_GOT_TPREL16_HA R_PPC64_GOT_TPREL16_LO_DS R_PPC64_GOT_TPREL16_DS R_PPC64_GOT_TPREL16_HI R_PPC64_TLS Differential Revision: https://reviews.llvm.org/D47455 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@333769 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-31Print out "Alias for -foo" instead of repeating the same help message for -foo.Rui Ueyama
Since aliases don't actually need name, I removed it from Options.td to keep the definitions concise. Before: -( Ignored for compatibility with GNU unless you pass --warn-backrefs -) Ignored for compatibility with GNU unless you pass --warn-backrefs --allow-multiple-definition Allow multiple definitions --apply-dynamic-relocs Apply dynamic relocations to place --as-needed Only set DT_NEEDED for shared libraries if used --auxiliary=<value> Set DT_AUXILIARY field to the specified name --Bdynamic Link against shared libraries --Bshareable Build a shared object ... After: -( Alias for --start-group -) Alias for --end-group --allow-multiple-definition Allow multiple definitions --apply-dynamic-relocs Apply dynamic relocations to place --as-needed Only set DT_NEEDED for shared libraries if used --auxiliary=<value> Set DT_AUXILIARY field to the specified name --Bdynamic Link against shared libraries (default) --Bshareable Alias for --shared ... Differential Revision: https://reviews.llvm.org/D47588 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@333694 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-31Fix rpath-link handlingTaiju Tsuiki
Summary: After r333596, rpath-link no longer consumes the following argument, and the path argument left by it confuses LLD. Reviewers: espindola, ruiu Reviewed By: ruiu Subscribers: ruiu, emaste, arichardson, llvm-commits Differential Revision: https://reviews.llvm.org/D47591 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@333686 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-31[PPC64] Support R_PPC64_GOT_TLSLD16 relocations.Sean Fertile
Add support for the R_PPC64_GOT_TLSLD16 relocations used to build the address of the tls_index struct used in local-dynamic tls. Differential Revision: https://reviews.llvm.org/D47538 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@333681 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-31Rename R_TLSGD/R_TLSLD to add _GOT_FROM_END. NFC.Sean Fertile
getRelocTargetVA for R_TLSGD and R_TLSLD RelExprs calculate an offset from the end of the got, so adjust the names to reflect this. Differential Revision: https://reviews.llvm.org/D47379 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@333674 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-31Remove name from unused options. NFC.Rui Ueyama
This change makes it impossible to use these options in code. git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@333655 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-31Fix formatting. NFC.Rui Ueyama
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@333654 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-31lld-link: Implement /INTEGRITYCHECK flagNico Weber
/INTEGRITYCHECK has the effect of setting IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY. Fixes PR31066. https://reviews.llvm.org/D47472 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@333652 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-31Attempt to fix a buildbot.Rui Ueyama
Broken buildbot log: http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/30855/steps/build/logs/stdio git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@333648 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-31Fix a wrong `ld.lld --help` message.Rui Ueyama
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@333647 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-31Implement --{push,pop}-state.Rui Ueyama
--push-state implemented in this patch saves the states of --as-needed, --whole-archive and --static. It saves less number of flags than GNU linkers. Since even GNU linkers save different flags, no one seems to care about the details. In this patch, I tried to save the minimal number of flags to not complicate the implementation and the siutation. I'm not personally happy about adding the --{push,pop}-state flags though. That options seem too hacky to me. However, gcc started using the options since GCC 8 when GNU ld is available at the build time. Therefore, lld is no longer a drop-in replacmenet for GNU linker for that machine without supporting the flags. Fixes https://bugs.llvm.org/show_bug.cgi?id=34567 Differential Revision: https://reviews.llvm.org/D47542 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@333646 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-30Add "(default)" to default optionsRui Ueyama
This improves the help message shown for `ld.lld --help`. Differential Revision: https://reviews.llvm.org/D47562 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@333607 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-30Simplify `ld.lld --help` message.Rui Ueyama
Previously, we printed out two lines of help messages for `--foo bar` and `--foo=bar` like this: --soname=<value> Set DT_SONAME --soname <value> Set DT_SONAME --sort-section=<value> Specifies sections sorting rule when linkerscript is used --sort-section <value> Specifies sections sorting rule when linkerscript is used This change eliminates duplicate lines that doesn't contain `=` for such options like this. --soname=<value> Set DT_SONAME --sort-section=<value> Specifies sections sorting rule when linkerscript is used Differential Revision: https://reviews.llvm.org/D47558 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@333596 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-30[WebAssembly] Initial support for LTOSam Clegg
Differential Revision: https://reviews.llvm.org/D47162 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@333570 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-30[ELF] Remove -m argument to lld in test files. NFC.Sam Clegg
This should be correctly implied by the linker. This also makes the tests slightly easier to maintain and compare with the equivalent tests under for other platforms. Differential Revision: https://reviews.llvm.org/D47513 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@333567 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-30[ELF][MIPS] Update comments in test cases. NFCSimon Atanasyan
This is a follow-up to the r332374. git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@333516 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-30[ELF] Group LTO options together. NFC.Sam Clegg
Differential Revision: https://reviews.llvm.org/D47512 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@333505 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-30[WebAssembly] Add support for response file parsingSam Clegg
Differential Revision: https://reviews.llvm.org/D47500 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@333499 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-29ELF: Run the same test without --thinlto-jobs as we do with --thinlto-jobs.Peter Collingbourne
The comment only made sense a long time ago, when --thinlto-jobs was tied with --lto-partitions. That was changed in r283817, but the test wasn't updated at the same time. This patch does so. git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@333480 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-29[COFF] Unify output section code. NFCShoaib Meenai
Peter Collingbourne suggested moving the switch to the top of the function, so that all the code that cares about the output section for a symbol is in the same place. Differential Revision: https://reviews.llvm.org/D47497 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@333472 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-29[COFF] Simplify symbol table output section computationShoaib Meenai
Rather than using a loop to compare symbol RVAs to the starting RVAs of sections to determine which section a symbol belongs to, just get the output section of a symbol directly via its chunk, and bail if the symbol doesn't have an output section, which avoids having to hardcode logic for handling dead symbols, CodeView symbols, etc. This was suggested by Reid Kleckner; thank you. This also fixes writing out symbol tables in the presence of RVA table input sections (e.g. .sxdata and .gfids). Such sections aren't written to the output file directly, so their RVA is 0, and the loop would thus fail to find an output section for them, resulting in a segfault. Extend some existing tests to cover this case. Fixes PR37584. Differential Revision: https://reviews.llvm.org/D47391 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@333450 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-29[COFF] Update CV register names.Jonas Devlieghere
Update tests to use the new prefix for CodeView registers added in r333421. git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@333425 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-29[PPC64] Support General-Dynamic tls.Sean Fertile
Adds handling of all the relocation types for general-dynamic thread local storage. Differential Revision: https://reviews.llvm.org/D47325 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@333420 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-29[ELF][MIPS] Add test case to cover handling of microMIPS relocations in ↵Simon Atanasyan
64-bit mode git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@333418 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-25Fix retpoline PLT for x86-64 when used for >4GB address.Rui Ueyama
Previously, we wrote only the least significant 32 bits. git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@333313 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-25Add a comment for retpoline PLT.Rui Ueyama
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@333312 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-25Fix a bug that we truncated GOTPLT entries to 32 bits.Rui Ueyama
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@333294 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-25Add llvm-bcanalyzer as an LLD test dependencyJames Henderson
Recently an LLD test change was made that introduced the use of llvm-bcanalyzer. This change adds the tool to the list of LLD test dependencies. Reviewed by: rdhindsa, ruiu Patch by Owen Reynolds. git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@333277 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-24Fix regex in lld ppc64-ifunc test.Sean Fertile
One of the regexes for reading in a hex address was missing the a-f part. git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@333209 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-24[PPC64] Set the IRelative relocation type.Sean Fertile
Set the IRelative relocation type and extend the related test to verify. Differential Revision: https://reviews.llvm.org/D46877 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@333203 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-24[PPC64] Add .toc section after .got sectionZaara Syeda
PPC64 maintains a compiler managed got in the .toc section. When accessing a global variable through got-indirect access, a .toc entry is created for the variable. The relocation for the got-indirect access will refer to the .toc section rather than the symbol that is actually accessed. The .toc entry contains the address of the global variable. We evaluate the offset from r2 (which is the TOC base) to the address of the toc entry for the global variable. Currently, the .toc is not near the .got. This causes errors because the offset from r2 to the toc section is too large. The linker needs to add all the .toc input sections to the .got output section, merging the compiler managed got with the linker got. This ensures that the offsets from the TOC base to the toc entries are not too large. This patch puts the .toc section right after the .got section. Differential Revision: https://reviews.llvm.org/D45833 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@333199 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-23Revert "[ELF] Simplify. NFC"Fangrui Song
This reverts commit cc6f052261096dc9d4c9d3123e37b023c3e171df. git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@333099 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-23Replace last DEBUG occurrence with LLVM_DEBUG in lld.Nicola Zaghen
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@333084 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-23ELF: Do not ICF sections named with a C identifier.Peter Collingbourne
A user program may enumerate sections named with a C identifier using __start_* and __stop_* symbols. We cannot ICF any such sections because that could change program semantics. Differential Revision: https://reviews.llvm.org/D47242 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@333054 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-23ELF: Do not ICF two sections with different output sections.Peter Collingbourne
Note that this doesn't do the right thing in the case where there is a linker script. We probably need to move output section assignment before ICF to get the correct behaviour here. Differential Revision: https://reviews.llvm.org/D47241 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@333052 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-23[WebAssembly] Fix crash when relocation synbol is not liveSam Clegg
When a symbol is GC'd it can still be references by relocations in the debug sections, but such symbols are not assigned virtual addresses. This change adds a new global data symbol which gets GC'd but should still appears in the output debug info, albeit with a 0 address. Fixes 37555 Differential Revision: https://reviews.llvm.org/D47238 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@333047 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-22Add missing REQUIRES: x86.Peter Collingbourne
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@333043 91177308-0d34-0410-b5e6-96231b3b80d8