aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2019-03-01Revert two changes that break Android builds.HEADmastermainllvm-r353983Chih-Hung Hsieh
* Earlier versions of lld were able to replace Android's lld.gold and link most files. * With two recent lld changes, debuggerd_test64 and some other files failed to link because libunwindstack.a is linked like --whole-archive. We need to revert the following two changes: * "Put undefined symbols from shared libraries in the symbol table." lld/trunk@326242 * "Make undefined symbol in DSO to pull out object files from archive files." lld/trunk@325849 Bug: 74755833 Change-Id: I21b0df5e3c19bdfff4ea6c0ff9e9e562bd73f921
2019-02-27Merge 14aa57da0 for LLVM update to 353983Yi Kong
Change-Id: Iee1792355bab030d81eb4cb645257dbac2537641
2019-02-27 revert to previous base llvm-svn.349610Yi Kong
Change-Id: Ib0010bb41abcf296cd09c0808410dce0c5ccbfd6
2019-02-13ELF: Allow GOT relocs pointing to non-preemptable ifunc to resolve to an ↵Peter Collingbourne
IRELATIVE where possible. Non-GOT non-PLT relocations to non-preemptible ifuncs result in the creation of a canonical PLT, which now takes the identity of the IFUNC in the symbol table. This (a) ensures address consistency inside and outside the module, and (b) fixes a bug where some of these relocations end up pointing to the resolver. Fixes (at least) PR40474 and PR40501. Differential Revision: https://reviews.llvm.org/D57371 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@353981 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-13Recover elf32-bigmips and elf32-powerpc support in LLDRui Ueyama
This fixes a 7.0 -> 8.0 regression when parsing OUTPUT_FORMAT("elf32-powerpc"); or elf32-bigmips directive in ldscripts as well as an unknown emulation error when lld is invoked by clang due to missed elf32ppclinux case. Patch by vit9696 Differential Revision: https://reviews.llvm.org/D58005 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@353968 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-13Show "Unknown -z option" error message even if --version or --help are given.Rui Ueyama
Previously, we validated -z options after we process --version or --help flags. So, if one of these flags is given, we wouldn't show an "unknown -z option" error. This patch fixes that behavior. Differential Revision: https://reviews.llvm.org/D55446 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@353967 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-12[PPC64] Update tests to reflect change in printing of call operand. [NFC]Sean Fertile
The printing of branch operands for call instructions was changed to properly handle negative offsets. Updating the tests to reflect that. git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@353866 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-12[PPC64] Sort .toc sections accessed with small code model relocs.Sean Fertile
A follow up to the intial patch that unblocked linking against libgcc. For lld we don't need to bother tracking which objects have got based small code model relocations. This is due to the fact that the compilers on powerpc64 use the .toc section to generate indirections to symbols (rather then using got relocations) which keeps the got small. This makes overflowing a small code model got relocation very unlikely. Differential Revision: https://reviews.llvm.org/D57245 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@353849 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-11lld: unquote possibly quoted `EXTERN("symbol")` entry in linker script.Rui Ueyama
gold accepts quoted strings. binutils requires quoted strings for some kinds of symbols, e.g.: it accepts quoted symbols with @ in name: $ echo 'EXTERN("__libc_start_main@@GLIBC_2.2.5")' > a.script $ g++ a.script /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crt1.o: In function `_start': (.text+0x20): undefined reference to `main' collect2: error: ld returned 1 exit status but rejects them if unquoted: $ echo 'EXTERN(__libc_start_main@@GLIBC_2.2.5)' > a.script $ g++ a.script a.script: file not recognized: File format not recognized collect2: error: ld returned 1 exit status To maintain compatibility with existing linker scripts support quoted strings in lld as well. Patch by Lucian Adrian Grijincu. Differential Revision: https://reviews.llvm.org/D57987 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@353756 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-11Convert CRLF. NFC.Rui Ueyama
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@353751 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-09[LLD][ELF] - Update test case after yaml2obj change. NFCI.George Rimar
.dynamic section format accepted by yaml2obj was changed in r353606 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@353607 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-09[ELF] Delete a comment that is no longer correct. Fix a typo. NFCFangrui Song
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@353605 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-09[LLD][ELF] Ensure tests use -o /dev/null instead of attempting to write to ↵David L. Jones
the bin directory. [NFC] This error was introduced in r353508. git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@353602 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-08[lld-link] better error message when failing to open archive membersBob Haarman
Summary: The message "could not get the buffer for the member defining symbol" now also contains the name of the archive and the name of the archive member that we tried to open. Reviewers: ruiu Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D57974 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@353572 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-08[LLD][ELF]Add test for missing thin archive memberJames Henderson
The code producing error messages relating to missing thin archive members was missing any testing as far as I could see, so this patch adds a test for it. Reviewed by: ruiu Differential Revision: https://reviews.llvm.org/D57899 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@353508 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-07[WebAssembly] Refactor handling of weak undefined functions. NFC.Sam Clegg
Also add to the docs. This is refactor in preparation for https://reviews.llvm.org/D57909 Differential Revision: https://reviews.llvm.org/D57920 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@353478 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-07[WebAssembly] Fix imported function symbol names that differ from their ↵Dan Gohman
import names in the .o format Add a flag to allow symbols to have a wasm import name which differs from the linker symbol name, allowing the linker to link code using the import_module attribute. Differential Revision: https://reviews.llvm.org/D57632 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@353473 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-07[WebAssembly] Improve docs for wasm linkerSam Clegg
Differential Revision: https://reviews.llvm.org/D57913 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@353451 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-07Fix a bug in R_X86_64_PC{8,16} relocation handling.Rui Ueyama
R_X86_64_PC{8,16} relocations are sign-extended, so when we check for relocation overflow, we had to use checkInt instead of checkUInt. I confirmed that GNU linkers create the same output for the test case. git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@353437 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-07docs: add missingkeyfunction to doctree, fix titleHans Wennborg
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@353399 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-07[LLD][ELF] - Set DF_STATIC_TLS flag for X64 targetGeorge Rimar
This is the same as D57749, but for x64 target. "ELF Handling For Thread-Local Storage" p41 says (https://www.akkadia.org/drepper/tls.pdf): R_X86_64_GOTTPOFF relocation is used for IE TLS models. Hence if linker sees this relocation we should add DF_STATIC_TLS flag. Differential revision: https://reviews.llvm.org/D57821 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@353378 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-07[WebAssembly] Honor WASM_SYMBOL_EXPORT symbol flagSam Clegg
This flag means that symbol should be exported in the final binary. The reason for this change is to allow source level annotations to trigger a given symbol to be exported: https://github.com/emscripten-core/emscripten/issues/7702 Differential Revision: https://reviews.llvm.org/D57869 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@353364 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-07[WebAssembly] Update test expectations to match llvm-readobj change. NFC.Sam Clegg
Differential Revision: https://reviews.llvm.org/D57868 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@353358 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-06[MinGW] Add --insert-timestamp as complement to the --no-insert-timestamp optionMartin Storsjo
Differential Revision: https://reviews.llvm.org/D57808 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@353342 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-06Correct "varaible" typo in commentEd Maste
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@353340 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-06Remove a small header that is used only by one file. NFC.Rui Ueyama
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@353331 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-06Add comment.Rui Ueyama
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@353323 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-06Support R_X86_64_PC8 and R_X86_64_PC16.Rui Ueyama
They are defined by the x86-64 ELF ABI standard. Differential Revision: https://reviews.llvm.org/D57799 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@353314 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-06Recommit r353293 "[LLD][ELF] - Set DF_STATIC_TLS flag for i386 target."George Rimar
With the following changes: 1) Compilation fix: std::atomic<bool> HasStaticTlsModel = false; -> std::atomic<bool> HasStaticTlsModel{false}; 2) Adjusted the comment in code. Initial commit message: DF_STATIC_TLS flag indicates that the shared object or executable contains code using a static thread-local storage scheme. Patch checks if IE/LE relocations were used to check if the code uses a static model. If so it sets the DF_STATIC_TLS flag. Differential revision: https://reviews.llvm.org/D57749 ---- Modified : /lld/trunk/ELF/Arch/X86.cpp Modified : /lld/trunk/ELF/Config.h Modified : /lld/trunk/ELF/SyntheticSections.cpp Added : /lld/trunk/test/ELF/Inputs/i386-static-tls-model1.s Added : /lld/trunk/test/ELF/Inputs/i386-static-tls-model2.s Added : /lld/trunk/test/ELF/Inputs/i386-static-tls-model3.s Added : /lld/trunk/test/ELF/Inputs/i386-static-tls-model4.s Added : /lld/trunk/test/ELF/i386-static-tls-model.s Modified : /lld/trunk/test/ELF/i386-tls-ie-shared.s Modified : /lld/trunk/test/ELF/tls-dynamic-i686.s Modified : /lld/trunk/test/ELF/tls-opt-iele-i686-nopic.s git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@353299 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-06Revert r353293 "[LLD][ELF] - Set DF_STATIC_TLS flag for i386 target."George Rimar
It broke BB: http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/43450 http://lab.llvm.org:8011/builders/lld-x86_64-freebsd/builds/27891 Error is: tools/lld/ELF/Config.h:84:41: error: copying member subobject of type 'std::atomic<bool>' invokes deleted constructor std::atomic<bool> HasStaticTlsModel = false; git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@353297 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-06[LLD][ELF] - Set DF_STATIC_TLS flag for i386 target.George Rimar
DF_STATIC_TLS flag indicates that the shared object or executable contains code using a static thread-local storage scheme. Patch checks if IE/LE relocations were used to check if the code uses a static model. If so it sets the DF_STATIC_TLS flag. Differential revision: https://reviews.llvm.org/D57749 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@353293 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-06[ELF][ARM] Add test case that will fail if toPlt() is removed [NFC]Peter Smith
When a thunk is created to a PLT entry, the call to the thunk is converted to a non-plt expression with fromPlt(). If the thunk becomes unusable we retarget the relocation back to its original target and try again. When we do this we need to make sure that we restore the PLT form of the expression with toPlt(). This change adds a test case that will fail if toPlt() is removed. We need to have a call to a preemptible symbol defined within the link unit. If toPlt() is removed then the relocation to the thunk to the PLT entry for the preemptible symbol will be retargeted to the preemptible symbol itself instead of its PLT entry. Differential Revision: https://reviews.llvm.org/D57743 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@353285 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-06[wasm-ld] Fix wasm trace test to use %t for temporary files.David L. Jones
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@353272 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-06[WebAssembly] Implement --trace and --trace-symbolSam Clegg
Differential Revision: https://reviews.llvm.org/D57725 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@353264 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-06[PPC64] Delete the unnecessary __tls_get_addr from ppc64-tls-ld-le.sFangrui Song
The definition is harmful here as it suppresses R_PPC64_REL24 which is supposed to follow R_PPC64_TLSLD. git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@353263 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-06[PPC64] Set the number of relocations processed for R_PPC64_TLS[GL]D to 2Fangrui Song
Summary: R_PPC64_TLSGD and R_PPC64_TLSLD are used as markers on TLS code sequences. After GD-to-IE or GD-to-LE relaxation, the next relocation R_PPC64_REL24 should be skipped to not create a false dependency on __tls_get_addr. When linking statically, the false dependency may cause an "undefined symbol: __tls_get_addr" error. R_PPC64_GOT_TLSGD16_HA R_PPC64_GOT_TLSGD16_LO R_PPC64_TLSGD R_TLSDESC_CALL R_PPC64_REL24 __tls_get_addr Reviewers: ruiu, sfertile, syzaara, espindola Reviewed By: sfertile Subscribers: emaste, nemanjai, arichardson, kbarton, jsji, llvm-commits, tamur Tags: #llvm Differential Revision: https://reviews.llvm.org/D57673 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@353262 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-06[ELF] Fix typo in test/ELF/trace.sSam Clegg
Differential Revision: https://reviews.llvm.org/D57796 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@353254 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-06[PDB] Remove dots and normalize slashes with /PDBSOURCEPATH.Zachary Turner
In a previous patch, I made changes so that PDBs which were generated on non-Windows platforms contained sensical paths for the host. While this is an esoteric use case, we need it to be supported for certain cross compilation scenarios especially with LLDB, which can debug things on non-Windows platforms. However, this regressed a case where you specify /PDBSOURCEPATH and use a windows-style path. Previously, we would still remove dots and canonicalize slashes to backslashes, but since my change intentionally tried to support non-backslash paths, this was broken. This patch fixes the situation by trying to guess which path style the user is specifying when /PDBSOURCEPATH is passed. It is intentionally conservative, erring on the side of a Windows path style unless absolutely certain. All dots are removed and slashes canonicalized to whatever the deduced path style is after appending the file path to the /PDBSOURCEPATH argument. Differential Revision: https://reviews.llvm.org/D57769 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@353250 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-05[llvm-readobj] Display sections that do not belong to a segment in the ↵Matt Davis
section-mapping Summary: The following patch adds the "None" line to the section to segment mapping dump. That line lists the sections that do not belong to any segment. I realize that this change differs from GNU readelf which does not display the latter information. I'd rather not add this "feature" under a command line option. I think that might introduce confusion, since users would have to make an additional decision as to if they want to see all of the section-to-segment map or just a subset of it. Another option is to only print the "None" line if the `--section-mapping` option is passed; however, that might also introduce some confusion, because the section-to-segment map would be different between`--program-headers` and the `--section-mapping` output. While the difference is just the "None" line, it seems that if we choose to display the segment-to-section mapping, then we should always display the whole map including the sections that do not belong to segments. ``` Section to Segment mapping: Segment Sections... 00 01 .interp 02 .interp .note.ABI-tag .gnu.hash 03 .init_array .fini_array .dynamic 04 .dynamic 05 .note.ABI-tag 06 .eh_frame_hdr 07 08 .init_array .fini_array .dynamic .got None .comment .symtab .strtab .shstrtab <--- THIS LINE ``` Reviewers: grimar, rupprecht, jhenderson, espindola Reviewed By: rupprecht Subscribers: khemant, emaste, arichardson, llvm-commits Differential Revision: https://reviews.llvm.org/D57700 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@353217 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-05Inline a trivial function and update comment. NFC.Rui Ueyama
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@353200 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-05[WebAssembly] Use wasm-ld rather than lld with -flavor in tests. NFC.Sam Clegg
Differential Revision: https://reviews.llvm.org/D57758 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@353187 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-05[COFF] Avoid O(n^2) accesses into PartialSectionsMartin Storsjo
For MinGW, unique partial sections are much more common, e.g. comdat functions get sections named e.g. text$symbol. A moderate sized example of this contains over 200K Chunks which create 174K unique PartialSections. Prior to SVN r352928 (D57574), linking this took around 1,5 seconds for me, while it afterwards takes around 13 minutes. After this patch, the linking time is back to what it was before. The std::find_if in findPartialSection will do a linear scan of the whole container until a match is found. To use something like binary_search or the std::set container's own methods, we'd need to already have a PartialSection*. Reinstate a proper map instead of having a set with a custom sorting comparator. Differential Revision: https://reviews.llvm.org/D57666 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@353146 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-05[MinGW] Hook up the --no-insert-timestamp optionMartin Storsjo
This fixes PR40582. Patch by Georg Koppen! Differential Revision: https://reviews.llvm.org/D57679 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@353145 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-04[WebAssembly] Update test to match new readobj output. NFC.Sam Clegg
Differential Revision: https://reviews.llvm.org/D57715 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@353105 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-04[WebAssembly] clang-tidy (NFC)Heejin Ahn
Summary: This patch fixes clang-tidy warnings on wasm-only files. The list of checks used is: `-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,readability-identifier-naming,modernize-*` (LLVM's default .clang-tidy list is the same except it does not have `modernize-*`.) The list of fixes are: - Variable names start with an uppercase letter - Function names start with a lowercase letter - Use `auto` when you use casts so the type is evident Reviewers: sbc100 Subscribers: dschuff, jgravelle-google, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D57499 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@353076 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-04[WebAssembly] Update relocation naming to match llvm change. NFC.Sam Clegg
Differential Revision: https://reviews.llvm.org/D57698 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@353066 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-02[ELF] Default to --no-allow-shlib-undefined for executablesFangrui Song
Summary: This follows the ld.bfd/gold behavior. The error check is useful as it captures a common type of ld.so undefined symbol errors as link-time errors: // a.cc => a.so (not linked with -z defs) void f(); // f is undefined void g() { f(); } // b.cc => executable with a DT_NEEDED entry on a.so void g(); int main() { g(); } // ld.so errors when g() is executed (lazy binding) or when the program is started (-z now) // symbol lookup error: ... undefined symbol: f Reviewers: ruiu, grimar, pcc, espindola Reviewed By: ruiu Subscribers: llvm-commits, emaste, arichardson Tags: #llvm Differential Revision: https://reviews.llvm.org/D57569 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@352943 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-01[COFF] Create range extension thunks for ARM64Martin Storsjo
On ARM64, this is normally necessary only after a module exceeds 128 MB in size (while the limit for thumb is 16 MB). For conditional branches, the range limit is only 1 MB though (the same as for thumb), and for the tbz instruction, the range is only 32 KB, which allows for a test much smaller than the full 128 MB. This fixes PR40467. Differential Revision: https://reviews.llvm.org/D57575 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@352929 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-01[COFF] Fix crashes when writing a PDB after adding thunks.Martin Storsjo
When writing a PDB, the OutputSection of all chunks need to be set. The thunks are added directly to OutputSection after the normal machinery that sets it for all other chunks. This fixes part of PR40467. Differential Revision: https://reviews.llvm.org/D57574 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@352928 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-01Fix some sphinx doc errors.James Y Knight
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@352887 91177308-0d34-0410-b5e6-96231b3b80d8