Commit Graph

15 Commits

Author SHA1 Message Date
Rui Ueyama e6e206d4b4 Do not use errs() or outs() directly. Instead use message(), log() or error()
LLD is a multi-threaded program. errs() or outs() are not guaranteed
to be thread-safe (they are actually not).

LLD's message(), log() or error() are thread-safe. We should use them.

llvm-svn: 295787
2017-02-21 23:22:56 +00:00
Bob Haarman 6c8f736ba7 COFF: add error() and warn() to Error.{cpp,h}
Summary: This copies over some functionality we have in ELF/Error.{cpp,h} and makes it available in COFF/Error.{cpp,h}

Reviewers: pcc, rafael, ruiu

Subscribers:

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

llvm-svn: 292240
2017-01-17 19:07:42 +00:00
Kevin Enderby 0fa9fd0f28 Needed change to lld for the changes to libObject/Archive interfaces now returning Expected<>
for the llvm trunk change in r277656

llvm-svn: 277657
2016-08-03 21:58:48 +00:00
Peter Collingbourne feee2103c6 COFF: Implement /linkrepro flag.
This flag is implemented similarly to --reproduce in the ELF linker.

This patch implements /linkrepro by moving the cpio writer and associated
utility functions to lldCore, and using that implementation in both linkers.

One COFF-specific detail is that we store the object file from which the
resource files were created in our reproducer, rather than the resource
files themselves. This allows the reproducer to be used on non-Windows
systems for example.

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

llvm-svn: 276719
2016-07-26 02:00:42 +00:00
Rui Ueyama 659a4f2f38 Make check() always return a value.
Previously, one of two check functions didn't return a value.
It was confusing. This patch makes both functions return values.

llvm-svn: 275511
2016-07-15 01:06:38 +00:00
Rui Ueyama 0d09a865c6 COFF: Remove `void error()` functions and use fatal instead.
This change makes the control flow more explicit.

llvm-svn: 275504
2016-07-15 00:40:46 +00:00
Rui Ueyama 606047939c COFF: Rename noreturn error -> fatal.
This new name is also consistent with ELF.

llvm-svn: 275500
2016-07-14 23:37:14 +00:00
Rui Ueyama 7e75866c51 COFF: Rename non-noreturn error -> check.
The new name is consistent with ELF.

llvm-svn: 275499
2016-07-14 23:37:10 +00:00
Peter Collingbourne 66ec178c6c Fix logic error in check() function.
llvm-svn: 274195
2016-06-30 00:32:24 +00:00
Peter Collingbourne eadba86c3e COFF: Switch to new archive writer interface (D21721).
Differential Revision: http://reviews.llvm.org/D21722

llvm-svn: 274184
2016-06-29 22:27:45 +00:00
Rafael Espindola beee25e484 Make these headers as being c++.
llvm-svn: 245050
2015-08-14 14:12:54 +00:00
Rafael Espindola b835ae8e4a Port the error functions from ELF to COFF.
This has a few advantages

* Less C++ code (about 300 lines less).
* Less machine code (about 14 KB of text on a linux x86_64 build).
* It is more debugger friendly. Just set a breakpoint on the exit function and
  you get the complete lld stack trace of when the error was found.
* It is a more robust API. The errors are handled early and we don't get a
  std::error_code hot potato being passed around.
* In most cases the error function in a better position to print diagnostics
  (it has more context).

llvm-svn: 244215
2015-08-06 14:58:50 +00:00
Denis Protivensky 1c43df7481 COFF: Better noexcept specification with LLVM_NOEXCEPT
This is a follow-on to r238732

llvm-svn: 238733
2015-06-01 09:08:11 +00:00
Denis Protivensky c44223ed96 COFF: Add noexcept to std::error_category::name
This fixes build error with gcc.

llvm-svn: 238732
2015-06-01 08:12:44 +00:00
Rui Ueyama 8fd9fb9857 COFF: Define an error category for the linker.
Instead of returning non-categorized errors, return categorized errors.
All uses of make_dynamic_error_code are removed.

Because we don't have error reporting mechanism, I just chose to print out
error messages to stderr, and then return an error object. Not sure if
that's the right thing to do, but at least it seems practical.

http://reviews.llvm.org/D10129

llvm-svn: 238714
2015-06-01 02:58:15 +00:00