[all-commits] [llvm/llvm-project] 81d73c: [LLD][ELF][ARM] Do not insert interworking thunks ...

Peter Smith via All-commits all-commits at lists.llvm.org
Wed Jan 29 12:27:30 PST 2020


  Branch: refs/heads/release/10.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 81d73c6de33b2282f7174bd378699feac69bc5aa
      https://github.com/llvm/llvm-project/commit/81d73c6de33b2282f7174bd378699feac69bc5aa
  Author: Peter Smith <peter.smith at linaro.org>
  Date:   2020-01-29 (Wed, 29 Jan 2020)

  Changed paths:
    M lld/ELF/Arch/ARM.cpp
    A lld/test/ELF/arm-thumb-interwork-ifunc.s
    A lld/test/ELF/arm-thumb-interwork-notfunc.s
    M lld/test/ELF/arm-thunk-edgecase.s

  Log Message:
  -----------
  [LLD][ELF][ARM] Do not insert interworking thunks for non STT_FUNC symbols

ELF for the ARM architecture requires linkers to provide
interworking for symbols that are of type STT_FUNC. Interworking for
other symbols must be encoded directly in the object file. LLD was always
providing interworking, regardless of the symbol type, this breaks some
programs that have branches from Thumb state targeting STT_NOTYPE symbols
that have bit 0 clear, but they are in fact internal labels in a Thumb
function. LLD treats these symbols as ARM and inserts a transition to Arm.

This fixes the problem for in range branches, R_ARM_JUMP24,
R_ARM_THM_JUMP24 and R_ARM_THM_JUMP19. This is expected to be the vast
majority of problem cases as branching to an internal label close to the
function.

There is at least one follow up patch required.
- R_ARM_CALL and R_ARM_THM_CALL may do interworking via BL/BLX
  substitution.

In theory range-extension thunks can be altered to not change state when
the symbol type is not STT_FUNC. I will need to check with ld.bfd to see if
this is the case in practice.

Fixes (part of) https://github.com/ClangBuiltLinux/linux/issues/773

Differential Revision: https://reviews.llvm.org/D73474

(cherry picked from commit 4f38ab250ff4680375c4c01db0a88c157093c665)




More information about the All-commits mailing list