[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
Fri Dec 23 10:45:19 PST 2022


MaskRay added a comment.

> 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)" ?

> if a thunk section happens to be placed on the outer range of a BL and the stars are aligned.

stars?



================
Comment at: lld/ELF/Thunks.cpp:547
+// the target is Thumb
+// && is within branch range,
+// && this function has not previously returned false
----------------



================
Comment at: lld/ELF/Thunks.cpp:550
+//    (see comment for mayUseShortThunk)
+// && the arch supports Thumb branch range extension
 bool ThumbThunk::getMayUseShortThunk() {
----------------



================
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
----------------
The output file has 12+MiB, which is too large. Is it possible to make it smaller with a linker script?


================
Comment at: lld/test/ELF/arm-thumb-range-thunk-os-no-ext.s:16
+
+// Test the Range extension Thunks for Thumb when all the code is in a single
+// OutputSection. The Thumb BL instruction has a range of 4Mb. We create a
----------------
`///` for non-RUN-non-CHECK comments in new tests.


================
Comment at: lld/test/ELF/arm-thumb-range-thunk-os-no-ext.s:23
+
+// Define a function aligned on a megabyte boundary
+.macro FUNCTION suff
----------------
End full sentences with a period.


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