llvm-project/lld/test
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 [llvm-objdump] Print file format in lowercase to match GNU output. 2020-02-12 08:17:01 -08:00
Driver/Inputs
ELF [LLD][ELF][ARM] Do not substitute BL/BLX for non STT_FUNC symbols. 2020-02-13 09:40:21 +00:00
MinGW Use error instead of fatal to report usage errors 2019-10-10 09:46:41 +00:00
Unit
darwin [Darwin] Do not error on '-lto_library' option 2018-06-13 18:59:14 +00:00
mach-o [LLD] - Fix a test after obj2yaml change. 2019-10-30 18:28:52 +03:00
wasm [lld][WebAssembly] Fail if bitcode objects are pulled in after LTO 2020-02-11 17:36:15 -08:00
CMakeLists.txt build: reduce CMake handling for zlib 2020-01-02 11:19:12 -08:00
lit.cfg.py ELF: Change FileSize back to a uint64_t. 2019-03-01 18:53:41 +00:00
lit.site.cfg.py.in build: reduce CMake handling for zlib 2020-01-02 11:19:12 -08:00