summaryrefslogtreecommitdiff
path: root/lld
AgeCommit message (Collapse)Author
2019-01-16[WebAssembly] Store section alignment as a power of 2Sam Clegg
This change bumps for version number of the wasm object file metadata. See https://github.com/WebAssembly/tool-conventions/pull/92 Differential Revision: https://reviews.llvm.org/D56762
2019-01-15Do not emit a corrupt symbol table entry for .rela_iplt_{start,end}.Rui Ueyama
If .rela.iplt does not exist, we used to emit a corrupt symbol table that contains two symbols, .rela_iplt_{start,end}, pointing to a nonexisting section. This patch fixes the issue by setting section index 0 to the symbols if .rel.iplt section does not exist. Differential Revision: https://reviews.llvm.org/D56623
2019-01-15Update year in license filesHans Wennborg
In last year's update (D48219) it was suggested that the release manager might want to do this, so here we go.
2019-01-15[ELF][AArch64] Add missing PLT relocations to isStaticLinkTimeConstantPeter Smith
r347650 fixed pr38074 for AArch64 for static linking. It added two new RelExpr instances R_AARCH64_GOT_PAGE_PC_PLT and R_GOT_PLT. These need to be added to isStaticLinkTimeConstant so that the address of an ifunc can be taken when building a shared library. fixes pr40250 Differential Revision: https://reviews.llvm.org/D56666
2019-01-14lld-link: Spelling fixes in comments and minor style tweaksNico Weber
Changes a few things I noticed while reading this code. - fix a few typos in comments - remove two `auto` uses where the type wasn't clear to me - add comment saying that two sequential checks for `if (SparseChunks[SectionNumber] == PendingComdat)` are intentional - name two parameters No behavior change. Differential Revision: https://reviews.llvm.org/D56677
2019-01-14lld/include/lld/Core/TODO.txtNico Weber
- fix minor grammar stuff (I'm not a native speaker either, but it's hopefully a net improvement) - mention that lld/coff is used in production - update AArch64, ARM to production quality - remove lld/include/lld/Core/TODO.txt which looks outdated Differential Revision: https://reviews.llvm.org/D56600
2019-01-11Add a release note about MSP430 support.Rui Ueyama
2019-01-11Fix unchecked Error introduced in r350956Alexandre Ganea
2019-01-11[LLD][COFF] Support /ignore:4099. Support /ignore with comma-separated ↵Alexandre Ganea
arguments. Differential Revision: https://reviews.llvm.org/D56392
2019-01-10Remove an external test file. NFC.Rui Ueyama
2019-01-10TrapInstr must be 4 bytes long. Currently we write two zeros on every two bytes.Rui Ueyama
2019-01-10[LLD][ELF] - Fix tests after r350840.George Rimar
D56076 (r350840) changed the llvm-objdump output. This is a follow up commit to fix LLD test cases.
2019-01-10[ELF] Fix ARM and Thumb V7PILongThunk overflow behavior.Peter Smith
When the range between the source and target of a V7PILongThunk exceeded an int32 we would trigger a relocation out of range error for the R_ARM_MOVT_PREL or R_ARM_THM_MOVT_PREL relocation. This case can happen when linking the linux kernel as it is loaded above 0xf0000000. There are two parts to the fix. - Remove the overflow check for R_ARM_MOVT_PREL or R_ARM_THM_MOVT_PREL. The ELF for the ARM Architecture document defines these relocations as having no overflow checking so the check was spurious. - Use int64_t for the offset calculation, in line with similar thunks so that PC + (S - P) < 32-bits. This results in less surprising disassembly. Differential Revision: https://reviews.llvm.org/D56396
2019-01-10[LLD][ELF] - A follow up for r350819 ("Support MSP430") : add a test case ↵George Rimar
missing. It got lost for some reason.
2019-01-10Modify InputSectionBase::getLocation to add section and offset to every loc.Sean Fertile
The section and offset can be very helpful in diagnosing certian errors. For example on a relocation overflow or misalignment diagnostic: test.c:(function foo): relocation R_PPC64_ADDR16_DS out of range: ... The function foo can have many R_PPC64_ADDR16_DS relocations. Adding the offset and section will identify exactly which relocation is causing the failure. Differential Revision: https://reviews.llvm.org/D56453
2019-01-10[PPC64] Fix RelType in checkInt and checkAlignment diagnsotics.Sean Fertile
In the PPC64 target we map toc-relative relocations, dynamic thread pointer relative relocations, and got relocations into a corresponding ADDR16 relocation type for handling in relocateOne. This patch saves the orignal RelType before mapping to an ADDR16 relocation so that any diagnostic messages will not mistakenly use the mapped type. Differential Revision: https://reviews.llvm.org/D56448
2019-01-10[LLD][ELF] - Fix the test cases after r350823.George Rimar
r350823 changed the output of the llvm-objdump.
2019-01-10[LLD][ELF] - Support MSP430.George Rimar
Patch by Michael Skvortsov! This change adds a basic support for linking static MSP430 ELF code. Implemented relocation types are intended to correspond to the BFD. Differential revision: https://reviews.llvm.org/D56535
2019-01-09Fix formatting. NFC.Rui Ueyama
2019-01-09lld-link: Add help strings for /manifest, /nodefaultlib, /noentry; tweak ↵Nico Weber
manifest help strings My main motivation is that I can never remember /nodefaultlib and `lld-link /? | grep no` didn't display it due to it not having a help string. Differential Revision: https://reviews.llvm.org/D56502
2019-01-09[LLD][ELF] - Fix BB after r350726.George Rimar
D56123 changed the llvm-objdump output format. Now we print the symbol address when dumping.
2019-01-09[ARM][AArch64] Increase TLS alignment to reserve space for Android's TCBRyan Prichard
ARM and AArch64 use TLS variant 1, where the first two words after the thread pointer are reserved for the TCB, followed by the executable's TLS segment. Both the thread pointer and the TLS segment are aligned to at least the TLS segment's alignment. Android/Bionic historically has not supported ELF TLS, and it has allocated memory after the thread pointer for several Bionic TLS slots (currently 9 but soon only 8). At least one of these allocations (TLS_SLOT_STACK_GUARD == 5) is widespread throughout Android/AArch64 binaries and can't be changed. To reconcile this disagreement about TLS memory layout, set the minimum alignment for executable TLS segments to 8 words on ARM/AArch64, which reserves at least 8 words of memory after the TP (2 for the ABI-specified TCB and 6 for alignment padding). For simplicity, and because lld doesn't know when it's targeting Android, increase the alignment regardless of operating system. Differential Revision: https://reviews.llvm.org/D53906
2019-01-08[ELF] Remove checking for spurious '@' at the end of dynamic sym namesJames Henderson
llvm-readobj currently has a bug (see PR40097) where it prints '@' at the end of unversioned dynamic symbols. This bug will be fixed in a separate later commit, but these tests need fixing first. Reviewed by: ruiu, Higuoxing Differential Revision: https://reviews.llvm.org/D56388
2019-01-08[WebAssembly] Instruction renamingThomas Lively
Summary: Associated with D56338. Reviewers: aheejin, aardappel Subscribers: dschuff, sbc100, jgravelle-google, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D56339
2019-01-07[CodeView] More appropriate name and type for a Microsoft precompiled ↵Alexandre Ganea
headers parameter. NFC
2019-01-05[docs] Add a known limitation to the comment about lld supporting GCC/MinGW ↵Martin Storsjo
object files. NFC. Differential Revision: https://reviews.llvm.org/D56335
2019-01-05[MinGW] Expand comment for MinGW driver. NFC.Martin Storsjo
Originally authored by Rui Ueyama. Differential Revision: https://reviews.llvm.org/D53031
2019-01-05[LLD][COFF] PDB: Parallel sort publicsAlexandre Ganea
Saves up to 1.3 sec on large PDBs. Figures below are for the "Globals Stream Layout" pass: Before This patch Large EXE (PDB is ~2 GB) 3330 ms 2022 ms Large EXE (PDB is ~2 GB) 2680 ms 1608 ms Large DLL (PDB is ~1 GB) 1455 ms 938 ms Large DLL (PDB is ~800 MB) 1215 ms 800 ms Small DLL (PDB is ~200 MB) 224 ms 146 ms Differential Revision: https://reviews.llvm.org/D56334
2019-01-05[LLD][COFF] Fix namespace compilation issue with a upcoming patch. NFCAlexandre Ganea
2019-01-04[LLD][COFF] Fix file/line retrieval when a undefined symbol is to be printedAlexandre Ganea
Differential Revision: https://reviews.llvm.org/D55951
2019-01-02[test] Enable system-linker-elf feature on NetBSD [NFC]Michal Gorny
Since NetBSD uses ELF linker, enable the relevant feature. It's not currently used for anything, though.
2019-01-02Fix linker-defined symbols possibly not being defined when -wrap is usedThomas Anderson
Fixes https://bugs.llvm.org/show_bug.cgi?id=40134 addWrappedSymbols() must be called before addReservedSymbols() because the latter only defines reserved symbols when they are undefined in the symbol table. If addWrappedSymbols() is called after, then addUndefined() is called which may lazily pull in more object files that could reference reserved symbols. Differential Revision: https://reviews.llvm.org/D56110
2018-12-27[ELF] A shared object is needed if any of its occurrences is neededFangrui Song
Summary: If a DSO appears more than once with and without --as-needed, ld.bfd and gold consider --no-as-needed to takes precedence over --as-needed. lld didn't and this patch makes it do so. This makes it a bit away from the position-dependent behavior (how different occurrences of the same DSO interact) and protects us from some mysterious runtime errors: if some interceptor libraries add their own --no-as-needed dependencies (e.g. librt.so), and the user application specifies -Wl,--as-needed -lrt , the absence of the DT_NEEDED entry would make dlsym(RTLD_NEXT, "clock_gettime") return NULL and would break at runtime. Reviewers: ruiu, espindola Reviewed By: ruiu Subscribers: emaste, arichardson, llvm-commits Differential Revision: https://reviews.llvm.org/D56089
2018-12-26Use error() instead of fatal() to report an invalid address range.Rui Ueyama
In this patch we also use toString() to stringize a section.
2018-12-24[LLD][ELF] - Cleanup gdb-index-dwarf5-low-high.s. NFC.George Rimar
Remove tabs and .debug_macinfo sections.
2018-12-23Tolerate flaky LLD tests on NetBSDKamil Rytarowski
Summary: For unknown reasons LLD tests are flaky on the NetBSD buildbot, but not on local machines of developers. Unless the linker will be fully functional on this target, allow to pass flaky tests with optional retry. Reviewers: joerg, mgorny, ruiu Reviewed By: mgorny Subscribers: lebedev.ri, MaskRay, llvm-commits, #lld Tags: #lld Differential Revision: https://reviews.llvm.org/D56053
2018-12-22Test DWARFv5 with gdb-index and low_pc/high_pc on the CU (rather than ranges)David Blaikie
There was a bug in LLVM's libDebugInfo where it did not porpagate the section index through the range query built from low_pc/high_pc. Hard to test in LLVM, so I'm adding a test here.
2018-12-22gdb-index: Handle errors when parsing rangesDavid Blaikie
When parsing CU ranges for gdb-index, handle the error (now propagated up though the API lld is calling here - previously the error was printed within the libDebugInfo API, not allowing lld to format or handle the message at all) - including information about the object and archive name, as well as failing the link.
2018-12-21keymethod -> keyfunctionFangrui Song
Pointed out by ruiu in rLLD349969
2018-12-21key method -> key functionFangrui Song
The latter is what is actually called in the ABI http://itanium-cxx-abi.github.io/cxx-abi/abi.html#vague-vtable Pointed out by rsmith
2018-12-21[ELF] .gnu.hash bloom filter: use Shift2 = 26 instead of 6Fangrui Song
Summary: For the 2-bit bloom filter, we currently pick the bits Hash%64 and Hash>>6%64 (Shift2=6), but bits [6:...] are also used to select a word, causing a loss of precision. In this patch, we choose Shift2=26, with is suggested by Ambrose Feinstein. Note, Shift2 is computed as maskbitslog2 in bfd/elflink.c and gold/dynobj.cc It is varying with the number of dynamic symbols but we don't necessarily copy its rule. Reviewers: ruiu, espindola Reviewed By: ruiu Subscribers: emaste, arichardson, llvm-commits Differential Revision: https://reviews.llvm.org/D55971
2018-12-21Add a doc for missing key function and an error message referencing the doc.Rui Ueyama
Summary: This is a common error, and because many people don't know what the key function is, it is sometimes very confusing. The doc was originally written by Brooks Moses and slightly edited by me. Reviewers: MaskRay, espindola Subscribers: emaste, llvm-commits, arichardson Differential Revision: https://reviews.llvm.org/D55968
2018-12-20Remove dead code.Rui Ueyama
This code is no-op because of r349849. Differential Revision: https://reviews.llvm.org/D55962
2018-12-20Simplify. NFC.Rui Ueyama
2018-12-20[ELF] Move IsNeeded logic from SymbolTable::addShared to MarkLive, and check ↵Fangrui Song
IsUsedInRegularObj Summary: In glibc, libc.so is a linker script with an as-needed dependency on ld-linux-x86-64.so.2 GROUP ( /lib/x86_64-linux-gnu/libc.so.6 /usr/lib/x86_64-linux-gnu/libc_nonshared.a AS_NEEDED ( /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 ) ) ld-linux-x86-64.so.2 (as-needed) defines some symbols which resolve undefined references in libc.so.6, it will therefore be added as a DT_NEEDED entry, which isn't necessary. The test case as-needed-not-in-regular.s emulates the libc.so scenario, where ld.bfd and gold don't add DT_NEEDED for a.so The relevant code in gold/resolve.cc: // If we have a non-WEAK reference from a regular object to a // dynamic object, mark the dynamic object as needed. if (to->is_from_dynobj() && to->in_reg() && !to->is_undef_binding_weak()) to->object()->set_is_needed(); in_reg() appears to do something similar to IsUsedInRegularObj. This patch makes lld do the similar thing, but moves the check from addShared to a later stage MarkLive where all symbols are scanned. Reviewers: ruiu, pcc, espindola Reviewed By: ruiu Subscribers: emaste, arichardson, llvm-commits Differential Revision: https://reviews.llvm.org/D55902
2018-12-20[PPC64] Add toc-optimizations for got based relocations.Sean Fertile
Differential Revision: https://reviews.llvm.org/D54907
2018-12-19Simplify. NFC.Rui Ueyama
Differential Revision: https://reviews.llvm.org/D55903
2018-12-19[LLD][ELF] - Report a location for symbols from the linker script when ↵George Rimar
reporting an error. When we report an error for symbols defined in the linker script, we do not report the location properly. For example: ld.lld: error: relocation R_AARCH64_CALL26 cannot refer to absolute symbol: aliasto__text >>> defined in <internal> >>> referenced by rtoabs.o:(.text+0x4) This patch fixes that. Differential revision: https://reviews.llvm.org/D55360
2018-12-18Use unique_ptr to manage a TarWriter instance. NFC.Rui Ueyama
2018-12-18Fix error message.Rui Ueyama
Previously, this code printed out an error message like this ld.lld: error: --reproduce: failed to open /foo: cannot open /foo Apparently "failed to open /foo:" part is redundant.