[PATCH] D140633: [lld][ARM] don't use short thumb thunks if no branch range extension

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 24 15:01:24 PST 2022


MaskRay added a comment.

In D140633#4015572 <https://reviews.llvm.org/D140633#4015572>, @stuij wrote:

> In D140633#4015503 <https://reviews.llvm.org/D140633#4015503>, @MaskRay wrote:
>
>>> 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,
>>
>> Q: what is "Thumb b (2)" ?
>
> Its version 2 of the Thumb b instruction as per the v4-v6 Arm Architecture Reference Manual (doc nr: ddi 0100i).
> So section A7.1.14 of https://documentation-service.arm.com/static/5f8dacc8f86e16515cdb865a

Thanks for the manual. It uses "b (2)" which resolves my question. Where does "extra range of 2048 bytes" come from?

>>> if a thunk section happens to be placed on the outer range of a BL and the stars are aligned.
>>
>> stars?
>
> 'stars are aligned' figure of speech embellishing the notion that it's very unlikely. That part didn't include any actual information.

Thanks! I did not know "stars are aligned" and when I saw "aligned" I was thinking of what objects were aligned...



================
Comment at: lld/test/ELF/arm-thumb-range-thunk-os-no-ext.s:4
+// RUN: ld.lld %t -o %t2
+// The output file is large, most of it zeroes. We dissassemble only the
+// parts we need to speed up the test and avoid a large output file
----------------
stuij wrote:
> stuij wrote:
> > MaskRay wrote:
> > > The output file has 12+MiB, which is too large. Is it possible to make it smaller with a linker script?
> > I agree it's not great. I used arm-thumb-range-thunk-os.s as a template which is more than twice as big btw. I'll have a look what I can do.
> I think an or *the* issue is that the linker will behave differently when using linker script sections, because then the ThunkSection will be placed immediately after the code, which isn't what you want in this case.
Can you elaborate?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140633/new/

https://reviews.llvm.org/D140633



More information about the llvm-commits mailing list