[PATCH] D73542: [LLD][ELF][ARM] Do not substitute BL/BLX for non STT_FUNC symbols.

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 28 04:05:20 PST 2020


peter.smith created this revision.
peter.smith added reviewers: ruiu, MaskRay, grimar.
Herald added subscribers: kristof.beyls, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.

D73474 <https://reviews.llvm.org/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 is related to clang-built-linux https://github.com/ClangBuiltLinux/linux/issues/773 although in that case it looks like all the problem instances were caught by D73474 <https://reviews.llvm.org/D73474>.


https://reviews.llvm.org/D73542

Files:
  lld/ELF/Arch/ARM.cpp
  lld/test/ELF/arm-thumb-interwork-notfunc.s
  lld/test/ELF/arm-thumb-undefined-weak.s
  lld/test/ELF/arm-undefined-weak.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73542.240833.patch
Type: text/x-patch
Size: 8176 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200128/1292c1b2/attachment.bin>


More information about the llvm-commits mailing list