Commit Graph

12555 Commits

Author SHA1 Message Date
Peter Collingbourne 2c6fae179e ELF: Discard .ARM.exidx sections for empty functions instead of misordering them.
The logic added in r372781 caused ARMExidxSyntheticSection::addSection()
to return false for exidx sections without a link order dep that passed
isValidExidxSectionDep(). This included exidx sections for empty functions. As
a result, such exidx sections would end up treated like ordinary sections and
would end up being laid out before the ARMExidxSyntheticSection, most likely in
the wrong order relative to the exidx entries in the ARMExidxSyntheticSection,
breaking the orderedness invariant relied upon by unwinders. Fix this by
simply discarding such sections.

Differential Revision: https://reviews.llvm.org/D69744
2019-11-04 09:11:14 -08:00
Reid Kleckner deaf121b65 Warn when an output section name is longer than 8 characters
Recent versions of Microsoft's dumpbin tool cannot handle such PE files.
LLVM tools and GNU tools can, and use this to encode long section names
like ".debug_info", which is commonly used for DWARF. Don't do this in
mingw mode or when -debug:dwarf is passed, since the user probably wants
long section names for DWARF sections.

PR43754

Reviewers: ruiu, mstorsjo

Differential Revision: https://reviews.llvm.org/D69594
2019-11-01 12:59:13 -07:00
Nico Weber 07255f81fa comment typo fix to cycle bots 2019-10-31 07:54:16 -04:00
Nico Weber 4138fc9567 comment typo fix to cycle bots 2019-10-30 22:17:52 -04:00
Fangrui Song db8dad20b3 [ELF][test] Change references of %T to %t.dir
Test files in the same directory share the same %T.  %T is easy to
misuse and cause race conditions (when running concurrently) so it has
been deprecated since D48842 (see docs/CommandGuide/lit.rst).

While here, add `rm -rf %t.dir` so that tests cannot depend on old files lying around.

Reviewed By: jhenderson, ruiu

Differential Revision: https://reviews.llvm.org/D69572
2019-10-30 09:22:48 -07:00
Georgii Rymar d213da49e1 [LLD] - Fix a test after obj2yaml change.
I am not sure why obj2yaml is used to check the linkers output,
but anyways, the format was changed in https://reviews.llvm.org/rG6e779e953e9d.
2019-10-30 18:28:52 +03:00
Sam Clegg baff8ec2e1 [WebAssembly][lld] Fix for static linking of PIC code
When statically linking PIC code we create an internalized __memory_base
so that memory-base-relative relocation work correctly.  The value of
this global should be zero, and not the globalBase since the globalBase
offset is already taken into account by getVirtualAddress.

Fixes: https://github.com/emscripten-core/emscripten/issues/9013

Differential Revision: https://reviews.llvm.org/D69600
2019-10-29 18:58:56 -07:00
Nick Terrell 6814232429 [LLD][ELF] Support --[no-]mmap-output-file with F_no_mmap
Summary:
Add a flag `F_no_mmap` to `FileOutputBuffer` to support
`--[no-]mmap-output-file` in ELF LLD. LLD currently explicitly ignores
this flag for compatibility with GNU ld and gold.

We need this flag to speed up link time for large binaries in certain
scenarios. When we link some of our larger binaries we find that LLD
takes 50+ GB of memory, which causes memory pressure. The memory
pressure causes the VM to flush dirty pages of the output file to disk.
This is normally okay, since we should be flushing cold pages. However,
when using BtrFS with compression we need to write 128KB at a time when
we flush a page. If any page in that 128KB block is written again, then
it must be flushed a second time, and so on. Since LLD doesn't write
sequentially this causes write amplification. The same 128KB block will
end up being flushed multiple times, causing the linker to many times
more IO than necessary. We've observed 3-5x faster builds with
-no-mmap-output-file when we hit this scenario.

The bad scenario only applies to compressed filesystems, which group
together multiple pages into a single compressed block. I've tested
BtrFS, but the problem will be present for any compressed filesystem
on Linux, since it is caused by the VM.

Silently ignoring --no-mmap-output-file caused a silent regression when
we switched from gold to lld. We pass --no-mmap-output-file to fix this
edge case, but since lld silently ignored the flag we didn't realize it
wasn't being respected.

Benchmark building a 9 GB binary that exposes this edge case. I linked 3
times with --mmap-output-file and 3 times with --no-mmap-output-file and
took the average. The machine has 24 cores @ 2.4 GHz, 112 GB of RAM,
BtrFS mounted with -compress-force=zstd, and an 80% full disk.

| Mode    | Time  |
|---------|-------|
| mmap    | 894 s |
| no mmap | 126 s |

When compression is disabled, BtrFS performs just as well with and
without mmap on this benchmark.

I was unable to reproduce the regression with any binaries in
lld-speed-test.

Reviewed By: ruiu, MaskRay

Differential Revision: https://reviews.llvm.org/D69294
2019-10-29 15:49:08 -07:00
Fangrui Song 94bfa6deb0 [ELF] Delete redundant comment after D56554. NFC 2019-10-29 10:00:48 -07:00
Michał Górny 2a0fcae3d4 [lld] [ELF] Add '-z nognustack' opt to suppress emitting PT_GNU_STACK
Add a new '-z nognustack' option that suppresses emitting PT_GNU_STACK
segment.  This segment is not supported at all on NetBSD (stack is
always non-executable), and the option is meant to be used to disable
emitting it.

Differential Revision: https://reviews.llvm.org/D56554
2019-10-29 17:54:23 +01:00
Nico Weber 5976a3f5aa Fix a few typos in lld/ELF to cycle bots 2019-10-28 21:41:47 -04:00
Nico Weber b911d2db5d lld/COFF: Simplify getOutputPath() using sys::path functions.
Also mention "basename" and "dirname" in Path.h since I tried
to find these functions by looking for these strings. It might
help others find them faster if the comments contain these strings.

No behavior change.

Differential Revision: https://reviews.llvm.org/D69458
2019-10-28 10:38:32 -04:00
Sterling Augustine 118ceea5c3 Crt files are special cased by name when dealing with ctor and dtor
sections, but the current code misses certain variants. In particular, those
named when clang takes the code path in
clang/lib/Driver/ToolChain.cpp:416, where crtfiles are named:

clang_rt.<component>-<arch>-<env>.<suffix>

Previously, the code only handled:
clang_rt.<component>.<suffix>
<component>.<suffix>

This revision fixes that.
2019-10-25 11:04:56 -07:00
georgerim e3105e71f3 [LLD][ELF] - Update test case after yaml2obj change.
SHT_NOTE needs at least an empty "Content" in the YAML description.
Should fix http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast
2019-10-25 13:40:44 +03:00
Fangrui Song 56d81104f1 [ELF] -r: fix crash when processing a SHT_REL[A] that relocates a SHF_MERGE after D67504/r372734
Fix PR43767

In -r mode, when processing a SHT_REL[A] that relocates a SHF_MERGE, sec->getRelocatedSection() is a
MergeInputSection and its parent is an OutputSection but is asserted to
be a SyntheticSection (MergeSyntheticSection) in LinkerScript.cpp:addInputSec().
 ##
The code path is not exercised in non -r mode because the relocated
section changed from MergeInputSection to InputSection.

Reorder the code to make the non -r logic apply to -r as well, thus fix
the crash.

Reviewed By: peter.smith

Differential Revision: https://reviews.llvm.org/D69364
2019-10-24 11:35:29 -07:00
LLVM GN Syncbot f86dc64bad typo fix test commit 2019-10-22 21:32:11 +00:00
Nico Weber e0e7d06df3 fix a few typos to test git committing 2019-10-22 16:34:00 -04:00
Martin Storsjo 150a9ad3ff [LLD] [COFF] Fix use of uninitialized memory since SVN r375390
llvm-svn: 375400
2019-10-21 09:35:34 +00:00
Martin Storsjo 65b1c497d2 [LLD] [COFF] Use the local dwarf code instead of Symbolizer for resolving code locations. NFC.
As we now have code that parses the dwarf info for variable locations,
we can use that instead of relying on the higher level Symbolizer library,
reducing the previous two different dwarf codepaths into one.

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

llvm-svn: 375391
2019-10-21 08:01:59 +00:00
Martin Storsjo 908b780952 [LLD] Move duplicated dwarf parsing code to the Common library. NFC.
Differential Revision: https://reviews.llvm.org/D69197

llvm-svn: 375390
2019-10-21 08:01:52 +00:00
George Rimar c4107383e5 [LLD][ELF] - Update tests after yaml2obj tool update.
yaml2obj doesn't create .symtab by default anymore.

llvm-svn: 375360
2019-10-20 14:47:09 +00:00
Reid Kleckner 90c64a3456 Move endian constant from Host.h to SwapByteOrder.h, prune include
Works on this dependency chain:
  ArrayRef.h ->
  Hashing.h -> --CUT--
  Host.h ->
  StringMap.h / StringRef.h

ArrayRef is very popular, but Host.h is rarely needed. Move the
IsBigEndianHost constant to SwapByteOrder.h. Clients of that header are
more likely to need it.

llvm-svn: 375316
2019-10-19 00:48:11 +00:00
Thomas Lively 393d0f799f [WebAssembly] Allow multivalue signatures in object files
Summary:
Also changes the wasm YAML format to reflect the possibility of having
multiple return types and to put the returns after the params for
consistency with the binary encoding.

Reviewers: aheejin, sbc100

Subscribers: dschuff, jgravelle-google, hiraditya, sunfish, arphaman, rupprecht, llvm-commits

Tags: #llvm

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

llvm-svn: 375283
2019-10-18 20:27:30 +00:00
Michael Liao 92fea8bb8d [lld][coff] Add missing dependency to fix build.
llvm-svn: 375238
2019-10-18 14:31:58 +00:00
Martin Storsjo b38f577c01 [LLD] [COFF] Try to report source locations for duplicate symbols
This fixes the second part of PR42407.

For files with dwarf debug info, it manually loads and iterates
.debug_info to find the declared location of variables, to allow
reporting them. (This matches the corresponding code in the ELF
linker.)

For functions, it uses the existing getFileLineDwarf which uses
LLVMSymbolizer for translating addresses to file lines.

In object files with codeview debug info, only the source location
of duplicate functions is printed. (And even there, only for the
first input file. The getFileLineCodeView function requires the
object file to be fully loaded and initialized to properly resolve
source locations, but duplicate symbols are reported at a stage when
the second object file isn't fully loaded yet.)

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

llvm-svn: 375218
2019-10-18 10:43:15 +00:00
Rui Ueyama 9a5ad9bd5a Update release notes
llvm-svn: 375206
2019-10-18 06:11:16 +00:00
Jordan Rupprecht ce88cdf096 [lld][test] Speculative fix for lld+windows failures
This updates some more places using `%T` to use `%/T` for path normalization.

If this does not work, this and r375126 should be reverted together.

llvm-svn: 375131
2019-10-17 16:29:03 +00:00
Jordan Rupprecht 1b6c3ca126 [lld][test] Fix use of escape character in an lld test on Windows
Summary:
Glob support was improved to accept `\` as an escape character in r375051, but reverted as r375052 due to a failure in this test on Windows.

The reason this failure seems Windows specific is because the path separator `\` is currently being relied on to be interpreted literally instead of as an escape character. Per documentation on linker input section wildcard patterns, this seems to be a bug in lld accepting `\` as a literal instead of an escape character.

For example:
```
SECTIONS{ .foo :{ /path/to/foo.o(.foo) }} # OK: standard UNIX path
SECTIONS{ .foo :{ C:/path/to/foo.o(.foo) }} # OK: windows accepts slashes in either direction
SECTIONS{ .foo :{ C:\\path\\to\\foo.o(.foo) }} # OK: escape character used to match a literal \
SECTIONS{ .foo :{ C:\path\to\foo.o(.foo) }} # BAD: this actually matches the path C:pathtofoo.o(.foo)
```

This avoids the problem in the test by using `%/T` in place of `%T` to normalize the path separator to `/`, which windows should also accept.

This patch just fixes the test, and glob support will be be relanded separately.

For a sample buildbot error, see: http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/11578/steps/stage%201%20check/logs/stdio

Reviewers: evgeny777, ruiu, MaskRay, espindola

Reviewed By: ruiu, MaskRay

Subscribers: emaste, arichardson, llvm-commits

Tags: #llvm

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

llvm-svn: 375126
2019-10-17 15:35:28 +00:00
George Rimar 938db706fe [LLD][ELF] - Update test cases after llvm-readobj output format change.
The change was:

SHT_GNU_verdef { -> VersionDefinitions [
SHT_GNU_verneed { -> VersionRequirements [
Version symbols [ -> VersionSymbols [
EH_FRAME Header [ -> EHFrameHeader {

llvm-svn: 375096
2019-10-17 10:23:59 +00:00
Sam Clegg 67b055841f [lld][WebAssebmly] Preserve custom import attributes with LTO
Undefined symbols in WebAssembly can come with custom `import-module`
and `import-field` attributes.  However when reading symbols from
bitcode object files during LTO those curtom attributes are not
available.

Once we compile the LTO object and read in the symbol table from the
object file we have access to these custom attributes.  In this case,
when undefined symbols are added and a symbol already exists in the
SymbolTable we can't simple return it, we may need to update the
symbol's attributes.

Fixes: PR43211

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

llvm-svn: 375081
2019-10-17 05:16:54 +00:00
Sam Clegg 6c393e9d74 [lld][WebAssembly] Fix for weak references to data symbols in archives
Fix a bug where were not handling relocations against weakly undefined
data symbol.  Add a test for this case.  Also ensure that the weak
references to data symbols are not pulled in from archive files by
default (but are if `-u <name>` is added to the command line).

Fixes: PR43696

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

llvm-svn: 375077
2019-10-17 03:21:02 +00:00
Thomas Lively 190dacc3cc [WebAssembly] Elide data segments for .bss sections
Summary:
WebAssembly memories are zero-initialized, so when module does not
import its memory initializing .bss sections is guaranteed to be a
no-op. To reduce binary size and initialization time, .bss sections
are simply not emitted into the final binary unless the memory is
imported.

Reviewers: sbc100

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

Tags: #llvm

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

llvm-svn: 374940
2019-10-15 19:05:11 +00:00
James Clarke 1ab27c74d4 [lld][WebAssembly] Fix static linking of -fPIC code with external undefined data
Reviewers: ruiu, sbc100

Reviewed By: sbc100

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

Tags: #llvm

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

llvm-svn: 374913
2019-10-15 17:05:42 +00:00
Sid Manning ab50256544 [lld] Check for branch range overflows.
Differential Revision: https://reviews.llvm.org/D68875

llvm-svn: 374891
2019-10-15 14:12:54 +00:00
Martin Storsjo e0916f4fbe [LLD] [COFF] Update a leftover comment after SVN r374869. NFC.
llvm-svn: 374874
2019-10-15 09:46:33 +00:00
Martin Storsjo cd8759c3c2 [LLD] [COFF] Fix -Wmissing-field-initializers warnings. NFC.
llvm-svn: 374873
2019-10-15 09:33:14 +00:00
Martin Storsjo 9318c94ebb [LLD] [COFF] Wrap file location pair<StringRef,int> in Optional<>. NFC.
This makes use of it slightly clearer, and makes it match the
same construct in the lld ELF linker.

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

llvm-svn: 374869
2019-10-15 09:18:18 +00:00
Jordan Rupprecht c526ff8a62 [llvm-objdump] Adjust spacing and field width for --section-headers
Summary:
- Expand the "Name" column past 13 characters when any of the section names are longer. Current behavior is a staggard output instead of a nice table if a single name is longer.
- Only print the required number of hex chars for addresses (i.e. 8 characters for 32-bit, 16 characters for 64-bit)
- Fix trailing spaces

Reviewers: grimar, jhenderson, espindola

Reviewed By: grimar

Subscribers: emaste, sbc100, arichardson, aheejin, seiya, llvm-commits, MaskRay

Tags: #llvm

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

llvm-svn: 374795
2019-10-14 17:47:17 +00:00
George Rimar a8346cee8a [LLD][ELF] - Update test cases after llvm-readobj change.
https://reviews.llvm.org/D68704 changed the output format.

llvm-svn: 374542
2019-10-11 12:27:20 +00:00
Amy Huang c9428a04fc Change test case so that it accepts backslashes in file path, in the case that the test runs on Windows
llvm-svn: 374473
2019-10-10 23:35:53 +00:00
Zachary Turner 02c5386811 [PDB] Fix bug when using multiple PCH header objects with the same name.
A common pattern in Windows is to have all your precompiled headers
use an object named stdafx.obj.  If you've got a project with many
different static libs, you might use a separate PCH for each one of
these.

During the final link step, a file from A might reference the PCH
object from A, but it will have the same name (stdafx.obj) as any
other PCH from another project.  The only difference will be the
path.  For example, A might be A/stdafx.obj while B is B/stdafx.obj.

The existing algorithm checks only the filename that was passed on
the command line (or stored in archive), but this is insufficient in
the case where relative paths are used, because depending on the
command line object file / library order, it might find the wrong
PCH object first resulting in a signature mismatch.

The fix here is to simply check whether the absolute path of the
PCH object (which is stored in the input obj file for the file that
references the PCH) *ends with* the full relative path of whatever
is specified on the command line (or is in the archive).

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

llvm-svn: 374442
2019-10-10 20:25:51 +00:00
Russell Gallop 6d6ec1b869 [LLD][ELF] Fix stale comments about doing ICF
Differential Revision: https://reviews.llvm.org/D68396

llvm-svn: 374362
2019-10-10 14:50:02 +00:00
Rui Ueyama 9adea6e4fa Make nullptr check more robust
The only condition that isecLoc becomes null is

  Out::bufferStart == nullptr,
  isec->getParent()->offset == 0, and
  isec->outSecOff == 0.

We can check the first condition only once.

llvm-svn: 374332
2019-10-10 12:41:08 +00:00
Roman Lebedev 1508fbad79 [lld] getErrPlace(): don't perform arithmetics on maybe-null pointer
isecLoc there can be null, but at the same time isec->getSize() may
be non-null. It is UB to offset a nullptr.The most straight-forward fix
here appears to perform casts+normal integral arithmetics.

FAIL: lld :: ELF/invalid/invalid-relocation-aarch64.test (1158 of 2217)
******************** TEST 'lld :: ELF/invalid/invalid-relocation-aarch64.test' FAILED ********************
Script:
--
: 'RUN: at line 2';   /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/yaml2obj /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/lld/test/ELF/invalid/invalid-relocation-aarch64.test -o /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/tools/lld/test/ELF/invalid/Output/invalid-relocation-aarch64.test.tmp.o
: 'RUN: at line 3';   not /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/ld.lld /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/tools/lld/test/ELF/invalid/Output/invalid-relocation-aarch64.test.tmp.o -o /dev/null 2>&1 | /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/FileCheck /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/lld/test/ELF/invalid/invalid-relocation-aarch64.test
--
Exit Code: 1

Command Output (stderr):
--
/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/lld/test/ELF/invalid/invalid-relocation-aarch64.test:4:10: error: CHECK: expected string not found in input
# CHECK: error: unknown relocation (1024) against symbol foo
         ^
<stdin>:1:1: note: scanning from here
/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/lld/ELF/Target.cpp💯41: runtime error: applying non-zero offset 24 to null pointer
^
<stdin>:1:118: note: possible intended match here
/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/lld/ELF/Target.cpp💯41: runtime error: applying non-zero offset 24 to null pointer
                                                                                                                     ^

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.
FAIL: lld :: ELF/invalid/invalid-relocation-x64.test (1270 of 2217)
******************** TEST 'lld :: ELF/invalid/invalid-relocation-x64.test' FAILED ********************
Script:
--
: 'RUN: at line 2';   /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/yaml2obj /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/lld/test/ELF/invalid/invalid-relocation-x64.test -o /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/tools/lld/test/ELF/invalid/Output/invalid-relocation-x64.test.tmp1.o
: 'RUN: at line 3';   echo ".global foo; foo:" > /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/tools/lld/test/ELF/invalid/Output/invalid-relocation-x64.test.tmp2.s
: 'RUN: at line 4';   /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/llvm-mc /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/tools/lld/test/ELF/invalid/Output/invalid-relocation-x64.test.tmp2.s -o /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/tools/lld/test/ELF/invalid/Output/invalid-relocation-x64.test.tmp2.o -filetype=obj -triple x86_64-pc-linux
: 'RUN: at line 5';   not /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/ld.lld /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/tools/lld/test/ELF/invalid/Output/invalid-relocation-x64.test.tmp1.o /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/tools/lld/test/ELF/invalid/Output/invalid-relocation-x64.test.tmp2.o -o /dev/null 2>&1 | /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/FileCheck /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/lld/test/ELF/invalid/invalid-relocation-x64.test
--
Exit Code: 1

Command Output (stderr):
--
/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/lld/test/ELF/invalid/invalid-relocation-x64.test:6:10: error: CHECK: expected string not found in input
# CHECK: error: unknown relocation (152) against symbol foo
         ^
<stdin>:1:1: note: scanning from here
/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/lld/ELF/Target.cpp💯41: runtime error: applying non-zero offset 24 to null pointer
^
<stdin>:1:118: note: possible intended match here
/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/lld/ELF/Target.cpp💯41: runtime error: applying non-zero offset 24 to null pointer
                                                                                                                     ^

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90..
Testing Time: 20.73s
********************
Failing Tests (2):
    lld :: ELF/invalid/invalid-relocation-aarch64.test
    lld :: ELF/invalid/invalid-relocation-x64.test

llvm-svn: 374329
2019-10-10 12:22:55 +00:00
Fangrui Song d79c3be618 [COFF] Wrap definitions in namespace lld { namespace coff {. NFC
Similar to D67323, but for COFF. Many lld/COFF/ files already use
`namespace lld { namespace coff {`. Only a few need changing.

Reviewed By: ruiu

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

llvm-svn: 374314
2019-10-10 11:27:58 +00:00
Rui Ueyama 37bf9bb405 Use error instead of fatal to report usage errors
Differential Revision: https://reviews.llvm.org/D68768

llvm-svn: 374297
2019-10-10 09:46:41 +00:00
Martin Storsjo 0226c35262 [LLD] [MinGW] Look for other library patterns with -l
GNU ld looks for a number of other patterns than just lib<name>.dll.a
and lib<name>.a.

GNU ld does support linking directly against a DLL without using an
import library. If that's the only match for a -l argument, point out
that the user needs to use an import library, instead of leaving the
user with a puzzling message about the -l argument not being found
at all.

Also convert an existing case of fatal() into error().

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

llvm-svn: 374292
2019-10-10 08:52:39 +00:00
Martin Storsjo e742794ffa [LLD] [MinGW] Add a testcase for -l:name style library options. NFC.
Differential Revision: https://reviews.llvm.org/D68688

llvm-svn: 374291
2019-10-10 08:52:31 +00:00
Rui Ueyama d7ead5b58d Improve error message for bad SHF_MERGE sections
This patch adds a section name to error messages.

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

llvm-svn: 374290
2019-10-10 08:32:12 +00:00
Fangrui Song 33c59abf5c [WebAssembly] Wrap definitions in namespace lld { namespace wasm {. NFC
Similar to D68323, but for wasm.

Reviewed By: ruiu

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

llvm-svn: 374279
2019-10-10 05:25:39 +00:00