llvm-project/lld
Rui Ueyama 64cfffd333 ELF: Rename error -> fatal and redefine error as a non-noreturn function.
In many situations, we don't want to exit at the first error even in the
process model. For example, it is better to report all undefined symbols
rather than reporting the first one that the linker picked up randomly.

In order to handle such errors, we don't need to wrap everything with
ErrorOr (thanks for David Blaikie for pointing this out!) Instead, we
can set a flag to record the fact that we found an error and keep it
going until it reaches a reasonable checkpoint.

This idea should be applicable to other places. For example, we can
ignore broken relocations and check for errors after visiting all relocs.

In this patch, I rename error to fatal, and introduce another version of
error which doesn't call exit. That function instead sets HasError to true.
Once HasError becomes true, it stays true, so that we know that there
was an error if it is true.

I think introducing a non-noreturn error reporting function is by itself
a good idea, and it looks to me that this also provides a gradual path
towards lld-as-a-library (or at least embed-lld-to-your-program) without
sacrificing code readability with lots of ErrorOr's.

http://reviews.llvm.org/D16641

llvm-svn: 259069
2016-01-28 18:40:06 +00:00
..
COFF Update for LLVM function name change. 2016-01-14 20:53:50 +00:00
ELF ELF: Rename error -> fatal and redefine error as a non-noreturn function. 2016-01-28 18:40:06 +00:00
cmake/modules
docs getting_started.rst: fix 'unknown target name' error 2016-01-27 17:54:35 +00:00
include/lld ELF: Rename error -> fatal and redefine error as a non-noreturn function. 2016-01-28 18:40:06 +00:00
lib ELF: Rename error -> fatal and redefine error as a non-noreturn function. 2016-01-28 18:40:06 +00:00
test Handle local symbols in discarded sections. 2016-01-27 17:09:37 +00:00
tools Rename ld.lld2 to ld.lld since it is the default. 2015-11-18 06:11:01 +00:00
unittests Add support for export_dynamic cmdline option and behaviour. 2016-01-22 21:13:24 +00:00
.arcconfig Update Phabricator server. 2014-04-07 04:52:24 +00:00
.clang-format Remove redundant "Standard: Cpp11" tag. The LLVM style has used the 2014-07-04 12:08:03 +00:00
.gitignore Update .gitignore to ignore hidden MacOSX Finder droppings 2014-07-16 21:01:17 +00:00
CMakeLists.txt Set CMake ADDITIONAL_HEADER_DIRS on libraries with headers in /include. NFC. 2016-01-07 00:14:09 +00:00
CODE_OWNERS.TXT Add initial CODE_OWNERS.TXT file 2015-07-25 00:44:37 +00:00
LICENSE.TXT Update copyright year to 2015. 2015-03-12 20:14:35 +00:00
README.md

README.md

LLVM Linker (lld)

This directory and its subdirectories contain source code for the LLVM Linker, a modular cross platform linker which is built as part of the LLVM compiler infrastructure project.

lld is open source software. You may freely distribute it under the terms of the license agreement found in LICENSE.txt.