[all-commits] [llvm/llvm-project] 747fc2: [lld][ARM] don't use short thumb thunks if no bran...

Ties Stuij via All-commits all-commits at lists.llvm.org
Mon Jan 9 03:46:18 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 747fc27ee44d934bc25ecc7a62b0c87fc3af1fd0
      https://github.com/llvm/llvm-project/commit/747fc27ee44d934bc25ecc7a62b0c87fc3af1fd0
  Author: Ties Stuij <ties at stuij.se>
  Date:   2023-01-09 (Mon, 09 Jan 2023)

  Changed paths:
    M lld/ELF/Thunks.cpp
    A lld/test/ELF/arm-thumb-range-thunk-os-no-ext.s

  Log Message:
  -----------
  [lld][ARM] don't use short thumb thunks if no branch range extension

In ThumbThunk::isCompatibleWith, we check if we can use short thunks if we are
within branch range. However these short thumb thunks will generate b.w
instructions, and these are not available on pre branch range extension
architectures.

On these architectures (v4, v5, and most of v6), we could replace the b.w with a
Thumb b (2) instruction, but that would in an ideal situation only give us an
extra range of 2048 bytes on top of the 4MB range of a BL, if a thunk section
happens to be placed on the outer range of a BL and the stars are aligned. It
doesn't seem worth it.

What would be worth it is a state change to Arm and a subsequent branch to
either Arm or Thumb code. But that's the subject of another patch.

Reviewed By: MaskRay

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




More information about the All-commits mailing list