llvm-project/lld
Peter Smith 29c1361557 [LLD][ELF][ARM] Do not substitute BL/BLX for non STT_FUNC symbols.
Recommit of 0b4a047bfb
(reverted in c29003813a) to incorporate
subsequent fix and add a warning when LLD's interworking behavior has
changed.

D73474 disabled the generation of interworking thunks for branch
relocations to non STT_FUNC symbols. This patch handles the case of BL and
BLX instructions to non STT_FUNC symbols. LLD would normally look at the
state of the caller and the callee and write a BL if the states are the
same and a BLX if the states are different.

This patch disables BL/BLX substitution when the destination symbol does
not have type STT_FUNC. This brings our behavior in line with GNU ld which
may prevent difficult to diagnose runtime errors when switching to lld.

This change does change how LLD handles interworking of symbols that do not
have type STT_FUNC from previous versions including the 10.0 release. This
brings LLD in line with ld.bfd but there may be programs that have not been
linked with ld.bfd that depend on LLD's previous behavior. We emit a warning
when the behavior changes.

A summary of the difference between 10.0 and 11.0 is that for symbols
that do not have a type of STT_FUNC LLD will not change a BL to a BLX or
vice versa. The table below enumerates the changes
| relocation     | STT_FUNC | bit(0) | in  | 10.0- out | 11.0+ out |
| R_ARM_CALL     | no       | 1      | BL  | BLX       | BL        |
| R_ARM_CALL     | no       | 0      | BLX | BL        | BLX       |
| R_ARM_THM_CALL | no       | 1      | BLX | BL        | BLX       |
| R_ARM_THM_CALL | no       | 0      | BL  | BLX       | BL        |

Differential Revision: https://reviews.llvm.org/D73542
2020-02-13 09:40:21 +00:00
..
COFF [lld] Replace SmallStr.str().str() with std::string conversion operator. 2020-01-29 21:30:21 -08:00
Common Make llvm::StringRef to std::string conversions explicit. 2020-01-28 23:25:25 +01:00
ELF [LLD][ELF][ARM] Do not substitute BL/BLX for non STT_FUNC symbols. 2020-02-13 09:40:21 +00:00
MinGW [lld] Replace SmallStr.str().str() with std::string conversion operator. 2020-01-29 21:30:21 -08:00
cmake/modules
docs Bump the trunk major version to 11 2020-01-15 13:38:01 +01:00
include/lld Make llvm::StringRef to std::string conversions explicit. 2020-01-28 23:25:25 +01:00
lib Make llvm::StringRef to std::string conversions explicit. 2020-01-28 23:25:25 +01:00
test [LLD][ELF][ARM] Do not substitute BL/BLX for non STT_FUNC symbols. 2020-02-13 09:40:21 +00:00
tools/lld Make it possible to redirect not only errs() but also outs() 2019-11-18 11:18:06 +09:00
unittests Make llvm::StringRef to std::string conversions explicit. 2020-01-28 23:25:25 +01:00
utils Python 2/3 compatibility 2019-03-20 07:42:13 +00:00
wasm [lld][WebAssembly] Fail if bitcode objects are pulled in after LTO 2020-02-11 17:36:15 -08:00
.arcconfig
.clang-format
.gitignore
CMakeLists.txt try to unbreak build after 4b6d9ac392 2020-01-16 10:12:35 -05:00
CODE_OWNERS.TXT
LICENSE.TXT Fix typos throughout the license files that somehow I and my reviewers 2019-01-21 09:52:34 +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.

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.