Commit Graph

5000 Commits

Author SHA1 Message Date
Nico Weber 38170e444f lld/coff: Make assoc comdat diag a bit more detailed
Many different sections can have the same name, so include the indices of the
sections mentioned in the diagnostic too.

I'm debugging something I can't repro locally, maybe this will help.

llvm-svn: 352428
2019-01-28 21:16:15 +00:00
Peter Collingbourne ff35dbac47 ELF: Set sh_info on RelaIplt to point to the IgotPlt output section.
Previously we were setting it to the GotPlt output section, which is
incorrect on ARM where this section is in .got. In static binaries
this can lead to sh_info being set to -1 (because there is no .got.plt)
which results in various tools rejecting the output file.

Differential Revision: https://reviews.llvm.org/D57274

llvm-svn: 352413
2019-01-28 19:29:41 +00:00
George Rimar 8bb8433a1a [LLD][ELF] - Update tests after r352366.
r352366 "[llvm-objdump] - Print LMAs when dumping section headers." changed the format of
llvm-objdump output. We have to update the LLD tests.

llvm-svn: 352372
2019-01-28 15:03:47 +00:00
Martin Storsjo acaa78b171 [COFF] Add support for the new relocation IMAGE_REL_ARM{,64}_REL32
Differential Revision: https://reviews.llvm.org/D57292

llvm-svn: 352325
2019-01-27 19:57:50 +00:00
Nick Desaulniers 6cff0cb35a lld: elf: discard more specific .gnu.linkonce section
Summary:
lld discards .gnu.linonce.* sections work around a bug in glibc.
https://sourceware.org/bugzilla/show_bug.cgi?id=20543

Unfortunately, the Linux kernel uses a section named
.gnu.linkonce.this_module to store infomation about kernel modules. The
kernel reads data from this section when loading kernel modules, and
errors if it fails to find this section. The current behavior of lld
discards this section when kernel modules are linked, so kernel modules
linked with lld are unloadable by the linux kernel.

The Linux kernel should use a comdat section instead of .gnu.linkonce.
The minimum version of binutils supported by the kernel supports comdat
sections. The kernel is also not relying on the old linkonce behavior;
it seems to have chosen a name that contains a deprecated GNU feature.

Changing the section name now in the kernel would require all kernel
modules to be recompiled to make use of the new section name. Instead,
rather than discarding .gnu.linkonce.*, let's discard the more specific
section name to continue working around the glibc issue while supporting
linking Linux kernel modules.

Link: https://github.com/ClangBuiltLinux/linux/issues/329

Reviewers: pcc, espindola

Reviewed By: pcc

Subscribers: nathanchance, emaste, arichardson, void, srhines

Differential Revision: https://reviews.llvm.org/D57294

llvm-svn: 352302
2019-01-27 02:54:23 +00:00
Nico Weber 6bb3a1aa75 lld-link: Store comdat selection in SectionChunk, reject more invalid associated comdats
I need the comdat selection for PR40094. To keep the patch for that smaller,
I'm adding it here, and as a first application I'm using it to reject
associative comdats referring to earlier associative comdats. Depends on
D56929; together with that all associative comdats referring to other
associative comdats are now rejected.

Differential Revision: https://reviews.llvm.org/D56931

llvm-svn: 352254
2019-01-26 00:14:52 +00:00
Zachary Turner 8371da385a [PDB] Increase TPI hash bucket count.
PDBs contain several serialized hash tables. In the microsoft-pdb
repo published to support LLVM implementing PDB support, the
provided initializes the bucket count for the TPI and IPI streams
to the maximum size. This occurs in tpi.cpp L33 and tpi.cpp L398.
In the LLVM code for generating PDBs, these streams are created with
minimum number of buckets. This difference makes LLVM generated
PDBs slower for when used for debugging.

Patch by C.J. Hebert
Differential Revision: https://reviews.llvm.org/D56942

llvm-svn: 352117
2019-01-24 22:25:55 +00:00
James Y Knight c20a5767f9 Define the _fltused symbol in a couple tests post-r352076.
Normally it's defined by MSCRT, but these tests are standalone, so
they need to define it themselves.

llvm-svn: 352110
2019-01-24 21:31:43 +00:00
Rui Ueyama 18972d1ee9 Fix broken export table if .rdata is merged with .text.
Previously, we assumed that .rdata is zero-filled, so when writing
an COFF import table, we didn't write anything if the data is zero.
That assumption was wrong because .rdata can be merged with .text.
If .rdata is merged with .text, they are initialized with 0xcc which
is a trap instruction.

This patch removes that assumption from code.

Should be merged to 8.0 branch as this is a regression.

Fixes https://bugs.llvm.org/show_bug.cgi?id=39826

Differential Revision: https://reviews.llvm.org/D57168

llvm-svn: 352082
2019-01-24 19:02:31 +00:00
Nico Weber cf8baa8307 lld/coff: Rename two tests from .s to .test
llvm-svn: 352074
2019-01-24 18:30:33 +00:00
Sean Fertile 83cb252876 [PPC64] Reland r351978 'Sort .toc sections accessed with small code model ...'
Guessing that the slashes used in the scripts SECTION command was causing the
windows related failures in the added test.

Original commit message:
Small code model global variable access on PPC64 has a very limited range of
addressing. The instructions the relocations are used on add an offset in the
range [-0x8000, 0x7FFC] to the toc pointer which points to .got +0x8000, giving
an addressable range of [.got, .got + 0xFFFC]. While user code can be recompiled
with medium and large code models when the binary grows too large for small code
model, there are small code model relocations in the crt files and libgcc.a
which are typically shipped with the distros, and the ABI dictates that linkers
must allow linking of relocatable object files using different code models.

To minimze the chance of relocation overflow, any file that contains a small
code model relocation should have its .toc section placed closer to the .got
then any .toc from a file without small code model relocations.

Differential Revision: https://reviews.llvm.org/D56920

llvm-svn: 352071
2019-01-24 18:17:40 +00:00
Serge Guelton 1fa239f500 Partial support of SHT_GROUP without flag
This does *not* implement full SHT_GROUP semantic, yet it is a simple step forward:
Sections within a group are still considered valid, but they do not behave as
specified by the standard in case of garbage collection.

Differential Revision: https://reviews.llvm.org/D56437

llvm-svn: 352068
2019-01-24 17:56:08 +00:00
Sean Fertile 72679cff12 Revert "[PPC64] Sort .toc sections accessed with small code model ..."
This reverts commit ca87c57a3aa4770c9cf0defd4b2feccbc342ee93.
Added test fails on several windows buildbots.

llvm-svn: 351985
2019-01-23 21:46:28 +00:00
Sean Fertile a010cf615a [PPC64] Sort .toc sections accessed with small code model relocs close to .got.
Small code model global variable access on PPC64 has a very limited range of
addressing. The instructions the relocations are used on add an offset in the
range [-0x8000, 0x7FFC] to the toc pointer which points to .got +0x8000, giving
an addressable range of [.got, .got + 0xFFFC]. While user code can be recompiled
with medium and large code models when the binary grows too large for small code
model, there are small code model relocations in the crt files and libgcc.a
which are typically shipped with the distros, and the ABI dictates that linkers
must allow linking of relocatable object files using different code models.

To minimze the chance of relocation overflow, any file that contains a small
code model relocation should have its .toc section placed closer to the .got
then any .toc from a file without small code model relocations.

Differential Revision: https://reviews.llvm.org/D56920

llvm-svn: 351978
2019-01-23 21:04:03 +00:00
Nico Weber 8874aef822 Disable test better.
llvm-svn: 351952
2019-01-23 13:43:42 +00:00
Nico Weber 53c3c2c61c Disable test added in r351916.
It doesn't pass on Windows:
http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/3627

FAIL: lld :: ELF/stdout.s (1521 of 1966)
******************** TEST 'lld :: ELF/stdout.s' FAILED ********************
Script:
--
: 'RUN: at line 3';   C:\b\slave\clang-x64-windows-msvc\build\build\stage1\bin\llvm-mc.EXE -filetype=obj -triple=x86_64-unknown-linux C:\b\slave\clang-x64-windows-msvc\build\llvm.src\tools\lld\test\ELF\stdout.s -o C:\b\slave\clang-x64-windows-msvc\build\build\stage1\tools\lld\test\ELF\Output\stdout.s.tmp.o
: 'RUN: at line 4';   c:\b\slave\clang-x64-windows-msvc\build\build\stage1\bin\ld.lld.EXE C:\b\slave\clang-x64-windows-msvc\build\build\stage1\tools\lld\test\ELF\Output\stdout.s.tmp.o -o - > C:\b\slave\clang-x64-windows-msvc\build\build\stage1\tools\lld\test\ELF\Output\stdout.s.tmp1
: 'RUN: at line 5';   C:\b\slave\clang-x64-windows-msvc\build\build\stage1\bin\llvm-objdump.EXE -d C:\b\slave\clang-x64-windows-msvc\build\build\stage1\tools\lld\test\ELF\Output\stdout.s.tmp1 | C:\b\slave\clang-x64-windows-msvc\build\build\stage1\bin\FileCheck.EXE C:\b\slave\clang-x64-windows-msvc\build\llvm.src\tools\lld\test\ELF\stdout.s
: 'RUN: at line 10';   c:\b\slave\clang-x64-windows-msvc\build\build\stage1\bin\ld.lld.EXE C:\b\slave\clang-x64-windows-msvc\build\build\stage1\tools\lld\test\ELF\Output\stdout.s.tmp.o -o C:\b\slave\clang-x64-windows-msvc\build\build\stage1\tools\lld\test\ELF\Output\stdout.s.tmp2
: 'RUN: at line 11';   diff C:\b\slave\clang-x64-windows-msvc\build\build\stage1\tools\lld\test\ELF\Output\stdout.s.tmp1 C:\b\slave\clang-x64-windows-msvc\build\build\stage1\tools\lld\test\ELF\Output\stdout.s.tmp2
--
Exit Code: 1

Command Output (stdout):
--
$ ":" "RUN: at line 3"
$ "C:\b\slave\clang-x64-windows-msvc\build\build\stage1\bin\llvm-mc.EXE" "-filetype=obj" "-triple=x86_64-unknown-linux" "C:\b\slave\clang-x64-windows-msvc\build\llvm.src\tools\lld\test\ELF\stdout.s" "-o" "C:\b\slave\clang-x64-windows-msvc\build\build\stage1\tools\lld\test\ELF\Output\stdout.s.tmp.o"
$ ":" "RUN: at line 4"
$ "c:\b\slave\clang-x64-windows-msvc\build\build\stage1\bin\ld.lld.EXE" "C:\b\slave\clang-x64-windows-msvc\build\build\stage1\tools\lld\test\ELF\Output\stdout.s.tmp.o" "-o" "-"
$ ":" "RUN: at line 5"
$ "C:\b\slave\clang-x64-windows-msvc\build\build\stage1\bin\llvm-objdump.EXE" "-d" "C:\b\slave\clang-x64-windows-msvc\build\build\stage1\tools\lld\test\ELF\Output\stdout.s.tmp1"
$ "C:\b\slave\clang-x64-windows-msvc\build\build\stage1\bin\FileCheck.EXE" "C:\b\slave\clang-x64-windows-msvc\build\llvm.src\tools\lld\test\ELF\stdout.s"
$ ":" "RUN: at line 10"
$ "c:\b\slave\clang-x64-windows-msvc\build\build\stage1\bin\ld.lld.EXE" "C:\b\slave\clang-x64-windows-msvc\build\build\stage1\tools\lld\test\ELF\Output\stdout.s.tmp.o" "-o" "C:\b\slave\clang-x64-windows-msvc\build\build\stage1\tools\lld\test\ELF\Output\stdout.s.tmp2"
$ ":" "RUN: at line 11"
$ "diff" "C:\b\slave\clang-x64-windows-msvc\build\build\stage1\tools\lld\test\ELF\Output\stdout.s.tmp1" "C:\b\slave\clang-x64-windows-msvc\build\build\stage1\tools\lld\test\ELF\Output\stdout.s.tmp2"
# command output:
*** C:\b\slave\clang-x64-windows-msvc\build\build\stage1\tools\lld\test\ELF\Output\stdout.s.tmp1
--- C:\b\slave\clang-x64-windows-msvc\build\build\stage1\tools\lld\test\ELF\Output\stdout.s.tmp2
***************
*** 1 ****

llvm-svn: 351949
2019-01-23 12:35:08 +00:00
Nico Weber 0fb18e6e78 lld-link: Use just one code path to process associative comdats, reject some invalid associated comdats
Currently, if an associative comdat appears after the comdat it's associated
with it's processed immediately, else it's deferred until the end of the object
file. I found this confusing to think about while working on PR40094, so this
makes it so that associated comdats are always processed at the end of the
object file.  This seems to be perf-neutral and simpler.

Now there's a natural place to reject the associated comdats referring to later
associated comdats (associated comdats referring to associated comdats is
invalid per COFF spec) that, so reject those. (A later patch will reject
associated comdats referring to earlier comdats.)

Differential Revision: https://reviews.llvm.org/D56929

llvm-svn: 351917
2019-01-23 02:07:10 +00:00
Rui Ueyama 7c8fc8142e MemoryBlock: Do not automatically extend a given size to a multiple of page size.
Previously, MemoryBlock automatically extends a requested buffer size to a
multiple of page size because (I believe) doing it was thought to be harmless
and with that you could get more memory (on average 2KiB on 4KiB-page systems)
"for free".

That programming interface turned out to be error-prone. If you request N
bytes, you usually expect that a resulting object returns N for `size()`.
That's not the case for MemoryBlock.

Looks like there is only one place where we take the advantage of
allocating more memory than the requested size. So, with this patch, I
simply removed the automatic size expansion feature from MemoryBlock
and do it on the caller side when needed. MemoryBlock now always
returns a buffer whose size is equal to the requested size.

Differential Revision: https://reviews.llvm.org/D56941

llvm-svn: 351916
2019-01-23 02:03:26 +00:00
Rui Ueyama 4063cfc745 FileOutputBuffer: Handle "-" as stdout.
I was honestly a bit surprised that we didn't do this before. This
patch is to handle "-" as the stdout so that if you pass `-o -` to
lld, for example, it writes an output to stdout instead of file `-`.

I thought that we might want to handle this at a higher level than
FileOutputBuffer, because if we land this patch, we can no longer
create a file whose name is `-` (there's a workaround though; you can
pass `./-` instead of `-`). However, because raw_fd_ostream already
handles `-` as a special file name, I think it's okay and actually
consistent to handle `-` as a special name in FileOutputBuffer.

Differential Revision: https://reviews.llvm.org/D56940

llvm-svn: 351852
2019-01-22 18:44:04 +00:00
James Henderson b88d6fd7b8 [LLD][ELF]Fix tests for D56910
r351789 changes the output of llvm-readelf --dyn-symbols. This causes 3
LLD tests to break. This patch fixes them.

Reviewed by: ruiu

Differential Revision: https://reviews.llvm.org/D56911

llvm-svn: 351790
2019-01-22 09:35:47 +00:00
Nico Weber b166d7e725 Use llvm_canonicalize_cmake_booleans for LLVM_LIBXML2_ENABLED [lld]
r291284 added a nice mechanism to consistently pass CMake on/off toggles to
lit. This change uses it for LLVM_LIBXML2_ENABLED too (which was added around
the same time and doesn't use the new system yet).

No intended behavior change.

Differential Revision: https://reviews.llvm.org/D56912

llvm-svn: 351614
2019-01-19 00:09:43 +00:00
Wouter van Oortmerssen 7ab15a79be [WebAssembly] Changed objdump output to offsets instead of indices.
Summary: This is to accommodate this change: https://reviews.llvm.org/D56684

Reviewers: sbc100

Subscribers: dschuff, jgravelle-google, aheejin, sunfish, llvm-commits

Differential Revision: https://reviews.llvm.org/D56687

llvm-svn: 351462
2019-01-17 18:30:35 +00:00
Peter Wu 5391489674 [ELF][X86_64] Fix corrupted LD -> LE optimization for TLS without PLT
The LD -> LE optimization for Thread-Local Storage without PLT requires
an additional "66" prefix, otherwise the next instruction will be
corrupted, causing runtime misbehavior (crashes) of the linked object.

The other (GD -> IE/LD) optimizations are the same with or without PLT,
but add tests for completeness. The instructions are copied from
https://raw.githubusercontent.com/wiki/hjl-tools/x86-psABI/x86-64-psABI-1.0.pdf#subsection.11.1.2

This does not try to address ILP32 (x32) support.

Fixes https://bugs.llvm.org/show_bug.cgi?id=37303

Reviewed By: ruiu

Differential Revision: https://reviews.llvm.org/D56779

llvm-svn: 351396
2019-01-16 23:28:51 +00:00
Peter Smith e8374614c9 [ELF][AArch64] Add R_AARCH64_PLT_PAGE_PC to isRelExpr
As a follow on to D56666 (r351186) there is a case when taking the address
of an ifunc when linking -pie that can generate a spurious can't create
dynamic relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol in readonly
segment. Specifically the case is where the ifunc is in the same
translation unit as the address taker, so given -fpie the compiler knows
the ifunc is defined in the executable so it can use a non-got-generating
relocation.

The error message is due to R_AARCH64_PLT_PAGE_PC not being added to
isRelExpr, its non PLT equivalent R_AARCH64_PAGE_PC is already in
isRelExpr.

Differential Revision: https://reviews.llvm.org/D56724

llvm-svn: 351335
2019-01-16 13:24:02 +00:00
Peter Smith 13d134684f [ELF] Implement option to force PIC compatible Thunks
By default LLD will generate position independent Thunks when the --pie or
--shared option is used. Reference to absolute addresses is permitted in
other cases. For some embedded systems position independent thunks are
needed for code that executes before the MMU has been set up. The option
--pic-veneer is used by ld.bfd to force position independent thunks.
    
The patch adds --pic-veneer as the option is needed for the Linux kernel
on Arm.
    
fixes pr39886
    
Differential Revision: https://reviews.llvm.org/D55505

llvm-svn: 351326
2019-01-16 12:09:13 +00:00
Sam Clegg 6320efb4ed [WebAssembly] Store section alignment as a power of 2
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

llvm-svn: 351287
2019-01-16 01:43:21 +00:00
Rui Ueyama 6f9d49cdde Do not emit a corrupt symbol table entry for .rela_iplt_{start,end}.
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

llvm-svn: 351218
2019-01-15 18:30:23 +00:00
Peter Smith b20f993df8 [ELF][AArch64] Add missing PLT relocations to isStaticLinkTimeConstant
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

llvm-svn: 351186
2019-01-15 11:17:03 +00:00
Alexandre Ganea 27ba55914a [LLD][COFF] Support /ignore:4099. Support /ignore with comma-separated arguments.
Differential Revision: https://reviews.llvm.org/D56392

llvm-svn: 350956
2019-01-11 19:10:01 +00:00
Rui Ueyama 69e9fcef6a Remove an external test file. NFC.
llvm-svn: 350855
2019-01-10 17:57:30 +00:00
Rui Ueyama b41a6966e0 TrapInstr must be 4 bytes long. Currently we write two zeros on every two bytes.
llvm-svn: 350853
2019-01-10 17:45:56 +00:00
George Rimar 6552b29867 [LLD][ELF] - Fix tests after r350840.
D56076 (r350840) changed the llvm-objdump output.

This is a follow up commit to fix LLD test cases.

llvm-svn: 350842
2019-01-10 16:26:05 +00:00
Peter Smith 1811e48b7b [ELF] Fix ARM and Thumb V7PILongThunk overflow behavior.
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

llvm-svn: 350836
2019-01-10 16:08:23 +00:00
George Rimar ad6b88b481 [LLD][ELF] - A follow up for r350819 ("Support MSP430") : add a test case missing.
It got lost for some reason.

llvm-svn: 350833
2019-01-10 15:34:33 +00:00
Sean Fertile 3ca494b2ee Modify InputSectionBase::getLocation to add section and offset to every loc.
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

llvm-svn: 350828
2019-01-10 15:08:06 +00:00
Sean Fertile 461725b585 [PPC64] Fix RelType in checkInt and checkAlignment diagnsotics.
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

llvm-svn: 350827
2019-01-10 15:08:02 +00:00
George Rimar 0552376cc8 [LLD][ELF] - Fix the test cases after r350823.
r350823 changed the output of the llvm-objdump.

llvm-svn: 350824
2019-01-10 14:57:25 +00:00
George Rimar 73af3d4060 [LLD][ELF] - Support MSP430.
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

llvm-svn: 350819
2019-01-10 13:43:06 +00:00
George Rimar 17a9204d0c [LLD][ELF] - Fix BB after r350726.
D56123 changed the llvm-objdump output format.
Now we print the symbol address when dumping.

llvm-svn: 350728
2019-01-09 15:06:57 +00:00
Ryan Prichard d7d2369c09 [ARM][AArch64] Increase TLS alignment to reserve space for Android's TCB
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

llvm-svn: 350681
2019-01-09 00:09:59 +00:00
James Henderson 4ba1777a2d [ELF] Remove checking for spurious '@' at the end of dynamic sym names
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

llvm-svn: 350614
2019-01-08 10:50:59 +00:00
Thomas Lively 25ff893712 [WebAssembly] Instruction renaming
Summary: Associated with D56338.

Reviewers: aheejin, aardappel

Subscribers: dschuff, sbc100, jgravelle-google, sunfish, llvm-commits

Differential Revision: https://reviews.llvm.org/D56339

llvm-svn: 350610
2019-01-08 06:25:55 +00:00
Alexandre Ganea 79d4851678 [LLD][COFF] Fix file/line retrieval when a undefined symbol is to be printed
Differential Revision: https://reviews.llvm.org/D55951

llvm-svn: 350438
2019-01-04 21:49:22 +00:00
Michal Gorny ceacc63e1f [test] Enable system-linker-elf feature on NetBSD [NFC]
Since NetBSD uses ELF linker, enable the relevant feature.  It's not
currently used for anything, though.

llvm-svn: 350253
2019-01-02 19:39:26 +00:00
Thomas Anderson 4a401e9479 Fix linker-defined symbols possibly not being defined when -wrap is used
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

llvm-svn: 350251
2019-01-02 19:28:00 +00:00
Fangrui Song 50394f6e01 [ELF] A shared object is needed if any of its occurrences is needed
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

llvm-svn: 350105
2018-12-27 22:24:45 +00:00
Rui Ueyama 56c5343e5a Use error() instead of fatal() to report an invalid address range.
In this patch we also use toString() to stringize a section.

llvm-svn: 350070
2018-12-26 19:15:04 +00:00
George Rimar 4c66df8584 [LLD][ELF] - Cleanup gdb-index-dwarf5-low-high.s. NFC.
Remove tabs and .debug_macinfo sections.

llvm-svn: 350051
2018-12-24 10:18:07 +00:00
Kamil Rytarowski ae1ab910cd Tolerate flaky LLD tests on NetBSD
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

llvm-svn: 350036
2018-12-23 21:20:09 +00:00
David Blaikie 7c282bf66d Test DWARFv5 with gdb-index and low_pc/high_pc on the CU (rather than ranges)
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.

llvm-svn: 350011
2018-12-22 22:20:47 +00:00