[lld] [llvm] [llvm-objdump][ARM] Find ELF file PLT entries for arm, thumb (PR #130764)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 11 05:34:55 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-arm
Author: Vladislav Dzhidzhoev (dzhidzhoev)
<details>
<summary>Changes</summary>
This implements arm, armeb, thumb, thumbeb PLT entries parsing support in ELF for llvm-objdump.
Implementation is similar to AArch64MCInstrAnalysis::findPltEntries. PLT entry signatures are based on LLD code for PLT generation (ARM::writePlt).
llvm-objdump tests are generated based on lld/test/ELF/arm-plt-reloc.s, lld/test/ELF/armv8-thumb-plt-reloc.s.
---
Patch is 65.93 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/130764.diff
28 Files Affected:
- (modified) lld/test/ELF/arm-gnu-ifunc-plt.s (+4)
- (modified) lld/test/ELF/arm-mixed-plts.s (+2)
- (modified) lld/test/ELF/arm-plt-reloc.s (+36)
- (modified) lld/test/ELF/arm-thumb-interwork-shared.s (+4)
- (modified) lld/test/ELF/arm-thumb-interwork-thunk.s (+16)
- (modified) lld/test/ELF/arm-thumb-plt-range-thunk-os.s (+6)
- (modified) lld/test/ELF/arm-thumb-plt-reloc.s (+6)
- (modified) lld/test/ELF/arm-thunk-multipass-plt.s (+4)
- (modified) lld/test/ELF/arm-thunk-re-add.s (+4)
- (modified) lld/test/ELF/armv8-thumb-plt-reloc.s (+6)
- (modified) llvm/include/llvm/MC/MCInstrAnalysis.h (+2-1)
- (modified) llvm/lib/Object/ELFObjectFile.cpp (+17-3)
- (modified) llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.cpp (+4-3)
- (modified) llvm/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp (+106)
- (modified) llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp (+4-3)
- (modified) llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp (+8-7)
- (added) llvm/test/tools/llvm-objdump/ELF/ARM/plt-be.test (+81)
- (added) llvm/test/tools/llvm-objdump/ELF/ARM/plt-be8.test (+81)
- (added) llvm/test/tools/llvm-objdump/ELF/ARM/plt-long-be.test (+84)
- (added) llvm/test/tools/llvm-objdump/ELF/ARM/plt-long-be8.test (+84)
- (added) llvm/test/tools/llvm-objdump/ELF/ARM/plt-long.test (+84)
- (added) llvm/test/tools/llvm-objdump/ELF/ARM/plt-mix-be.test (+93)
- (added) llvm/test/tools/llvm-objdump/ELF/ARM/plt-mix-be8.test (+93)
- (added) llvm/test/tools/llvm-objdump/ELF/ARM/plt-mix.test (+93)
- (added) llvm/test/tools/llvm-objdump/ELF/ARM/plt-thumb-be.test (+91)
- (added) llvm/test/tools/llvm-objdump/ELF/ARM/plt-thumb-be8.test (+97)
- (added) llvm/test/tools/llvm-objdump/ELF/ARM/plt-thumb.test (+91)
- (added) llvm/test/tools/llvm-objdump/ELF/ARM/plt.test (+81)
``````````diff
diff --git a/lld/test/ELF/arm-gnu-ifunc-plt.s b/lld/test/ELF/arm-gnu-ifunc-plt.s
index 55592c0843d6a..f3960b3f42f7f 100644
--- a/lld/test/ELF/arm-gnu-ifunc-plt.s
+++ b/lld/test/ELF/arm-gnu-ifunc-plt.s
@@ -53,10 +53,14 @@
// DISASM-NEXT: 20214: d4 d4 d4 d4 .word 0xd4d4d4d4
// DISASM-NEXT: 20218: d4 d4 d4 d4 .word 0xd4d4d4d4
// DISASM-NEXT: 2021c: d4 d4 d4 d4 .word 0xd4d4d4d4
+// DISASM-EMPTY:
+// DISASM-NEXT: <bar2 at plt>:
// DISASM-NEXT: 20220: add r12, pc, #0, #12
// DISASM-NEXT: 20224: add r12, r12, #32
// DISASM-NEXT: 20228: ldr pc, [r12, #212]!
// DISASM-NEXT: 2022c: d4 d4 d4 d4 .word 0xd4d4d4d4
+// DISASM-EMPTY:
+// DISASM-NEXT: <zed2 at plt>:
// DISASM-NEXT: 20230: add r12, pc, #0, #12
// DISASM-NEXT: 20234: add r12, r12, #32
// DISASM-NEXT: 20238: ldr pc, [r12, #200]!
diff --git a/lld/test/ELF/arm-mixed-plts.s b/lld/test/ELF/arm-mixed-plts.s
index 801de70f4f101..529983dfd9266 100644
--- a/lld/test/ELF/arm-mixed-plts.s
+++ b/lld/test/ELF/arm-mixed-plts.s
@@ -18,6 +18,8 @@
# CHECK-NEXT: d4 d4 d4 d4 .word 0xd4d4d4d4
# CHECK-NEXT: d4 d4 d4 d4 .word 0xd4d4d4d4
# CHECK-NEXT: d4 d4 d4 d4 .word 0xd4d4d4d4
+# CHECK-EMPTY:
+# CHECK-NEXT: <bar at plt>:
# CHECK-NEXT: e28fc600 add r12, pc, #0, #12
# CHECK-NEXT: e28cca20 add r12, r12, #32, #20
# CHECK-NEXT: e5bcf06c ldr pc, [r12, #0x6c]!
diff --git a/lld/test/ELF/arm-plt-reloc.s b/lld/test/ELF/arm-plt-reloc.s
index bfd51467e7425..a12aea45dfb15 100644
--- a/lld/test/ELF/arm-plt-reloc.s
+++ b/lld/test/ELF/arm-plt-reloc.s
@@ -74,16 +74,22 @@ _start:
// DSO-NEXT: 10248: d4 d4 d4 d4 .word 0xd4d4d4d4
// DSO-NEXT: 1024c: d4 d4 d4 d4 .word 0xd4d4d4d4
// (0x10250 + 8) + (0 RoR 12) + (32 RoR 20 = 0x20000) + 140 = 0x302e4
+// DSO-EMPTY:
+// DSO-NEXT: <func1 at plt>:
// DSO-NEXT: 10250: add r12, pc, #0, #12
// DSO-NEXT: 10254: add r12, r12, #32, #20
// DSO-NEXT: 10258: ldr pc, [r12, #140]!
// DSO-NEXT: 1025c: d4 d4 d4 d4 .word 0xd4d4d4d4
// (0x10260 + 8) + (0 RoR 12) + (32 RoR 20 = 0x20000) + 128 = 0x302e8
+// DSO-EMPTY:
+// DSO-NEXT: <func2 at plt>:
// DSO-NEXT: 10260: add r12, pc, #0, #12
// DSO-NEXT: 10264: add r12, r12, #32, #20
// DSO-NEXT: 10268: ldr pc, [r12, #128]!
// DSO-NEXT: 1026c: d4 d4 d4 d4 .word 0xd4d4d4d4
// (0x10270 + 8) + (0 RoR 12) + (32 RoR 20 = 0x20000) + 116 = 0x302ec
+// DSO-EMPTY:
+// DSO-NEXT: <func3 at plt>:
// DSO-NEXT: 10270: add r12, pc, #0, #12
// DSO-NEXT: 10274: add r12, r12, #32, #20
// DSO-NEXT: 10278: ldr pc, [r12, #116]!
@@ -152,14 +158,20 @@ _start:
// CHECKHIGH-NEXT: 2014: d4 d4 d4 d4 .word 0xd4d4d4d4
// CHECKHIGH-NEXT: 2018: d4 d4 d4 d4 .word 0xd4d4d4d4
// CHECKHIGH-NEXT: 201c: d4 d4 d4 d4 .word 0xd4d4d4d4
+// CHECKHIGH-EMPTY:
+// CHECKHIGH-NEXT: <func1 at plt>:
// CHECKHIGH-NEXT: 2020: add r12, pc, #16, #12
// CHECKHIGH-NEXT: 2024: add r12, r12, #1036288
// CHECKHIGH-NEXT: 2028: ldr pc, [r12, #4068]!
// CHECKHIGH-NEXT: 202c: d4 d4 d4 d4 .word 0xd4d4d4d4
+// CHECKHIGH-EMPTY:
+// CHECKHIGH-NEXT: <func2 at plt>:
// CHECKHIGH-NEXT: 2030: add r12, pc, #16, #12
// CHECKHIGH-NEXT: 2034: add r12, r12, #1036288
// CHECKHIGH-NEXT: 2038: ldr pc, [r12, #4056]!
// CHECKHIGH-NEXT: 203c: d4 d4 d4 d4 .word 0xd4d4d4d4
+// CHECKHIGH-EMPTY:
+// CHECKHIGH-NEXT: <func3 at plt>:
// CHECKHIGH-NEXT: 2040: add r12, pc, #16, #12
// CHECKHIGH-NEXT: 2044: add r12, r12, #1036288
// CHECKHIGH-NEXT: 2048: ldr pc, [r12, #4044]!
@@ -220,14 +232,20 @@ _start:
// CHECKLONG-NEXT: 2014: d4 d4 d4 d4 .word 0xd4d4d4d4
// CHECKLONG-NEXT: 2018: d4 d4 d4 d4 .word 0xd4d4d4d4
// CHECKLONG-NEXT: 201c: d4 d4 d4 d4 .word 0xd4d4d4d4
+// CHECKLONG-EMPTY:
+// CHECKLONG-NEXT: <func1 at plt>:
// CHECKLONG-NEXT: 2020: ldr r12, [pc, #4]
// CHECKLONG-NEXT: 2024: add r12, r12, pc
// CHECKLONG-NEXT: 2028: ldr pc, [r12]
// CHECKLONG-NEXT: 202c: e0 f0 10 11 .word 0x1110f0e0
+// CHECKLONG-EMPTY:
+// CHECKLONG-NEXT: <func2 at plt>:
// CHECKLONG-NEXT: 2030: ldr r12, [pc, #4]
// CHECKLONG-NEXT: 2034: add r12, r12, pc
// CHECKLONG-NEXT: 2038: ldr pc, [r12]
// CHECKLONG-NEXT: 203c: d4 f0 10 11 .word 0x1110f0d4
+// CHECKLONG-EMPTY:
+// CHECKLONG-NEXT: <func3 at plt>:
// CHECKLONG-NEXT: 2040: ldr r12, [pc, #4]
// CHECKLONG-NEXT: 2044: add r12, r12, pc
// CHECKLONG-NEXT: 2048: ldr pc, [r12]
@@ -257,14 +275,20 @@ _start:
// CHECKLONG-EB-NEXT: d4 d4 d4 d4 .word 0xd4d4d4d4
// CHECKLONG-EB-NEXT: d4 d4 d4 d4 .word 0xd4d4d4d4
// CHECKLONG-EB-NEXT: d4 d4 d4 d4 .word 0xd4d4d4d4
+// CHECKLONG-EB-EMPTY:
+// CHECKLONG-EB-NEXT: <func1 at plt>:
// CHECKLONG-EB-NEXT: 2020: ldr r12, [pc, #4]
// CHECKLONG-EB-NEXT: add r12, r12, pc
// CHECKLONG-EB-NEXT: ldr pc, [r12]
// CHECKLONG-EB-NEXT: 11 10 f0 e0 .word 0x1110f0e0
+// CHECKLONG-EB-EMPTY:
+// CHECKLONG-EB-NEXT: <func2 at plt>:
// CHECKLONG-EB-NEXT: 2030: ldr r12, [pc, #4]
// CHECKLONG-EB-NEXT: add r12, r12, pc
// CHECKLONG-EB-NEXT: ldr pc, [r12]
// CHECKLONG-EB-NEXT: 11 10 f0 d4 .word 0x1110f0d4
+// CHECKLONG-EB-EMPTY:
+// CHECKLONG-EB-NEXT: <func3 at plt>:
// CHECKLONG-EB-NEXT: 2040: ldr r12, [pc, #4]
// CHECKLONG-EB-NEXT: add r12, r12, pc
// CHECKLONG-EB-NEXT: ldr pc, [r12]
@@ -326,14 +350,20 @@ _start:
// CHECKMIX-NEXT: 2014: d4 d4 d4 d4 .word 0xd4d4d4d4
// CHECKMIX-NEXT: 2018: d4 d4 d4 d4 .word 0xd4d4d4d4
// CHECKMIX-NEXT: 201c: d4 d4 d4 d4 .word 0xd4d4d4d4
+// CHECKMIX-EMPTY:
+// CHECKMIX-NEXT: <func1 at plt>:
// CHECKMIX-NEXT: 2020: ldr r12, [pc, #4]
// CHECKMIX-NEXT: 2024: add r12, r12, pc
// CHECKMIX-NEXT: 2028: ldr pc, [r12]
// CHECKMIX-NEXT: 202c: 00 00 00 08 .word 0x08000000
+// CHECKMIX-EMPTY:
+// CHECKMIX-NEXT: <func2 at plt>:
// CHECKMIX-NEXT: 2030: add r12, pc, #133169152
// CHECKMIX-NEXT: 2034: add r12, r12, #1044480
// CHECKMIX-NEXT: 2038: ldr pc, [r12, #4088]!
// CHECKMIX-NEXT: 203c: d4 d4 d4 d4 .word 0xd4d4d4d4
+// CHECKMIX-EMPTY:
+// CHECKMIX-NEXT: <func3 at plt>:
// CHECKMIX-NEXT: 2040: add r12, pc, #133169152
// CHECKMIX-NEXT: 2044: add r12, r12, #1044480
// CHECKMIX-NEXT: 2048: ldr pc, [r12, #4076]!
@@ -363,14 +393,20 @@ _start:
// CHECKMIX-EB-NEXT: d4 d4 d4 d4 .word 0xd4d4d4d4
// CHECKMIX-EB-NEXT: d4 d4 d4 d4 .word 0xd4d4d4d4
// CHECKMIX-EB-NEXT: d4 d4 d4 d4 .word 0xd4d4d4d4
+// CHECKMIX-EB-EMPTY:
+// CHECKMIX-EB-NEXT: <func1 at plt>:
// CHECKMIX-EB-NEXT: 2020: ldr r12, [pc, #4]
// CHECKMIX-EB-NEXT: add r12, r12, pc
// CHECKMIX-EB-NEXT: ldr pc, [r12]
// CHECKMIX-EB-NEXT: 08 00 00 00 .word 0x08000000
+// CHECKMIX-EB-EMPTY:
+// CHECKMIX-EB-NEXT: <func2 at plt>:
// CHECKMIX-EB-NEXT: 2030: add r12, pc, #133169152
// CHECKMIX-EB-NEXT: add r12, r12, #1044480
// CHECKMIX-EB-NEXT: ldr pc, [r12, #4088]!
// CHECKMIX-EB-NEXT: d4 d4 d4 d4 .word 0xd4d4d4d4
+// CHECKMIX-EB-EMPTY:
+// CHECKMIX-EB-NEXT: <func3 at plt>:
// CHECKMIX-EB-NEXT: 2040: add r12, pc, #133169152
// CHECKMIX-EB-NEXT: add r12, r12, #1044480
// CHECKMIX-EB-NEXT: ldr pc, [r12, #4076]!
diff --git a/lld/test/ELF/arm-thumb-interwork-shared.s b/lld/test/ELF/arm-thumb-interwork-shared.s
index 03bed000a02e6..8a616f9d75797 100644
--- a/lld/test/ELF/arm-thumb-interwork-shared.s
+++ b/lld/test/ELF/arm-thumb-interwork-shared.s
@@ -45,10 +45,14 @@ sym1:
// CHECK-NEXT: .word 0xd4d4d4d4
// CHECK-NEXT: .word 0xd4d4d4d4
// CHECK-NEXT: .word 0xd4d4d4d4
+// CHECK-EMPTY:
+// CHECK-NEXT: <elsewhere at plt>:
// CHECK-NEXT: 10230: add r12, pc, #0, #12
// CHECK-NEXT: add r12, r12, #32
// CHECK-NEXT: ldr pc, [r12, #124]!
// CHECK-NEXT: 1023c: d4 d4 d4 d4 .word 0xd4d4d4d4
+// CHECK-EMPTY:
+// CHECK-NEXT: <weakref at plt>:
// CHECK-NEXT: 10240: add r12, pc, #0, #12
// CHECK-NEXT: add r12, r12, #32
// CHECK-NEXT: ldr pc, [r12, #112]!
diff --git a/lld/test/ELF/arm-thumb-interwork-thunk.s b/lld/test/ELF/arm-thumb-interwork-thunk.s
index 39a2e737cc9d2..a01be31bfd9ae 100644
--- a/lld/test/ELF/arm-thumb-interwork-thunk.s
+++ b/lld/test/ELF/arm-thumb-interwork-thunk.s
@@ -298,34 +298,50 @@ _start:
// CHECK-ARM-PLT-NEXT: 1624: d4 d4 d4 d4 .word 0xd4d4d4d4
// CHECK-ARM-PLT-NEXT: 1628: d4 d4 d4 d4 .word 0xd4d4d4d4
// CHECK-ARM-PLT-NEXT: 162c: d4 d4 d4 d4 .word 0xd4d4d4d4
+// CHECK-ARM-PLT-EMPTY:
+// CHECK-ARM-PLT-NEXT: <thumb_callee1 at plt>
// CHECK-ARM-PLT-NEXT: 1630: add r12, pc, #0, #12
// CHECK-ARM-PLT-NEXT: 1634: add r12, r12, #0, #20
// CHECK-ARM-PLT-NEXT: 1638: ldr pc, [r12, #648]!
// CHECK-ARM-PLT-NEXT: 163c: d4 d4 d4 d4 .word 0xd4d4d4d4
+// CHECK-ARM-PLT-EMPTY:
+// CHECK-ARM-PLT-NEXT: <arm_callee1 at plt>
// CHECK-ARM-PLT-NEXT: 1640: add r12, pc, #0, #12
// CHECK-ARM-PLT-NEXT: 1644: add r12, r12, #0, #20
// CHECK-ARM-PLT-NEXT: 1648: ldr pc, [r12, #636]!
// CHECK-ARM-PLT-NEXT: 164c: d4 d4 d4 d4 .word 0xd4d4d4d4
+// CHECK-ARM-PLT-EMPTY:
+// CHECK-ARM-PLT-NEXT: <arm_caller at plt>
// CHECK-ARM-PLT-NEXT: 1650: add r12, pc, #0, #12
// CHECK-ARM-PLT-NEXT: 1654: add r12, r12, #0, #20
// CHECK-ARM-PLT-NEXT: 1658: ldr pc, [r12, #624]!
// CHECK-ARM-PLT-NEXT: 165c: d4 d4 d4 d4 .word 0xd4d4d4d4
+// CHECK-ARM-PLT-EMPTY:
+// CHECK-ARM-PLT-NEXT: <thumb_callee2 at plt>
// CHECK-ARM-PLT-NEXT: 1660: add r12, pc, #0, #12
// CHECK-ARM-PLT-NEXT: 1664: add r12, r12, #0, #20
// CHECK-ARM-PLT-NEXT: 1668: ldr pc, [r12, #612]!
// CHECK-ARM-PLT-NEXT: 166c: d4 d4 d4 d4 .word 0xd4d4d4d4
+// CHECK-ARM-PLT-EMPTY:
+// CHECK-ARM-PLT-NEXT: <thumb_callee3 at plt>
// CHECK-ARM-PLT-NEXT: 1670: add r12, pc, #0, #12
// CHECK-ARM-PLT-NEXT: 1674: add r12, r12, #0, #20
// CHECK-ARM-PLT-NEXT: 1678: ldr pc, [r12, #600]!
// CHECK-ARM-PLT-NEXT: 167c: d4 d4 d4 d4 .word 0xd4d4d4d4
+// CHECK-ARM-PLT-EMPTY:
+// CHECK-ARM-PLT-NEXT: <arm_callee2 at plt>
// CHECK-ARM-PLT-NEXT: 1680: add r12, pc, #0, #12
// CHECK-ARM-PLT-NEXT: 1684: add r12, r12, #0, #20
// CHECK-ARM-PLT-NEXT: 1688: ldr pc, [r12, #588]!
// CHECK-ARM-PLT-NEXT: 168c: d4 d4 d4 d4 .word 0xd4d4d4d4
+// CHECK-ARM-PLT-EMPTY:
+// CHECK-ARM-PLT-NEXT: <arm_callee3 at plt>
// CHECK-ARM-PLT-NEXT: 1690: add r12, pc, #0, #12
// CHECK-ARM-PLT-NEXT: 1694: add r12, r12, #0, #20
// CHECK-ARM-PLT-NEXT: 1698: ldr pc, [r12, #576]!
// CHECK-ARM-PLT-NEXT: 169c: d4 d4 d4 d4 .word 0xd4d4d4d4
+// CHECK-ARM-PLT-EMPTY:
+// CHECK-ARM-PLT-NEXT: <thumb_caller at plt>
// CHECK-ARM-PLT-NEXT: 16a0: add r12, pc, #0, #12
// CHECK-ARM-PLT-NEXT: 16a4: add r12, r12, #0, #20
// CHECK-ARM-PLT-NEXT: 16a8: ldr pc, [r12, #564]!
diff --git a/lld/test/ELF/arm-thumb-plt-range-thunk-os.s b/lld/test/ELF/arm-thumb-plt-range-thunk-os.s
index 65e7e4b525926..945cef6d4b4d5 100644
--- a/lld/test/ELF/arm-thumb-plt-range-thunk-os.s
+++ b/lld/test/ELF/arm-thumb-plt-range-thunk-os.s
@@ -96,14 +96,20 @@ far_nonpreemptible_alias:
// CHECK4-NEXT: 4000024: d4 d4 d4 d4 .word 0xd4d4d4d4
// CHECK4-NEXT: 4000028: d4 d4 d4 d4 .word 0xd4d4d4d4
// CHECK4-NEXT: 400002c: d4 d4 d4 d4 .word 0xd4d4d4d4
+// CHECK4-EMPTY:
+// CHECK4-NEXT: <elsewhere at plt>:
// CHECK4-NEXT: 4000030: e28fc600 add r12, pc, #0, #12
// CHECK4-NEXT: 4000034: e28cca20 add r12, r12, #32
// CHECK4-NEXT: 4000038: e5bcf08c ldr pc, [r12, #140]!
// CHECK4-NEXT: 400003c: d4 d4 d4 d4 .word 0xd4d4d4d4
+// CHECK4-EMPTY:
+// CHECK4-NEXT: <preemptible at plt>:
// CHECK4-NEXT: 4000040: e28fc600 add r12, pc, #0, #12
// CHECK4-NEXT: 4000044: e28cca20 add r12, r12, #32
// CHECK4-NEXT: 4000048: e5bcf080 ldr pc, [r12, #128]!
// CHECK4-NEXT: 400004c: d4 d4 d4 d4 .word 0xd4d4d4d4
+// CHECK4-EMPTY:
+// CHECK4-NEXT: <far_preemptible at plt>:
// CHECK4-NEXT: 4000050: e28fc600 add r12, pc, #0, #12
// CHECK4-NEXT: 4000054: e28cca20 add r12, r12, #32
// CHECK4-NEXT: 4000058: e5bcf074 ldr pc, [r12, #116]!
diff --git a/lld/test/ELF/arm-thumb-plt-reloc.s b/lld/test/ELF/arm-thumb-plt-reloc.s
index 4a1fd020452c9..9c4674779e3b9 100644
--- a/lld/test/ELF/arm-thumb-plt-reloc.s
+++ b/lld/test/ELF/arm-thumb-plt-reloc.s
@@ -83,16 +83,22 @@ _start:
// DSO-NEXT: 10248: d4 d4 d4 d4 .word 0xd4d4d4d4
// DSO-NEXT: 1024c: d4 d4 d4 d4 .word 0xd4d4d4d4
// (0x10250 + 8) + (0 RoR 12) + (32 RoR 20 = 0x20000) + 140 = 0x302e4
+// DSO-EMPTY:
+// DSO-NEXT: <func1 at plt>:
// DSO-NEXT: 10250: e28fc600 add r12, pc, #0, #12
// DSO-NEXT: 10254: e28cca20 add r12, r12, #32, #20
// DSO-NEXT: 10258: e5bcf08c ldr pc, [r12, #140]!
// DSO-NEXT: 1025c: d4 d4 d4 d4 .word 0xd4d4d4d4
// (0x10260 + 8) + (0 RoR 12) + (32 RoR 20 = 0x20000) + 128 = 0x302e8
+// DSO-EMPTY:
+// DSO-NEXT: <func2 at plt>:
// DSO-NEXT: 10260: e28fc600 add r12, pc, #0, #12
// DSO-NEXT: 10264: e28cca20 add r12, r12, #32, #20
// DSO-NEXT: 10268: e5bcf080 ldr pc, [r12, #128]!
// DSO-NEXT: 1026c: d4 d4 d4 d4 .word 0xd4d4d4d4
// (0x10270 + 8) + (0 RoR 12) + (32 RoR 20 = 0x20000) + 116 = 0x302ec
+// DSO-EMPTY:
+// DSO-NEXT: <func3 at plt>:
// DSO-NEXT: 10270: e28fc600 add r12, pc, #0, #12
// DSO-NEXT: 10274: e28cca20 add r12, r12, #32, #20
// DSO-NEXT: 10278: e5bcf074 ldr pc, [r12, #116]!
diff --git a/lld/test/ELF/arm-thunk-multipass-plt.s b/lld/test/ELF/arm-thunk-multipass-plt.s
index 2e8f054ce3f73..ecf69d58b510e 100644
--- a/lld/test/ELF/arm-thunk-multipass-plt.s
+++ b/lld/test/ELF/arm-thunk-multipass-plt.s
@@ -86,10 +86,14 @@ preemptible2:
// CHECK-PLT-NEXT: d00034: d4 d4 d4 d4 .word 0xd4d4d4d4
// CHECK-PLT-NEXT: d00038: d4 d4 d4 d4 .word 0xd4d4d4d4
// CHECK-PLT-NEXT: d0003c: d4 d4 d4 d4 .word 0xd4d4d4d4
+// CHECK-PLT-EMPTY:
+// CHECK-PLT-NEXT: <preemptible at plt>:
// CHECK-PLT-NEXT: d00040: add r12, pc, #0, #12
// CHECK-PLT-NEXT: d00044: add r12, r12, #32, #20
// CHECK-PLT-NEXT: d00048: ldr pc, [r12, #124]!
// CHECK-PLT-NEXT: d0004c: d4 d4 d4 d4 .word 0xd4d4d4d4
+// CHECK-PLT-EMPTY:
+// CHECK-PLT-NEXT: <preemptible2 at plt>:
// CHECK-PLT-NEXT: d00050: add r12, pc, #0, #12
// CHECK-PLT-NEXT: d00054: add r12, r12, #32, #20
// CHECK-PLT-NEXT: d00058: ldr pc, [r12, #112]!
diff --git a/lld/test/ELF/arm-thunk-re-add.s b/lld/test/ELF/arm-thunk-re-add.s
index 7505ec045fff0..1745237d38829 100644
--- a/lld/test/ELF/arm-thunk-re-add.s
+++ b/lld/test/ELF/arm-thunk-re-add.s
@@ -109,10 +109,14 @@ callers:
// CHECK3-NEXT: 1100034: d4 d4 d4 d4 .word 0xd4d4d4d4
// CHECK3-NEXT: 1100038: d4 d4 d4 d4 .word 0xd4d4d4d4
// CHECK3-NEXT: 110003c: d4 d4 d4 d4 .word 0xd4d4d4d4
+// CHECK3-EMPTY:
+// CHECK3-NEXT: <imported at plt>:
// CHECK3-NEXT: 1100040: e28fc600 add r12, pc, #0, #12
// CHECK3-NEXT: 1100044: e28cca20 add r12, r12, #32
// CHECK3-NEXT: 1100048: e5bcf07c ldr pc, [r12, #124]!
// CHECK3-NEXT: 110004c: d4 d4 d4 d4 .word 0xd4d4d4d4
+// CHECK3-EMPTY:
+// CHECK3-NEXT: <imported2 at plt>:
// CHECK3-NEXT: 1100050: e28fc600 add r12, pc, #0, #12
// CHECK3-NEXT: 1100054: e28cca20 add r12, r12, #32
// CHECK3-NEXT: 1100058: e5bcf070 ldr pc, [r12, #112]!
diff --git a/lld/test/ELF/armv8-thumb-plt-reloc.s b/lld/test/ELF/armv8-thumb-plt-reloc.s
index 5b6e4b5fdd139..df2b960684b93 100644
--- a/lld/test/ELF/armv8-thumb-plt-reloc.s
+++ b/lld/test/ELF/armv8-thumb-plt-reloc.s
@@ -101,18 +101,24 @@ _start:
// DSO-NEXT: .word 0xd4d4d4d4
/// 136 + 2 << 16 + 0x1026c = 0x302f4 = got entry 1
+// DSO-EMPTY:
+// DSO-NEXT: <func1 at plt>:
// DSO-NEXT: 10260: f240 0c88 movw r12, #136
// DSO-NEXT: f2c0 0c02 movt r12, #2
// DSO-NEXT: 44fc add r12, pc
// DSO-NEXT: f8dc f000 ldr.w pc, [r12]
// DSO-NEXT: e7fc b 0x1026a
/// 124 + 2 << 16 + 0x1027c = 0x302f8 = got entry 2
+// DSO-EMPTY:
+// DSO-NEXT: <func2 at plt>:
// DSO-NEXT: 10270: f240 0c7c movw r12, #124
// DSO-NEXT: f2c0 0c02 movt r12, #2
// DSO-NEXT: 44fc add r12, pc
// DSO-NEXT: f8dc f000 ldr.w pc, [r12]
// DSO-NEXT: e7fc b 0x1027a
/// 112 + 2 << 16 + 0x1028c = 0x302fc = got entry 3
+// DSO-EMPTY:
+// DSO-NEXT: <func3 at plt>:
// DSO-NEXT: 10280: f240 0c70 movw r12, #112
// DSO-NEXT: f2c0 0c02 movt r12, #2
// DSO-NEXT: 44fc add r12, pc
diff --git a/llvm/include/llvm/MC/MCInstrAnalysis.h b/llvm/include/llvm/MC/MCInstrAnalysis.h
index b571791c518da..eacadce6b91d9 100644
--- a/llvm/include/llvm/MC/MCInstrAnalysis.h
+++ b/llvm/include/llvm/MC/MCInstrAnalysis.h
@@ -195,7 +195,8 @@ class MCInstrAnalysis {
/// Returns (PLT virtual address, GOT virtual address) pairs for PLT entries.
virtual std::vector<std::pair<uint64_t, uint64_t>>
findPltEntries(uint64_t PltSectionVA, ArrayRef<uint8_t> PltContents,
- const Triple &TargetTriple) const {
+ const Triple &TargetTriple,
+ std::optional<llvm::endianness> InstrEndiannessHint) const {
return {};
}
};
diff --git a/llvm/lib/Object/ELFObjectFile.cpp b/llvm/lib/Object/ELFObjectFile.cpp
index d0897c62b3e8e..c9ff42175dccd 100644
--- a/llvm/lib/Object/ELFObjectFile.cpp
+++ b/llvm/lib/Object/ELFObjectFile.cpp
@@ -798,6 +798,12 @@ std::vector<ELFPltEntry> ELFObjectFileBase::getPltEntries() const {
case Triple::aarch64_be:
JumpSlotReloc = ELF::R_AARCH64_JUMP_SLOT;
break;
+ case Triple::arm:
+ case Triple::armeb:
+ case Triple::thumb:
+ case Triple::thumbeb:
+ JumpSlotReloc = ELF::R_ARM_JUMP_SLOT;
+ break;
case Triple::hexagon:
JumpSlotReloc = ELF::R_HEX_JMP_SLOT;
GlobDatReloc = ELF::R_HEX_GLOB_DAT;
@@ -833,10 +839,18 @@ std::vector<ELFPltEntry> ELFObjectFileBase::getPltEntries() const {
consumeError(PltContents.takeError());
return {};
}
+ std::optional<llvm::endianness> InstrEndianness;
+ if (const auto *Elf32BE = dyn_cast<ELF32BEObjectFile>(this)) {
+ if (!Elf32BE->isRelocatableObject() &&
+ (Elf32BE->getPlatformFlags() & ELF::EF_ARM_BE8)) {
+ InstrEndianness = endianness::little;
+ }
+ }
+
llvm::a...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/130764
More information about the llvm-commits
mailing list