forked from OSchip/llvm-project
2822852ffc
Any OUTPUT_FORMAT in a linker script overrides the emulation passed on the command line, so record the passed bfdname and use that in the error message about incompatible input files. This prevents confusing error messages. For example, if you explicitly pass `-m elf_x86_64` to LLD but accidentally include a linker script which sets `OUTPUT_FORMAT(elf32-i386)`, LLD would previously complain about your input files being compatible with elf_x86_64, which isn't the actual issue, and is confusing because the input files are in fact x86-64 ELF files. Interestingly enough, this also prevents a segfault! When we don't pass `-m` and we have an object file which is incompatible with the `OUTPUT_FORMAT` set by a linker script, the object file is checked for compatibility before it's added to the objectFiles vector. config->emulation, objectFiles, and sharedFiles will all be empty, so we'll attempt to access bitcodeFiles[0], but bitcodeFiles is also empty, so we'll segfault. This commit prevents the segfault by adding OUTPUT_FORMAT as a possible source of machine configuration, and it also adds an llvm_unreachable to diagnose similar issues in the future. Differential Revision: https://reviews.llvm.org/D76109 |
||
---|---|---|
.. | ||
COFF | ||
Common | ||
ELF | ||
MinGW | ||
cmake/modules | ||
docs | ||
include/lld | ||
lib | ||
test | ||
tools/lld | ||
unittests | ||
utils | ||
wasm | ||
.clang-format | ||
.clang-tidy | ||
.gitignore | ||
CMakeLists.txt | ||
CODE_OWNERS.TXT | ||
LICENSE.TXT | ||
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.
Benchmarking
In order to make sure various developers can evaluate patches over the same tests, we create a collection of self contained programs.
It is hosted at https://s3-us-west-2.amazonaws.com/linker-tests/lld-speed-test.tar.xz
The current sha256 is 10eec685463d5a8bbf08d77f4ca96282161d396c65bd97dc99dbde644a31610f.