[lld] [LLD][COFF] Set the Thumb bit on locally imported ARMNT function poin… (PR #215919)
Martin Storsjö via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 24 06:14:22 PDT 2026
================
@@ -0,0 +1,104 @@
+## On ARMNT a locally imported function pointer must have its low bit set; a data pointer must not.
+
+# RUN: split-file %s %t.dir
+
+# RUN: yaml2obj %t.dir/code.yaml -o %t1.obj
+# RUN: lld-link /out:%t1.exe /entry:main /subsystem:console /base:0x400000 %t1.obj
+# RUN: llvm-objdump -s %t1.exe | FileCheck --check-prefix=CODE %s
+# RUN: llvm-readobj --coff-basereloc %t1.exe | FileCheck --check-prefix=CODEREL %s
+
+# CODE: Contents of section .text:
+# CODE-NEXT: 401000 704700bf 00200000
+# CODE: Contents of section .rdata:
+## Unadjusted this reads 00104000, and it is the only line here that fails without the fix.
+# CODE-NEXT: 402000 01104000
+
+# CODEREL: BaseReloc [
+# CODEREL-NEXT: Entry {
+# CODEREL-NEXT: Type: HIGHLOW
+# CODEREL-NEXT: Address: 0x2000
+# CODEREL-NEXT: }
+
+# RUN: yaml2obj %t.dir/data.yaml -o %t2.obj
+# RUN: lld-link /out:%t2.exe /entry:main /subsystem:console /base:0x400000 %t2.obj
+# RUN: llvm-objdump -s %t2.exe | FileCheck --check-prefix=DATA %s
+# RUN: llvm-readobj --coff-basereloc %t2.exe | FileCheck --check-prefix=DATAREL %s
+
+# DATA: Contents of section .text:
+# DATA-NEXT: 401000 704700bf 04200000
+# DATA: Contents of section .rdata:
+# DATA-NEXT: 402000 2a000000 00204000
+
+# DATAREL: BaseReloc [
+# DATAREL-NEXT: Entry {
+# DATAREL-NEXT: Type: HIGHLOW
+# DATAREL-NEXT: Address: 0x2004
+# DATAREL-NEXT: }
+
+#--- code.yaml
----------------
mstorsjo wrote:
FWIW, I think the testcase could be more readable, if the inputs were in the form of `.s` assembly sources, rather than YAML.
https://github.com/llvm/llvm-project/pull/215919
More information about the llvm-commits
mailing list