Commit Graph

9745 Commits

Author SHA1 Message Date
Sam Clegg 77c1def71a Use ErrorOS for log messages as well as error
log are also diagnostics so it seems like they should to
the same place as errors and debug messages.

Without this change when I enable --verbose those messages
go to stdout, but when I enable "-mllvm -debug" those messages
go to stderr (because dbgs() goes to stderr by default).

So I end up having to do this a lot:
 lld <args> > output_message 2>&1

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

llvm-svn: 320427
2017-12-11 21:57:31 +00:00
Sam Clegg 3f1fb88afb [WebAssembly] Preserve ordering of global symbols
This change restores the behavior that global indexes
are assigned in object file order.  This was accidentally
changed in https://reviews.llvm.org/D40859.

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

llvm-svn: 320426
2017-12-11 21:52:21 +00:00
Hans Wennborg c40c5e520b Fix x86-64-reloc-8.s test after r320416.
llvm-svn: 320423
2017-12-11 21:25:22 +00:00
Alexander Richardson d2481bed05 [ELF] When a relocation is out of range print the value and the range
Reviewers: ruiu, grimar

Reviewed By: ruiu

Subscribers: emaste, nemanjai, javed.absar, kbarton, llvm-commits

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

llvm-svn: 320416
2017-12-11 20:47:21 +00:00
Rafael Espindola af57d48ed4 Handle symbols pointing to output sections.
Now that gc sections runs after linker defined symbols are added it
can see symbols that point to an OutputSection.

Should fix a bot failure.

llvm-svn: 320412
2017-12-11 19:45:36 +00:00
Rui Ueyama 8cbb3b56b9 Sort.
llvm-svn: 320394
2017-12-11 17:52:43 +00:00
Rui Ueyama 909d123893 Change function type more LLVM-ish.
Also fix variable naming style.

llvm-svn: 320393
2017-12-11 17:52:28 +00:00
Rafael Espindola 63fcc5cccc Create reserved symbols early so they can be versioned.
This fixes pr35570.

We were creating these symbols after parsing version scripts, so they
could not be versioned.

We cannot move the version script parsing later because we need it for
lto.

One option is to move both addReservedSymbols and
createSyntheticSections earlier. The disadvantage is that some
sections created by createSyntheticSections replace other input
sections. For example, gdb index replaces .debug_gnu_pubnames, so it
wants to run after gc sections so that it can set S->Live to false.

What this patch does instead is to move just the ElfHeader creation
early.

llvm-svn: 320390
2017-12-11 17:23:28 +00:00
Peter Smith 830a453554 [ELF] Improve comments in aarch64 errata fix test [NFC]
Comment improvements split out from review D36749. No changes to any non
comment line.

llvm-svn: 320372
2017-12-11 15:00:58 +00:00
Rafael Espindola b43da540cd Fix test to test what it intended to test.
The test was added to test that we don't merge read only data
sections, but the sections in the test were rw.

llvm-svn: 320339
2017-12-11 01:06:39 +00:00
Rafael Espindola 87e0deaea7 Move RelaPlt and RelaIplt to InX. NFC.
llvm-svn: 320327
2017-12-10 20:07:03 +00:00
Rafael Espindola 58946cdb08 Move RelaDyn to InX. NFC.
llvm-svn: 320324
2017-12-10 19:44:42 +00:00
Rafael Espindola 6d907105c5 Remove this->. NFC.
llvm-svn: 320323
2017-12-10 19:28:32 +00:00
Tim Northover 8f1bc370e2 PPC32: Support R_PPC_PLTREL32 in static mode.
See https://reviews.llvm.org/D39226

Patch by vit9696 <vit9696@avp.su>

llvm-svn: 320286
2017-12-10 08:42:34 +00:00
Rafael Espindola d26b52fd34 Remove some includes from InputFiles.h.
They were not used in InputFiles.h and it was getting too easy to add
circular includes.

llvm-svn: 320256
2017-12-09 16:56:18 +00:00
Rafael Espindola 5af073e3bf Make createSyntheticSections a static helper. NFC.
llvm-svn: 320200
2017-12-08 21:50:29 +00:00
Rafael Espindola 471001a7b4 Make findSection a static function. NFC.
llvm-svn: 320198
2017-12-08 21:44:11 +00:00
Peter Collingbourne d1eefa993b ELF: Ignore --long-plt flag.
This flag can be ignored because we always emit long PLTs.

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

llvm-svn: 320178
2017-12-08 19:36:19 +00:00
Rafael Espindola 1dd30ddd45 Make addReservedSymbols a static helper. NFC.
llvm-svn: 320175
2017-12-08 19:13:27 +00:00
Sam Clegg 2e25e896fb [WebAssembly] Improve wasm test cases
Add test for weakly defined symbols with the same name

Improve test for call-indirect to include the same call in two
different objects. This lays the ground work to improve the
output via de-duplicating the indirect call table:
   https://reviews.llvm.org/D40989

Also make all tests consistently pass -mtriple rather than
declaring in the sources.

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

llvm-svn: 320172
2017-12-08 18:37:44 +00:00
Sam Clegg 2c096bacc6 [WebAssembly] Add --no-entry argument
This adds a `--no-entry` argument to wasm LLD used to
suppress the default `_start` entry point.

Patch by Nicholas Wilson!

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

llvm-svn: 320167
2017-12-08 17:58:25 +00:00
Alexander Richardson f5ef4e5616 Print the bad value and required alignment for unaligned relocations
Reviewers: ruiu, grimar

Reviewed By: ruiu

Subscribers: emaste, javed.absar, llvm-commits

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

llvm-svn: 320147
2017-12-08 14:53:14 +00:00
Rui Ueyama 04c821c7e3 Use lambda to simplify code.
Differential Revision: https://reviews.llvm.org/D40994

llvm-svn: 320130
2017-12-08 02:20:50 +00:00
Sam Clegg 0fb6faa0be Prefer `ArrayRef` over `const std::vector&`
Differential Revision: https://reviews.llvm.org/D40993

llvm-svn: 320125
2017-12-08 01:09:21 +00:00
Sam Clegg c5872e864a [WebAssembly] Add check to ensure symbol VA is only set once. NFC.
Also remove resulting unneeded function.

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

llvm-svn: 320118
2017-12-08 00:13:14 +00:00
Rui Ueyama 2569edd9b8 Fix a test that didn't actually test anything.
llvm-svn: 320117
2017-12-08 00:00:37 +00:00
Rafael Espindola d182aaa69d Further simplify .gnu.hash writing. NFC.
llvm-svn: 320072
2017-12-07 18:59:29 +00:00
Rafael Espindola f9f2abe7bd Simplify .gnu.hash writing. NFC.
llvm-svn: 320070
2017-12-07 18:51:19 +00:00
Rafael Espindola 50ca10bb58 Avoid using a temporary std::vector.
With this memory usage when linking clang goes from 174.62MB to
172.77MB.

llvm-svn: 320069
2017-12-07 18:46:03 +00:00
Alexander Richardson 0ce9effaa1 Fix the test from r320056 on Windows
llvm-svn: 320058
2017-12-07 16:41:43 +00:00
Alexander Richardson 280252c6d1 [ELF][mips] Print the full file path for files with incompatible ISA
Summary:
I also changed the message to print both the ISA and the the architecture
name for incompatible files. Previously it would be quite hard to find the
actual path of the incompatible object files in projects that have many
object files with the same name in different directories.

Reviewers: atanasyan, ruiu

Reviewed By: atanasyan

Subscribers: emaste, sdardis, llvm-commits

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

llvm-svn: 320056
2017-12-07 16:08:59 +00:00
Sam Clegg 80cfdd6b56 [WebAssembly] Remove used variable
llvm-svn: 320007
2017-12-07 03:51:37 +00:00
Igor Kudrin 892b14658e [ELF] Handle multiple "--version-script" options.
Both ld.bfd and ld.gold can handle this case.

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

llvm-svn: 320006
2017-12-07 03:25:39 +00:00
Rui Ueyama c0081639cc Remove checkToString functions and use toString instead.
Differential Revision: https://reviews.llvm.org/D40928

llvm-svn: 320005
2017-12-07 03:24:57 +00:00
Sam Clegg 31de2f0ccf [WebAssembly] Add -u/--undefined argument handling
Adds a new argument to wasm-lld, `--undefined`, with
similar semantics to the ELF linker. It pulls in symbols
from files contained within a `.a` archive, forcing them
to be included even if the translation unit would not
otherwise be pulled in.

Patch by Nicholas Wilson

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

llvm-svn: 320004
2017-12-07 03:19:53 +00:00
Sam Clegg 74fe0ba105 [WebAssembly] Fix symbol exports under -r/--relocatable
This change cleans up the way wasm exports and globals
are generated, particualrly for -r/--relocatable where
globals need to be created and exported in order for
output relocations which reference them.

Remove the need for a per file GlobalIndexOffset and
instead set the output index for each symbol directly.
This simplifies the code in several places.

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

llvm-svn: 320001
2017-12-07 01:51:24 +00:00
Shoaib Meenai 9a5161e056 [COFF] Stop lowercasing paths in messages
It's pretty annoying to have LLD lowercase paths in error messages when
cross-compiling from a case-sensitive filesystem, since e.g. if I want
to examine the problematic object file, I have to perform some manual
case correction instead of just being able to copy the path from the
error message.

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

llvm-svn: 319996
2017-12-07 01:21:27 +00:00
Rafael Espindola 91fac59a81 Add a call to std::vector::reserve.
This reduces total allocations when linking clang fsds from 263.21MB
to 174.62MB.

This also has some very nice speed improvements on some
benchmarks. Chromium and clang fsds link 6% faster.

llvm-svn: 319976
2017-12-06 22:32:19 +00:00
Rui Ueyama bdc5150984 Always evaluate the second argument for CHECK() lazily.
This patch is to rename check CHECK and make it a C macro, so that
we can evaluate the second argument lazily.

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

llvm-svn: 319974
2017-12-06 22:08:17 +00:00
Ben Hamilton 4432231b13 [lld] Set up .arcconfig to point to new Diffusion LLD repository
Summary:
We want to automatically copy the appropriate mailing list
for review requests to the LLD repository.

For context, see the proposal and discussion here:

http://lists.llvm.org/pipermail/cfe-dev/2017-November/056032.html

Similar to D40179, I set up a new Diffusion repository with callsign
"LLD" for lld:

https://reviews.llvm.org/source/lld/

This explicitly updates lld's .arcconfig to point to the new C
repository in Diffusion, which will let us use Herald rule H270.

Reviewers: peter.smith, ruiu, rafael, sammccall

Reviewed By: sammccall

Subscribers: dlj, bkramer, sammccall, klimek

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

llvm-svn: 319955
2017-12-06 20:56:23 +00:00
Rafael Espindola b6e2ca4597 Convert a check to checkLazy.
This brings memory allocations when linking clang from 270.96MB to
267.80MB.

llvm-svn: 319932
2017-12-06 19:17:20 +00:00
Rafael Espindola 0ab9d8b6ed Add an early return.
Total memory allocation when linking clang goes from 281.80MB to
270.96MB.

llvm-svn: 319930
2017-12-06 19:13:23 +00:00
Rafael Espindola aca3df5479 Convert a few uses of check to checkLazy.
Linking clang goes from 292.68MB to 281.80MB allocated.

llvm-svn: 319927
2017-12-06 19:08:10 +00:00
Rafael Espindola 5b491a29fb Convert a call to check to checkLazy.
Linking clang goes from 300.82MB to 292.68MB allocated.

llvm-svn: 319926
2017-12-06 19:02:12 +00:00
Rafael Espindola c8dfde2051 Replace one use of check with checkLazy.
Reduce total allocation when linking clang from 320.04MB to 300.82MB.

llvm-svn: 319924
2017-12-06 18:56:22 +00:00
Rafael Espindola 9ffa988b5d Add a checkLazy error checking variant.
This avoids allocating the error message when there is no error that
check requires.

It avoids the code duplication of inlining check.

llvm-svn: 319922
2017-12-06 18:52:13 +00:00
Rafael Espindola 8b97611190 Don't allocate memory for an error message on success.
This takes memory allocations when linking clang-fsds from 342.08MB to
320.04MB.

llvm-svn: 319918
2017-12-06 18:39:22 +00:00
Rafael Espindola f4c3239824 Don't allocate an error message when there is no error.
According to heaptrack this takes "bytes allocated in total" when
linking clang-fsds from 405.69MB to 342.08MB.

llvm-svn: 319916
2017-12-06 18:31:11 +00:00
George Rimar ba7afd7043 [ELF] - Show .plt symbols in -Map output.
As mentioned in PR35471, shared functions for which
.plt entry address is used shows up in bfd's map files. 
Patch teaches LLD to do the same.

Differential revision: https://reviews.llvm.org/D40839

llvm-svn: 319879
2017-12-06 08:36:21 +00:00
Rafael Espindola 3a02234e0d Make this test a bit less confusing.
Before this patch foo and bar have the same address as .text is empty.

llvm-svn: 319877
2017-12-06 03:35:40 +00:00