[lld] [llvm] [llvm-objdump][ARM] Find ELF file PLT entries for arm, thumb (PR #130764)
Vladislav Dzhidzhoev via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 11 12:15:52 PDT 2025
https://github.com/dzhidzhoev updated https://github.com/llvm/llvm-project/pull/130764
>From ef5800411c5ca6fc3196e104040c844578bc2198 Mon Sep 17 00:00:00 2001
From: Vladislav Dzhidzhoev <vdzhidzhoev at accesssoftek.com>
Date: Fri, 7 Mar 2025 12:50:35 +0100
Subject: [PATCH 1/3] [llvm-objdump][ARM] Find ELF file PLT entries for arm,
thumb
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.
---
lld/test/ELF/arm-gnu-ifunc-plt.s | 4 +
lld/test/ELF/arm-mixed-plts.s | 2 +
lld/test/ELF/arm-plt-reloc.s | 36 ++++++
lld/test/ELF/arm-thumb-interwork-shared.s | 4 +
lld/test/ELF/arm-thumb-interwork-thunk.s | 16 +++
lld/test/ELF/arm-thumb-plt-range-thunk-os.s | 6 +
lld/test/ELF/arm-thumb-plt-reloc.s | 6 +
lld/test/ELF/arm-thunk-multipass-plt.s | 4 +
lld/test/ELF/arm-thunk-re-add.s | 4 +
lld/test/ELF/armv8-thumb-plt-reloc.s | 6 +
llvm/include/llvm/MC/MCInstrAnalysis.h | 3 +-
llvm/lib/Object/ELFObjectFile.cpp | 20 +++-
.../MCTargetDesc/AArch64MCTargetDesc.cpp | 7 +-
.../ARM/MCTargetDesc/ARMMCTargetDesc.cpp | 106 ++++++++++++++++++
.../MCTargetDesc/HexagonMCTargetDesc.cpp | 7 +-
.../X86/MCTargetDesc/X86MCTargetDesc.cpp | 15 +--
.../tools/llvm-objdump/ELF/ARM/plt-be.test | 81 +++++++++++++
.../tools/llvm-objdump/ELF/ARM/plt-be8.test | 81 +++++++++++++
.../llvm-objdump/ELF/ARM/plt-long-be.test | 84 ++++++++++++++
.../llvm-objdump/ELF/ARM/plt-long-be8.test | 84 ++++++++++++++
.../tools/llvm-objdump/ELF/ARM/plt-long.test | 84 ++++++++++++++
.../llvm-objdump/ELF/ARM/plt-mix-be.test | 93 +++++++++++++++
.../llvm-objdump/ELF/ARM/plt-mix-be8.test | 93 +++++++++++++++
.../tools/llvm-objdump/ELF/ARM/plt-mix.test | 93 +++++++++++++++
.../llvm-objdump/ELF/ARM/plt-thumb-be.test | 91 +++++++++++++++
.../llvm-objdump/ELF/ARM/plt-thumb-be8.test | 97 ++++++++++++++++
.../tools/llvm-objdump/ELF/ARM/plt-thumb.test | 91 +++++++++++++++
llvm/test/tools/llvm-objdump/ELF/ARM/plt.test | 81 +++++++++++++
28 files changed, 1282 insertions(+), 17 deletions(-)
create mode 100644 llvm/test/tools/llvm-objdump/ELF/ARM/plt-be.test
create mode 100644 llvm/test/tools/llvm-objdump/ELF/ARM/plt-be8.test
create mode 100644 llvm/test/tools/llvm-objdump/ELF/ARM/plt-long-be.test
create mode 100644 llvm/test/tools/llvm-objdump/ELF/ARM/plt-long-be8.test
create mode 100644 llvm/test/tools/llvm-objdump/ELF/ARM/plt-long.test
create mode 100644 llvm/test/tools/llvm-objdump/ELF/ARM/plt-mix-be.test
create mode 100644 llvm/test/tools/llvm-objdump/ELF/ARM/plt-mix-be8.test
create mode 100644 llvm/test/tools/llvm-objdump/ELF/ARM/plt-mix.test
create mode 100644 llvm/test/tools/llvm-objdump/ELF/ARM/plt-thumb-be.test
create mode 100644 llvm/test/tools/llvm-objdump/ELF/ARM/plt-thumb-be8.test
create mode 100644 llvm/test/tools/llvm-objdump/ELF/ARM/plt-thumb.test
create mode 100644 llvm/test/tools/llvm-objdump/ELF/ARM/plt.test
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::append_range(
- PltEntries,
- MIA->findPltEntries(Section.getAddress(),
- arrayRefFromStringRef(*PltContents), Triple));
+ PltEntries, MIA->findPltEntries(Section.getAddress(),
+ arrayRefFromStringRef(*PltContents),
+ Triple, InstrEndianness));
}
}
diff --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.cpp b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.cpp
index 7f781811a5058..503810955bdf7 100644
--- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.cpp
+++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.cpp
@@ -463,9 +463,10 @@ class AArch64MCInstrAnalysis : public MCInstrAnalysis {
return Mask.getBoolValue();
}
- std::vector<std::pair<uint64_t, uint64_t>>
- findPltEntries(uint64_t PltSectionVA, ArrayRef<uint8_t> PltContents,
- const Triple &TargetTriple) const override {
+ std::vector<std::pair<uint64_t, uint64_t>> findPltEntries(
+ uint64_t PltSectionVA, ArrayRef<uint8_t> PltContents,
+ const Triple &TargetTriple,
+ std::optional<llvm::endianness> InstrEndiannessHint) const override {
// Do a lightweight parsing of PLT entries.
std::vector<std::pair<uint64_t, uint64_t>> Result;
for (uint64_t Byte = 0, End = PltContents.size(); Byte + 7 < End;
diff --git a/llvm/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp b/llvm/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp
index e1af3150a8403..1e603f73eafef 100644
--- a/llvm/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp
+++ b/llvm/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp
@@ -431,6 +431,112 @@ class ARMMCInstrAnalysis : public MCInstrAnalysis {
std::optional<uint64_t>
evaluateMemoryOperandAddress(const MCInst &Inst, const MCSubtargetInfo *STI,
uint64_t Addr, uint64_t Size) const override;
+
+ std::vector<std::pair<uint64_t, uint64_t>> findPltEntries(
+ uint64_t PltSectionVA, ArrayRef<uint8_t> PltContents,
+ const Triple &TargetTriple,
+ std::optional<llvm::endianness> InstrEndiannessHint) const override {
+ llvm::endianness DataEndianness =
+ TargetTriple.isLittleEndian() ? endianness::little : endianness::big;
+ llvm::endianness InstrEndianness =
+ InstrEndiannessHint.value_or(DataEndianness);
+
+ std::vector<std::pair<uint64_t, uint64_t>> Result;
+ // Do a lightweight parsing of PLT entries.
+ for (uint64_t Byte = 0, End = PltContents.size(); Byte + 12 < End;
+ Byte += 4) {
+ uint32_t InsnPart1 =
+ support::endian::read16(PltContents.data() + Byte, InstrEndianness);
+
+ // Is Thumb? Check for movw.
+ if ((InsnPart1 & 0xffb0) == 0xf200) {
+ uint32_t InsnPart2 = support::endian::read16(
+ PltContents.data() + Byte + 2, InstrEndianness);
+ if ((InsnPart2 & 0x8f00) != 0xc00)
+ continue;
+ uint64_t OffsetLower =
+ (InsnPart2 & 0xff) + ((InsnPart2 & 0x7000) >> 4) +
+ ((InsnPart1 & 0x400) << 1) + ((InsnPart1 & 0xf) << 12);
+ // Check for movt
+ uint32_t Insn2Part1 = support::endian::read16(
+ PltContents.data() + Byte + 4, InstrEndianness);
+ if ((Insn2Part1 & 0xfbf0) != 0xf2c0)
+ continue;
+ uint32_t Insn2Part2 = support::endian::read16(
+ PltContents.data() + Byte + 6, InstrEndianness);
+ if ((Insn2Part2 & 0x8f00) != 0xc00)
+ continue;
+ uint64_t OffsetHigher =
+ ((Insn2Part2 & 0xff) << 16) + ((Insn2Part2 & 0x7000) << 12) +
+ ((Insn2Part1 & 0x400) << 17) + ((Insn2Part1 & 0xf) << 28);
+
+ // Check for add
+ uint32_t Insn3 = support::endian::read16(PltContents.data() + Byte + 8,
+ InstrEndianness);
+ if (Insn3 != 0x44fc)
+ continue;
+ // Check for ldr bottom half
+ uint32_t Insn4 = support::endian::read16(PltContents.data() + Byte + 10,
+ InstrEndianness);
+ if (Insn4 != 0xf8dc)
+ continue;
+ // Check for ldr upper half
+ uint32_t Insn5 = support::endian::read16(PltContents.data() + Byte + 12,
+ InstrEndianness);
+ if (Insn5 != 0xf000)
+ continue;
+ // Check for branch
+ uint32_t Insn6 = support::endian::read16(PltContents.data() + Byte + 14,
+ InstrEndianness);
+ if (Insn6 != 0xe7fc)
+ continue;
+
+ uint64_t Offset =
+ (PltSectionVA + Byte + 12) + OffsetLower + OffsetHigher;
+ Result.emplace_back(PltSectionVA + Byte, Offset);
+ Byte += 12;
+ } else {
+ uint32_t Insn =
+ support::endian::read32(PltContents.data() + Byte, InstrEndianness);
+ // Is it a long entry?
+ if (Insn == 0xe59fc004) {
+ // Check for add
+ if (support::endian::read32(PltContents.data() + Byte + 4,
+ InstrEndianness) != 0xe08cc00f)
+ continue;
+ // Check for ldr
+ if (support::endian::read32(PltContents.data() + Byte + 8,
+ InstrEndianness) != 0xe59cf000)
+ continue;
+ uint64_t Offset = (PltSectionVA + Byte + 12) +
+ support::endian::read32(
+ PltContents.data() + Byte + 12, DataEndianness);
+ Result.emplace_back(PltSectionVA + Byte, Offset);
+ Byte += 12;
+ } else {
+ // Check for first add
+ if ((Insn & 0xe28fc600) != 0xe28fc600)
+ continue;
+ uint32_t Insn2 = support::endian::read32(
+ PltContents.data() + Byte + 4, InstrEndianness);
+ // Check for second add
+ if ((Insn2 & 0xe28cca00) != 0xe28cca00)
+ continue;
+ uint32_t Insn3 = support::endian::read32(
+ PltContents.data() + Byte + 8, InstrEndianness);
+ // Check for ldr
+ if ((Insn3 & 0xe5bcf000) != 0xe5bcf000)
+ continue;
+
+ uint64_t Offset = (PltSectionVA + Byte + 8) + ((Insn & 0xff) << 20) +
+ ((Insn2 & 0xff) << 12) + (Insn3 & 0xfff);
+ Result.emplace_back(PltSectionVA + Byte, Offset);
+ Byte += 8;
+ }
+ }
+ }
+ return Result;
+ }
};
} // namespace
diff --git a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp
index 80e5c10691393..8e94dc08f33ba 100644
--- a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp
+++ b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp
@@ -747,9 +747,10 @@ class HexagonMCInstrAnalysis : public MCInstrAnalysis {
return Result;
}
- std::vector<std::pair<uint64_t, uint64_t>>
- findPltEntries(uint64_t PltSectionVA, ArrayRef<uint8_t> PltContents,
- const Triple &TargetTriple) const override {
+ std::vector<std::pair<uint64_t, uint64_t>> findPltEntries(
+ uint64_t PltSectionVA, ArrayRef<uint8_t> PltContents,
+ const Triple &TargetTriple,
+ std::optional<llvm::endianness> InstrEndiannessHint) const override {
// Do a lightweight parsing of PLT entries.
std::vector<std::pair<uint64_t, uint64_t>> Result;
for (uint64_t Byte = 0x0, End = PltContents.size(); Byte < End; Byte += 4) {
diff --git a/llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp b/llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp
index 1c4d68d5448d6..bad5c327adb77 100644
--- a/llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp
+++ b/llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp
@@ -512,9 +512,10 @@ class X86MCInstrAnalysis : public MCInstrAnalysis {
bool clearsSuperRegisters(const MCRegisterInfo &MRI, const MCInst &Inst,
APInt &Mask) const override;
- std::vector<std::pair<uint64_t, uint64_t>>
- findPltEntries(uint64_t PltSectionVA, ArrayRef<uint8_t> PltContents,
- const Triple &TargetTriple) const override;
+ std::vector<std::pair<uint64_t, uint64_t>> findPltEntries(
+ uint64_t PltSectionVA, ArrayRef<uint8_t> PltContents,
+ const Triple &TargetTriple,
+ std::optional<llvm::endianness> InstrEndiannessHint) const override;
bool evaluateBranch(const MCInst &Inst, uint64_t Addr, uint64_t Size,
uint64_t &Target) const override;
@@ -627,10 +628,10 @@ findX86_64PltEntries(uint64_t PltSectionVA, ArrayRef<uint8_t> PltContents) {
return Result;
}
-std::vector<std::pair<uint64_t, uint64_t>>
-X86MCInstrAnalysis::findPltEntries(uint64_t PltSectionVA,
- ArrayRef<uint8_t> PltContents,
- const Triple &TargetTriple) const {
+std::vector<std::pair<uint64_t, uint64_t>> X86MCInstrAnalysis::findPltEntries(
+ uint64_t PltSectionVA, ArrayRef<uint8_t> PltContents,
+ const Triple &TargetTriple,
+ std::optional<llvm::endianness> InstrEndianness) const {
switch (TargetTriple.getArch()) {
case Triple::x86:
return findX86PltEntries(PltSectionVA, PltContents);
diff --git a/llvm/test/tools/llvm-objdump/ELF/ARM/plt-be.test b/llvm/test/tools/llvm-objdump/ELF/ARM/plt-be.test
new file mode 100644
index 0000000000000..cf73d477f0d0a
--- /dev/null
+++ b/llvm/test/tools/llvm-objdump/ELF/ARM/plt-be.test
@@ -0,0 +1,81 @@
+# RUN: yaml2obj %s -o %t
+# RUN: llvm-objdump -d %t | FileCheck %s
+
+# CHECK: Disassembly of section .text:
+# CHECK: b {{.*}} <func1 at plt>
+# CHECK: bl {{.*}} <func2 at plt>
+# CHECK: beq {{.*}} <func3 at plt>
+
+# CHECK: Disassembly of section .plt:
+# CHECK: <func1 at plt>:
+# CHECK: <func2 at plt>:
+# CHECK: <func3 at plt>:
+
+# Test PLT section parsing on armeb
+
+--- !ELF
+FileHeader:
+ Class: ELFCLASS32
+ Data: ELFDATA2MSB
+ Type: ET_DYN
+ Machine: EM_ARM
+ Flags: [ EF_ARM_SOFT_FLOAT, EF_ARM_EABI_VER5 ]
+ Entry: 0x10220
+Sections:
+ - Name: .rel.plt
+ Type: SHT_REL
+ Flags: [ SHF_ALLOC, SHF_INFO_LINK ]
+ Address: 0x1FC
+ Link: .dynsym
+ AddressAlign: 0x4
+ Info: .got.plt
+ Relocations:
+ - Offset: 0x302E4
+ Symbol: func1
+ Type: R_ARM_JUMP_SLOT
+ - Offset: 0x302E8
+ Symbol: func2
+ Type: R_ARM_JUMP_SLOT
+ - Offset: 0x302EC
+ Symbol: func3
+ Type: R_ARM_JUMP_SLOT
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ Address: 0x10214
+ AddressAlign: 0x4
+ Content: E12FFF1EE12FFF1EE12FFF1EEA00000AEB00000D0A000010
+ - Name: .plt
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ Address: 0x10230
+ AddressAlign: 0x10
+ Content: E52DE004E28FE600E28EEA20E5BEF0A4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4E28FC600E28CCA20E5BCF08CD4D4D4D4E28FC600E28CCA20E5BCF080D4D4D4D4E28FC600E28CCA20E5BCF074D4D4D4D4
+ - Name: .got.plt
+ Type: SHT_PROGBITS
+ Flags: [ SHF_WRITE, SHF_ALLOC ]
+ Address: 0x302D8
+ AddressAlign: 0x4
+ Content: '000000000000000000000000000102300001023000010230'
+DynamicSymbols:
+ - Name: func1
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x10214
+ - Name: func2
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x10218
+ - Name: func3
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x1021C
+ - Name: _start
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x10220
+...
diff --git a/llvm/test/tools/llvm-objdump/ELF/ARM/plt-be8.test b/llvm/test/tools/llvm-objdump/ELF/ARM/plt-be8.test
new file mode 100644
index 0000000000000..5aeed9dbc7d6f
--- /dev/null
+++ b/llvm/test/tools/llvm-objdump/ELF/ARM/plt-be8.test
@@ -0,0 +1,81 @@
+# RUN: yaml2obj %s -o %t
+# RUN: llvm-objdump -d %t | FileCheck %s
+
+# CHECK: Disassembly of section .text:
+# CHECK: b {{.*}} <func1 at plt>
+# CHECK: bl {{.*}} <func2 at plt>
+# CHECK: beq {{.*}} <func3 at plt>
+
+# CHECK: Disassembly of section .plt:
+# CHECK: <func1 at plt>:
+# CHECK: <func2 at plt>:
+# CHECK: <func3 at plt>:
+
+# Test PLT section parsing on armeb with be8
+
+--- !ELF
+FileHeader:
+ Class: ELFCLASS32
+ Data: ELFDATA2MSB
+ Type: ET_DYN
+ Machine: EM_ARM
+ Flags: [ EF_ARM_SOFT_FLOAT, EF_ARM_EABI_VER5, EF_ARM_BE8 ]
+ Entry: 0x10220
+Sections:
+ - Name: .rel.plt
+ Type: SHT_REL
+ Flags: [ SHF_ALLOC, SHF_INFO_LINK ]
+ Address: 0x1FC
+ Link: .dynsym
+ AddressAlign: 0x4
+ Info: .got.plt
+ Relocations:
+ - Offset: 0x302E4
+ Symbol: func1
+ Type: R_ARM_JUMP_SLOT
+ - Offset: 0x302E8
+ Symbol: func2
+ Type: R_ARM_JUMP_SLOT
+ - Offset: 0x302EC
+ Symbol: func3
+ Type: R_ARM_JUMP_SLOT
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ Address: 0x10214
+ AddressAlign: 0x4
+ Content: 1EFF2FE11EFF2FE11EFF2FE10A0000EA0D0000EB1000000A
+ - Name: .plt
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ Address: 0x10230
+ AddressAlign: 0x10
+ Content: 04E02DE500E68FE220EA8EE2A4F0BEE5D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D400C68FE220CA8CE28CF0BCE5D4D4D4D400C68FE220CA8CE280F0BCE5D4D4D4D400C68FE220CA8CE274F0BCE5D4D4D4D4
+ - Name: .got.plt
+ Type: SHT_PROGBITS
+ Flags: [ SHF_WRITE, SHF_ALLOC ]
+ Address: 0x302D8
+ AddressAlign: 0x4
+ Content: '000000000000000000000000000102300001023000010230'
+DynamicSymbols:
+ - Name: func1
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x10214
+ - Name: func2
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x10218
+ - Name: func3
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x1021C
+ - Name: _start
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x10220
+...
diff --git a/llvm/test/tools/llvm-objdump/ELF/ARM/plt-long-be.test b/llvm/test/tools/llvm-objdump/ELF/ARM/plt-long-be.test
new file mode 100644
index 0000000000000..7a0d388ed4044
--- /dev/null
+++ b/llvm/test/tools/llvm-objdump/ELF/ARM/plt-long-be.test
@@ -0,0 +1,84 @@
+# RUN: yaml2obj %s -o %t
+# RUN: llvm-objdump -d %t | FileCheck %s
+
+# CHECK: Disassembly of section .text:
+# CHECK: b {{.*}} <func1 at plt>
+# CHECK: bl {{.*}} <func2 at plt>
+# CHECK: beq {{.*}} <func3 at plt>
+
+# CHECK: Disassembly of section .plt:
+# CHECK: <func1 at plt>:
+# CHECK: <func2 at plt>:
+# CHECK: <func3 at plt>:
+
+# Test PLT section with long entries parsing on armeb
+
+--- !ELF
+FileHeader:
+ Class: ELFCLASS32
+ Data: ELFDATA2MSB
+ Type: ET_DYN
+ Machine: EM_ARM
+ Flags: [ EF_ARM_SOFT_FLOAT, EF_ARM_EABI_VER5 ]
+ Entry: 0x100C
+Sections:
+ - Name: .rel.plt
+ Type: SHT_REL
+ Flags: [ SHF_ALLOC, SHF_INFO_LINK ]
+ Address: 0x9C
+ Link: .dynsym
+ AddressAlign: 0x4
+ Info: .got.plt
+ Relocations:
+ - Offset: 0x1111110C
+ Symbol: func1
+ Type: R_ARM_JUMP_SLOT
+ - Offset: 0x11111110
+ Symbol: func2
+ Type: R_ARM_JUMP_SLOT
+ - Offset: 0x11111114
+ Symbol: func3
+ Type: R_ARM_JUMP_SLOT
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ Address: 0x1000
+ AddressAlign: 0x4
+ Offset: 0x11000
+ Content: E12FFF1EE12FFF1EE12FFF1EEA000403EB0004060A000409
+ - Name: .plt
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ Address: 0x2000
+ AddressAlign: 0x10
+ Offset: 0x12000
+ Content: E52DE004E59FE004E08FE00EE5BEF0081110F0F0D4D4D4D4D4D4D4D4D4D4D4D4E59FC004E08CC00FE59CF0001110F0E0E59FC004E08CC00FE59CF0001110F0D4E59FC004E08CC00FE59CF0001110F0C8
+ - Name: .got.plt
+ Type: SHT_PROGBITS
+ Flags: [ SHF_WRITE, SHF_ALLOC ]
+ Address: 0x11111100
+ AddressAlign: 0x4
+ Offset: 0x21100
+ Content: '000000000000000000000000000020000000200000002000'
+DynamicSymbols:
+ - Name: func1
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x1000
+ - Name: func2
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x1004
+ - Name: func3
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x1008
+ - Name: _start
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x100C
+...
diff --git a/llvm/test/tools/llvm-objdump/ELF/ARM/plt-long-be8.test b/llvm/test/tools/llvm-objdump/ELF/ARM/plt-long-be8.test
new file mode 100644
index 0000000000000..03bbbfd0e911f
--- /dev/null
+++ b/llvm/test/tools/llvm-objdump/ELF/ARM/plt-long-be8.test
@@ -0,0 +1,84 @@
+# RUN: yaml2obj %s -o %t
+# RUN: llvm-objdump -d %t | FileCheck %s
+
+# CHECK: Disassembly of section .text:
+# CHECK: b {{.*}} <func1 at plt>
+# CHECK: bl {{.*}} <func2 at plt>
+# CHECK: beq {{.*}} <func3 at plt>
+
+# CHECK: Disassembly of section .plt:
+# CHECK: <func1 at plt>:
+# CHECK: <func2 at plt>:
+# CHECK: <func3 at plt>:
+
+# Test PLT section with long entries parsing on armeb with be8
+
+--- !ELF
+FileHeader:
+ Class: ELFCLASS32
+ Data: ELFDATA2MSB
+ Type: ET_DYN
+ Machine: EM_ARM
+ Flags: [ EF_ARM_SOFT_FLOAT, EF_ARM_EABI_VER5, EF_ARM_BE8 ]
+ Entry: 0x100C
+Sections:
+ - Name: .rel.plt
+ Type: SHT_REL
+ Flags: [ SHF_ALLOC, SHF_INFO_LINK ]
+ Address: 0x9C
+ Link: .dynsym
+ AddressAlign: 0x4
+ Info: .got.plt
+ Relocations:
+ - Offset: 0x1111110C
+ Symbol: func1
+ Type: R_ARM_JUMP_SLOT
+ - Offset: 0x11111110
+ Symbol: func2
+ Type: R_ARM_JUMP_SLOT
+ - Offset: 0x11111114
+ Symbol: func3
+ Type: R_ARM_JUMP_SLOT
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ Address: 0x1000
+ AddressAlign: 0x4
+ Offset: 0x11000
+ Content: 1EFF2FE11EFF2FE11EFF2FE1030400EA060400EB0904000A
+ - Name: .plt
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ Address: 0x2000
+ AddressAlign: 0x10
+ Offset: 0x12000
+ Content: 04E02DE504E09FE50EE08FE008F0BEE51110F0F0D4D4D4D4D4D4D4D4D4D4D4D404C09FE50FC08CE000F09CE51110F0E004C09FE50FC08CE000F09CE51110F0D404C09FE50FC08CE000F09CE51110F0C8
+ - Name: .got.plt
+ Type: SHT_PROGBITS
+ Flags: [ SHF_WRITE, SHF_ALLOC ]
+ Address: 0x11111100
+ AddressAlign: 0x4
+ Offset: 0x21100
+ Content: '000000000000000000000000000020000000200000002000'
+DynamicSymbols:
+ - Name: func1
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x1000
+ - Name: func2
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x1004
+ - Name: func3
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x1008
+ - Name: _start
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x100C
+...
diff --git a/llvm/test/tools/llvm-objdump/ELF/ARM/plt-long.test b/llvm/test/tools/llvm-objdump/ELF/ARM/plt-long.test
new file mode 100644
index 0000000000000..7dcf82099e7e1
--- /dev/null
+++ b/llvm/test/tools/llvm-objdump/ELF/ARM/plt-long.test
@@ -0,0 +1,84 @@
+# RUN: yaml2obj %s -o %t
+# RUN: llvm-objdump -d %t | FileCheck %s
+
+# CHECK: Disassembly of section .text:
+# CHECK: b {{.*}} <func1 at plt>
+# CHECK: bl {{.*}} <func2 at plt>
+# CHECK: beq {{.*}} <func3 at plt>
+
+# CHECK: Disassembly of section .plt:
+# CHECK: <func1 at plt>:
+# CHECK: <func2 at plt>:
+# CHECK: <func3 at plt>:
+
+# Test PLT section with long entries parsing on arm
+
+--- !ELF
+FileHeader:
+ Class: ELFCLASS32
+ Data: ELFDATA2LSB
+ Type: ET_DYN
+ Machine: EM_ARM
+ Flags: [ EF_ARM_SOFT_FLOAT, EF_ARM_EABI_VER5 ]
+ Entry: 0x100C
+Sections:
+ - Name: .rel.plt
+ Type: SHT_REL
+ Flags: [ SHF_ALLOC, SHF_INFO_LINK ]
+ Address: 0x9C
+ Link: .dynsym
+ AddressAlign: 0x4
+ Info: .got.plt
+ Relocations:
+ - Offset: 0x1111110C
+ Symbol: func1
+ Type: R_ARM_JUMP_SLOT
+ - Offset: 0x11111110
+ Symbol: func2
+ Type: R_ARM_JUMP_SLOT
+ - Offset: 0x11111114
+ Symbol: func3
+ Type: R_ARM_JUMP_SLOT
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ Address: 0x1000
+ AddressAlign: 0x4
+ Offset: 0x11000
+ Content: 1EFF2FE11EFF2FE11EFF2FE1030400EA060400EB0904000A
+ - Name: .plt
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ Address: 0x2000
+ AddressAlign: 0x10
+ Offset: 0x12000
+ Content: 04E02DE504E09FE50EE08FE008F0BEE5F0F01011D4D4D4D4D4D4D4D4D4D4D4D404C09FE50FC08CE000F09CE5E0F0101104C09FE50FC08CE000F09CE5D4F0101104C09FE50FC08CE000F09CE5C8F01011
+ - Name: .got.plt
+ Type: SHT_PROGBITS
+ Flags: [ SHF_WRITE, SHF_ALLOC ]
+ Address: 0x11111100
+ AddressAlign: 0x4
+ Offset: 0x21100
+ Content: '000000000000000000000000002000000020000000200000'
+DynamicSymbols:
+ - Name: func1
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x1000
+ - Name: func2
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x1004
+ - Name: func3
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x1008
+ - Name: _start
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x100C
+...
diff --git a/llvm/test/tools/llvm-objdump/ELF/ARM/plt-mix-be.test b/llvm/test/tools/llvm-objdump/ELF/ARM/plt-mix-be.test
new file mode 100644
index 0000000000000..3c5813d66a2bb
--- /dev/null
+++ b/llvm/test/tools/llvm-objdump/ELF/ARM/plt-mix-be.test
@@ -0,0 +1,93 @@
+# RUN: yaml2obj %s -o %t
+# RUN: llvm-objdump -d %t | FileCheck %s
+
+# CHECK: Disassembly of section .text:
+# CHECK: b {{.*}} <func1 at plt>
+# CHECK: bl {{.*}} <func2 at plt>
+# CHECK: beq {{.*}} <func3 at plt>
+
+# CHECK: Disassembly of section .plt:
+# CHECK: <func1 at plt>:
+# CHECK-NEXT: ldr
+# CHECK-NEXT: add
+# CHECK-NEXT: ldr
+# CHECK: <func2 at plt>:
+# CHECK-NEXT: add
+# CHECK-NEXT: add
+# CHECK-NEXT: ldr
+# CHECK: <func3 at plt>:
+# CHECK-NEXT: add
+# CHECK-NEXT: add
+# CHECK-NEXT: ldr
+
+# Test PLT section with mixed long and short entries parsing on armeb
+
+--- !ELF
+FileHeader:
+ Class: ELFCLASS32
+ Data: ELFDATA2MSB
+ Type: ET_DYN
+ Machine: EM_ARM
+ Flags: [ EF_ARM_SOFT_FLOAT, EF_ARM_EABI_VER5 ]
+ Entry: 0x100C
+Sections:
+ - Name: .rel.plt
+ Type: SHT_REL
+ Flags: [ SHF_ALLOC, SHF_INFO_LINK ]
+ Address: 0x9C
+ Link: .dynsym
+ AddressAlign: 0x4
+ Info: .got.plt
+ Relocations:
+ - Offset: 0x800202C
+ Symbol: func1
+ Type: R_ARM_JUMP_SLOT
+ - Offset: 0x8002030
+ Symbol: func2
+ Type: R_ARM_JUMP_SLOT
+ - Offset: 0x8002034
+ Symbol: func3
+ Type: R_ARM_JUMP_SLOT
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ Address: 0x1000
+ AddressAlign: 0x4
+ Offset: 0x11000
+ Content: E12FFF1EE12FFF1EE12FFF1EEA000403EB0004060A000409
+ - Name: .plt
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ Address: 0x2000
+ AddressAlign: 0x10
+ Offset: 0x12000
+ Content: E52DE004E59FE004E08FE00EE5BEF00808000010D4D4D4D4D4D4D4D4D4D4D4D4E59FC004E08CC00FE59CF00008000000E28FC67FE28CCAFFE5BCFFF8D4D4D4D4E28FC67FE28CCAFFE5BCFFECD4D4D4D4
+ - Name: .got.plt
+ Type: SHT_PROGBITS
+ Flags: [ SHF_WRITE, SHF_ALLOC ]
+ Address: 0x8002020
+ AddressAlign: 0x4
+ Offset: 0x22020
+ Content: '000000000000000000000000000020000000200000002000'
+DynamicSymbols:
+ - Name: func1
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x1000
+ - Name: func2
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x1004
+ - Name: func3
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x1008
+ - Name: _start
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x100C
+...
diff --git a/llvm/test/tools/llvm-objdump/ELF/ARM/plt-mix-be8.test b/llvm/test/tools/llvm-objdump/ELF/ARM/plt-mix-be8.test
new file mode 100644
index 0000000000000..633485de2da08
--- /dev/null
+++ b/llvm/test/tools/llvm-objdump/ELF/ARM/plt-mix-be8.test
@@ -0,0 +1,93 @@
+# RUN: yaml2obj %s -o %t
+# RUN: llvm-objdump -d %t | FileCheck %s
+
+# CHECK: Disassembly of section .text:
+# CHECK: b {{.*}} <func1 at plt>
+# CHECK: bl {{.*}} <func2 at plt>
+# CHECK: beq {{.*}} <func3 at plt>
+
+# CHECK: Disassembly of section .plt:
+# CHECK: <func1 at plt>:
+# CHECK-NEXT: ldr
+# CHECK-NEXT: add
+# CHECK-NEXT: ldr
+# CHECK: <func2 at plt>:
+# CHECK-NEXT: add
+# CHECK-NEXT: add
+# CHECK-NEXT: ldr
+# CHECK: <func3 at plt>:
+# CHECK-NEXT: add
+# CHECK-NEXT: add
+# CHECK-NEXT: ldr
+
+# Test PLT section with mixed long and short entries parsing on armeb with be8
+
+--- !ELF
+FileHeader:
+ Class: ELFCLASS32
+ Data: ELFDATA2MSB
+ Type: ET_DYN
+ Machine: EM_ARM
+ Flags: [ EF_ARM_SOFT_FLOAT, EF_ARM_EABI_VER5, EF_ARM_BE8 ]
+ Entry: 0x100C
+Sections:
+ - Name: .rel.plt
+ Type: SHT_REL
+ Flags: [ SHF_ALLOC, SHF_INFO_LINK ]
+ Address: 0x9C
+ Link: .dynsym
+ AddressAlign: 0x4
+ Info: .got.plt
+ Relocations:
+ - Offset: 0x800202C
+ Symbol: func1
+ Type: R_ARM_JUMP_SLOT
+ - Offset: 0x8002030
+ Symbol: func2
+ Type: R_ARM_JUMP_SLOT
+ - Offset: 0x8002034
+ Symbol: func3
+ Type: R_ARM_JUMP_SLOT
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ Address: 0x1000
+ AddressAlign: 0x4
+ Offset: 0x11000
+ Content: 1EFF2FE11EFF2FE11EFF2FE1030400EA060400EB0904000A
+ - Name: .plt
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ Address: 0x2000
+ AddressAlign: 0x10
+ Offset: 0x12000
+ Content: 04E02DE504E09FE50EE08FE008F0BEE508000010D4D4D4D4D4D4D4D4D4D4D4D404C09FE50FC08CE000F09CE5080000007FC68FE2FFCA8CE2F8FFBCE5D4D4D4D47FC68FE2FFCA8CE2ECFFBCE5D4D4D4D4
+ - Name: .got.plt
+ Type: SHT_PROGBITS
+ Flags: [ SHF_WRITE, SHF_ALLOC ]
+ Address: 0x8002020
+ AddressAlign: 0x4
+ Offset: 0x22020
+ Content: '000000000000000000000000000020000000200000002000'
+DynamicSymbols:
+ - Name: func1
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x1000
+ - Name: func2
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x1004
+ - Name: func3
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x1008
+ - Name: _start
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x100C
+...
diff --git a/llvm/test/tools/llvm-objdump/ELF/ARM/plt-mix.test b/llvm/test/tools/llvm-objdump/ELF/ARM/plt-mix.test
new file mode 100644
index 0000000000000..6e117f5a27cd5
--- /dev/null
+++ b/llvm/test/tools/llvm-objdump/ELF/ARM/plt-mix.test
@@ -0,0 +1,93 @@
+# RUN: yaml2obj %s -o %t
+# RUN: llvm-objdump -d %t | FileCheck %s
+
+# CHECK: Disassembly of section .text:
+# CHECK: b {{.*}} <func1 at plt>
+# CHECK: bl {{.*}} <func2 at plt>
+# CHECK: beq {{.*}} <func3 at plt>
+
+# CHECK: Disassembly of section .plt:
+# CHECK: <func1 at plt>:
+# CHECK-NEXT: ldr
+# CHECK-NEXT: add
+# CHECK-NEXT: ldr
+# CHECK: <func2 at plt>:
+# CHECK-NEXT: add
+# CHECK-NEXT: add
+# CHECK-NEXT: ldr
+# CHECK: <func3 at plt>:
+# CHECK-NEXT: add
+# CHECK-NEXT: add
+# CHECK-NEXT: ldr
+
+# Test PLT section with mixed long and short entries parsing on arm
+
+--- !ELF
+FileHeader:
+ Class: ELFCLASS32
+ Data: ELFDATA2LSB
+ Type: ET_DYN
+ Machine: EM_ARM
+ Flags: [ EF_ARM_SOFT_FLOAT, EF_ARM_EABI_VER5 ]
+ Entry: 0x100C
+Sections:
+ - Name: .rel.plt
+ Type: SHT_REL
+ Flags: [ SHF_ALLOC, SHF_INFO_LINK ]
+ Address: 0x9C
+ Link: .dynsym
+ AddressAlign: 0x4
+ Info: .got.plt
+ Relocations:
+ - Offset: 0x800202C
+ Symbol: func1
+ Type: R_ARM_JUMP_SLOT
+ - Offset: 0x8002030
+ Symbol: func2
+ Type: R_ARM_JUMP_SLOT
+ - Offset: 0x8002034
+ Symbol: func3
+ Type: R_ARM_JUMP_SLOT
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ Address: 0x1000
+ AddressAlign: 0x4
+ Offset: 0x11000
+ Content: 1EFF2FE11EFF2FE11EFF2FE1030400EA060400EB0904000A
+ - Name: .plt
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ Address: 0x2000
+ AddressAlign: 0x10
+ Offset: 0x12000
+ Content: 04E02DE504E09FE50EE08FE008F0BEE510000008D4D4D4D4D4D4D4D4D4D4D4D404C09FE50FC08CE000F09CE5000000087FC68FE2FFCA8CE2F8FFBCE5D4D4D4D47FC68FE2FFCA8CE2ECFFBCE5D4D4D4D4
+ - Name: .got.plt
+ Type: SHT_PROGBITS
+ Flags: [ SHF_WRITE, SHF_ALLOC ]
+ Address: 0x8002020
+ AddressAlign: 0x4
+ Offset: 0x22020
+ Content: '000000000000000000000000002000000020000000200000'
+DynamicSymbols:
+ - Name: func1
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x1000
+ - Name: func2
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x1004
+ - Name: func3
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x1008
+ - Name: _start
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x100C
+...
diff --git a/llvm/test/tools/llvm-objdump/ELF/ARM/plt-thumb-be.test b/llvm/test/tools/llvm-objdump/ELF/ARM/plt-thumb-be.test
new file mode 100644
index 0000000000000..4d58ab7a62af7
--- /dev/null
+++ b/llvm/test/tools/llvm-objdump/ELF/ARM/plt-thumb-be.test
@@ -0,0 +1,91 @@
+# RUN: yaml2obj %s -o %t
+# RUN: llvm-objdump --no-print-imm-hex -d %t | FileCheck %s
+
+# CHECK: Disassembly of section .text:
+# CHECK: bl {{.*}} <func1 at plt>
+# CHECK: bl {{.*}} <func2 at plt>
+# CHECK: bl {{.*}} <func3 at plt>
+# CHECK: b.w {{.*}} <func1 at plt>
+# CHECK: b.w {{.*}} <func2 at plt>
+# CHECK: b.w {{.*}} <func3 at plt>
+# CHECK: beq.w {{.*}} <func1 at plt>
+# CHECK: beq.w {{.*}} <func2 at plt>
+# CHECK: beq.w {{.*}} <func3 at plt>
+
+# CHECK: Disassembly of section .plt:
+# CHECK: <func1 at plt>:
+# CHECK: <func2 at plt>:
+# CHECK: <func3 at plt>:
+
+# Test PLT section parsing on thumbeb
+
+--- !ELF
+FileHeader:
+ Class: ELFCLASS32
+ Data: ELFDATA2MSB
+ Type: ET_DYN
+ Machine: EM_ARM
+ Flags: [ EF_ARM_SOFT_FLOAT, EF_ARM_EABI_VER5 ]
+ Entry: 0x1021D
+Sections:
+ - Name: .rel.plt
+ Type: SHT_REL
+ Flags: [ SHF_ALLOC, SHF_INFO_LINK ]
+ Address: 0x1FC
+ Link: .dynsym
+ AddressAlign: 0x4
+ Info: .got.plt
+ Relocations:
+ - Offset: 0x302F4
+ Symbol: func1
+ Type: R_ARM_JUMP_SLOT
+ - Offset: 0x302F8
+ Symbol: func2
+ Type: R_ARM_JUMP_SLOT
+ - Offset: 0x302FC
+ Symbol: func3
+ Type: R_ARM_JUMP_SLOT
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ Address: 0x10214
+ AddressAlign: 0x4
+ Content: 477047704770D4D4F000F820F000F826F000F82CF000B81AF000B820F000B826F0008014F000801AF0008020
+ - Name: .plt
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ Address: 0x10240
+ AddressAlign: 0x10
+ Content: B500F8DFE00844FEF85EFF0800020098D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4F2400C88F2C00C0244FCF8DCF000E7FCF2400C7CF2C00C0244FCF8DCF000E7FCF2400C70F2C00C0244FCF8DCF000E7FC
+ - Name: .got.plt
+ Type: SHT_PROGBITS
+ Flags: [ SHF_WRITE, SHF_ALLOC ]
+ Address: 0x302E8
+ AddressAlign: 0x4
+ Content: '000000000000000000000000000102400001024000010240'
+ - Name: .ARM.attributes
+ Type: SHT_ARM_ATTRIBUTES
+ AddressAlign: 0x1
+ Content: 410000002D616561626900010000002305636F727465782D6D3333000611074D080009030A081B01220124012E01
+DynamicSymbols:
+ - Name: func1
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x10215
+ - Name: func2
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x10217
+ - Name: func3
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x10219
+ - Name: _start
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x1021D
+...
diff --git a/llvm/test/tools/llvm-objdump/ELF/ARM/plt-thumb-be8.test b/llvm/test/tools/llvm-objdump/ELF/ARM/plt-thumb-be8.test
new file mode 100644
index 0000000000000..c2a22725590a9
--- /dev/null
+++ b/llvm/test/tools/llvm-objdump/ELF/ARM/plt-thumb-be8.test
@@ -0,0 +1,97 @@
+# RUN: yaml2obj %s -o %t
+# RUN: llvm-objdump --no-print-imm-hex -d %t | FileCheck %s
+
+# CHECK: Disassembly of section .text:
+# CHECK: bl {{.*}} <func1 at plt>
+# CHECK: bl {{.*}} <func2 at plt>
+# CHECK: bl {{.*}} <func3 at plt>
+# CHECK: b.w {{.*}} <func1 at plt>
+# CHECK: b.w {{.*}} <func2 at plt>
+# CHECK: b.w {{.*}} <func3 at plt>
+# CHECK: beq.w {{.*}} <func1 at plt>
+# CHECK: beq.w {{.*}} <func2 at plt>
+# CHECK: beq.w {{.*}} <func3 at plt>
+
+# CHECK: Disassembly of section .plt:
+# CHECK: <func1 at plt>:
+# CHECK: <func2 at plt>:
+# CHECK: <func3 at plt>:
+
+# Test PLT section parsing on thumbeb with be8
+
+--- !ELF
+FileHeader:
+ Class: ELFCLASS32
+ Data: ELFDATA2MSB
+ Type: ET_DYN
+ Machine: EM_ARM
+ Flags: [ EF_ARM_SOFT_FLOAT, EF_ARM_EABI_VER5, EF_ARM_BE8 ]
+ Entry: 0x1021D
+Sections:
+ - Name: .rel.plt
+ Type: SHT_REL
+ Flags: [ SHF_ALLOC, SHF_INFO_LINK ]
+ Address: 0x1FC
+ Link: .dynsym
+ AddressAlign: 0x4
+ Info: .got.plt
+ Relocations:
+ - Offset: 0x302F4
+ Symbol: func1
+ Type: R_ARM_JUMP_SLOT
+ - Offset: 0x302F8
+ Symbol: func2
+ Type: R_ARM_JUMP_SLOT
+ - Offset: 0x302FC
+ Symbol: func3
+ Type: R_ARM_JUMP_SLOT
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ Address: 0x10214
+ AddressAlign: 0x4
+ Content: 704770477047D4D400F020F800F026F800F02CF800F01AB800F020B800F026B800F0148000F01A8000F02080
+ - Name: .plt
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ Address: 0x10240
+ AddressAlign: 0x10
+ Content: 00B5DFF808E0FE445EF808FF00020098D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D440F2880CC0F2020CFC44DCF800F0FCE740F27C0CC0F2020CFC44DCF800F0FCE740F2700CC0F2020CFC44DCF800F0FCE7
+ - Name: .got.plt
+ Type: SHT_PROGBITS
+ Flags: [ SHF_WRITE, SHF_ALLOC ]
+ Address: 0x302E8
+ AddressAlign: 0x4
+ Content: '000000000000000000000000000102400001024000010240'
+ - Name: .ARM.attributes
+ Type: SHT_ARM_ATTRIBUTES
+ AddressAlign: 0x1
+ Content: 410000002D616561626900010000002305636F727465782D6D3333000611074D080009030A081B01220124012E01
+ - Name: .comment
+ Type: SHT_PROGBITS
+ Flags: [ SHF_MERGE, SHF_STRINGS ]
+ AddressAlign: 0x1
+ EntSize: 0x1
+ Content: 4C4C4420312E3000
+DynamicSymbols:
+ - Name: func1
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x10215
+ - Name: func2
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x10217
+ - Name: func3
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x10219
+ - Name: _start
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x1021D
+...
diff --git a/llvm/test/tools/llvm-objdump/ELF/ARM/plt-thumb.test b/llvm/test/tools/llvm-objdump/ELF/ARM/plt-thumb.test
new file mode 100644
index 0000000000000..41bf1ec882a19
--- /dev/null
+++ b/llvm/test/tools/llvm-objdump/ELF/ARM/plt-thumb.test
@@ -0,0 +1,91 @@
+# RUN: yaml2obj %s -o %t
+# RUN: llvm-objdump --no-print-imm-hex -d %t | FileCheck %s
+
+# CHECK: Disassembly of section .text:
+# CHECK: bl {{.*}} <func1 at plt>
+# CHECK: bl {{.*}} <func2 at plt>
+# CHECK: bl {{.*}} <func3 at plt>
+# CHECK: b.w {{.*}} <func1 at plt>
+# CHECK: b.w {{.*}} <func2 at plt>
+# CHECK: b.w {{.*}} <func3 at plt>
+# CHECK: beq.w {{.*}} <func1 at plt>
+# CHECK: beq.w {{.*}} <func2 at plt>
+# CHECK: beq.w {{.*}} <func3 at plt>
+
+# CHECK: Disassembly of section .plt:
+# CHECK: <func1 at plt>:
+# CHECK: <func2 at plt>:
+# CHECK: <func3 at plt>:
+
+# Test PLT section parsing on thumb
+
+--- !ELF
+FileHeader:
+ Class: ELFCLASS32
+ Data: ELFDATA2LSB
+ Type: ET_DYN
+ Machine: EM_ARM
+ Flags: [ EF_ARM_SOFT_FLOAT, EF_ARM_EABI_VER5 ]
+ Entry: 0x1021D
+Sections:
+ - Name: .rel.plt
+ Type: SHT_REL
+ Flags: [ SHF_ALLOC, SHF_INFO_LINK ]
+ Address: 0x1FC
+ Link: .dynsym
+ AddressAlign: 0x4
+ Info: .got.plt
+ Relocations:
+ - Offset: 0x302F4
+ Symbol: func1
+ Type: R_ARM_JUMP_SLOT
+ - Offset: 0x302F8
+ Symbol: func2
+ Type: R_ARM_JUMP_SLOT
+ - Offset: 0x302FC
+ Symbol: func3
+ Type: R_ARM_JUMP_SLOT
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ Address: 0x10214
+ AddressAlign: 0x4
+ Content: 704770477047D4D400F020F800F026F800F02CF800F01AB800F020B800F026B800F0148000F01A8000F02080
+ - Name: .plt
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ Address: 0x10240
+ AddressAlign: 0x10
+ Content: 00B5DFF808E0FE445EF808FF98000200D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D440F2880CC0F2020CFC44DCF800F0FCE740F27C0CC0F2020CFC44DCF800F0FCE740F2700CC0F2020CFC44DCF800F0FCE7
+ - Name: .got.plt
+ Type: SHT_PROGBITS
+ Flags: [ SHF_WRITE, SHF_ALLOC ]
+ Address: 0x302E8
+ AddressAlign: 0x4
+ Content: '000000000000000000000000400201004002010040020100'
+ - Name: .ARM.attributes
+ Type: SHT_ARM_ATTRIBUTES
+ AddressAlign: 0x1
+ Content: 412D000000616561626900012300000005636F727465782D6D3333000611074D080009030A081B01220124012E01
+DynamicSymbols:
+ - Name: func1
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x10215
+ - Name: func2
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x10217
+ - Name: func3
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x10219
+ - Name: _start
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x1021D
+...
diff --git a/llvm/test/tools/llvm-objdump/ELF/ARM/plt.test b/llvm/test/tools/llvm-objdump/ELF/ARM/plt.test
new file mode 100644
index 0000000000000..5da7a7f91b98b
--- /dev/null
+++ b/llvm/test/tools/llvm-objdump/ELF/ARM/plt.test
@@ -0,0 +1,81 @@
+# RUN: yaml2obj %s -o %t
+# RUN: llvm-objdump -d %t | FileCheck %s
+
+# CHECK: Disassembly of section .text:
+# CHECK: b {{.*}} <func1 at plt>
+# CHECK: bl {{.*}} <func2 at plt>
+# CHECK: beq {{.*}} <func3 at plt>
+
+# CHECK: Disassembly of section .plt:
+# CHECK: <func1 at plt>:
+# CHECK: <func2 at plt>:
+# CHECK: <func3 at plt>:
+
+# Test PLT section parsing on arm
+
+--- !ELF
+FileHeader:
+ Class: ELFCLASS32
+ Data: ELFDATA2LSB
+ Type: ET_DYN
+ Machine: EM_ARM
+ Flags: [ EF_ARM_SOFT_FLOAT, EF_ARM_EABI_VER5 ]
+ Entry: 0x10220
+Sections:
+ - Name: .rel.plt
+ Type: SHT_REL
+ Flags: [ SHF_ALLOC, SHF_INFO_LINK ]
+ Address: 0x1FC
+ Link: .dynsym
+ AddressAlign: 0x4
+ Info: .got.plt
+ Relocations:
+ - Offset: 0x302E4
+ Symbol: func1
+ Type: R_ARM_JUMP_SLOT
+ - Offset: 0x302E8
+ Symbol: func2
+ Type: R_ARM_JUMP_SLOT
+ - Offset: 0x302EC
+ Symbol: func3
+ Type: R_ARM_JUMP_SLOT
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ Address: 0x10214
+ AddressAlign: 0x4
+ Content: 1EFF2FE11EFF2FE11EFF2FE10A0000EA0D0000EB1000000A
+ - Name: .plt
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ Address: 0x10230
+ AddressAlign: 0x10
+ Content: 04E02DE500E68FE220EA8EE2A4F0BEE5D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D400C68FE220CA8CE28CF0BCE5D4D4D4D400C68FE220CA8CE280F0BCE5D4D4D4D400C68FE220CA8CE274F0BCE5D4D4D4D4
+ - Name: .got.plt
+ Type: SHT_PROGBITS
+ Flags: [ SHF_WRITE, SHF_ALLOC ]
+ Address: 0x302D8
+ AddressAlign: 0x4
+ Content: '000000000000000000000000300201003002010030020100'
+DynamicSymbols:
+ - Name: func1
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x10214
+ - Name: func2
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x10218
+ - Name: func3
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x1021C
+ - Name: _start
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x10220
+...
>From 7d7c9bae93ba3c3282907a2b7ec3d4ab9e18ff85 Mon Sep 17 00:00:00 2001
From: Vladislav Dzhidzhoev <vdzhidzhoev at accesssoftek.com>
Date: Tue, 11 Mar 2025 20:03:38 +0100
Subject: [PATCH 2/3] Use macros for yaml2obj in tests
---
.../tools/llvm-objdump/ELF/ARM/plt-be.test | 81 ----------------
.../tools/llvm-objdump/ELF/ARM/plt-be8.test | 81 ----------------
.../llvm-objdump/ELF/ARM/plt-long-be.test | 84 ----------------
.../llvm-objdump/ELF/ARM/plt-long-be8.test | 84 ----------------
.../tools/llvm-objdump/ELF/ARM/plt-long.test | 36 +++++--
.../llvm-objdump/ELF/ARM/plt-thumb-be.test | 91 -----------------
.../llvm-objdump/ELF/ARM/plt-thumb-be8.test | 97 -------------------
.../tools/llvm-objdump/ELF/ARM/plt-thumb.test | 43 ++++++--
llvm/test/tools/llvm-objdump/ELF/ARM/plt.test | 36 +++++--
9 files changed, 89 insertions(+), 544 deletions(-)
delete mode 100644 llvm/test/tools/llvm-objdump/ELF/ARM/plt-be.test
delete mode 100644 llvm/test/tools/llvm-objdump/ELF/ARM/plt-be8.test
delete mode 100644 llvm/test/tools/llvm-objdump/ELF/ARM/plt-long-be.test
delete mode 100644 llvm/test/tools/llvm-objdump/ELF/ARM/plt-long-be8.test
delete mode 100644 llvm/test/tools/llvm-objdump/ELF/ARM/plt-thumb-be.test
delete mode 100644 llvm/test/tools/llvm-objdump/ELF/ARM/plt-thumb-be8.test
diff --git a/llvm/test/tools/llvm-objdump/ELF/ARM/plt-be.test b/llvm/test/tools/llvm-objdump/ELF/ARM/plt-be.test
deleted file mode 100644
index cf73d477f0d0a..0000000000000
--- a/llvm/test/tools/llvm-objdump/ELF/ARM/plt-be.test
+++ /dev/null
@@ -1,81 +0,0 @@
-# RUN: yaml2obj %s -o %t
-# RUN: llvm-objdump -d %t | FileCheck %s
-
-# CHECK: Disassembly of section .text:
-# CHECK: b {{.*}} <func1 at plt>
-# CHECK: bl {{.*}} <func2 at plt>
-# CHECK: beq {{.*}} <func3 at plt>
-
-# CHECK: Disassembly of section .plt:
-# CHECK: <func1 at plt>:
-# CHECK: <func2 at plt>:
-# CHECK: <func3 at plt>:
-
-# Test PLT section parsing on armeb
-
---- !ELF
-FileHeader:
- Class: ELFCLASS32
- Data: ELFDATA2MSB
- Type: ET_DYN
- Machine: EM_ARM
- Flags: [ EF_ARM_SOFT_FLOAT, EF_ARM_EABI_VER5 ]
- Entry: 0x10220
-Sections:
- - Name: .rel.plt
- Type: SHT_REL
- Flags: [ SHF_ALLOC, SHF_INFO_LINK ]
- Address: 0x1FC
- Link: .dynsym
- AddressAlign: 0x4
- Info: .got.plt
- Relocations:
- - Offset: 0x302E4
- Symbol: func1
- Type: R_ARM_JUMP_SLOT
- - Offset: 0x302E8
- Symbol: func2
- Type: R_ARM_JUMP_SLOT
- - Offset: 0x302EC
- Symbol: func3
- Type: R_ARM_JUMP_SLOT
- - Name: .text
- Type: SHT_PROGBITS
- Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
- Address: 0x10214
- AddressAlign: 0x4
- Content: E12FFF1EE12FFF1EE12FFF1EEA00000AEB00000D0A000010
- - Name: .plt
- Type: SHT_PROGBITS
- Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
- Address: 0x10230
- AddressAlign: 0x10
- Content: E52DE004E28FE600E28EEA20E5BEF0A4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4E28FC600E28CCA20E5BCF08CD4D4D4D4E28FC600E28CCA20E5BCF080D4D4D4D4E28FC600E28CCA20E5BCF074D4D4D4D4
- - Name: .got.plt
- Type: SHT_PROGBITS
- Flags: [ SHF_WRITE, SHF_ALLOC ]
- Address: 0x302D8
- AddressAlign: 0x4
- Content: '000000000000000000000000000102300001023000010230'
-DynamicSymbols:
- - Name: func1
- Type: STT_FUNC
- Section: .text
- Binding: STB_GLOBAL
- Value: 0x10214
- - Name: func2
- Type: STT_FUNC
- Section: .text
- Binding: STB_GLOBAL
- Value: 0x10218
- - Name: func3
- Type: STT_FUNC
- Section: .text
- Binding: STB_GLOBAL
- Value: 0x1021C
- - Name: _start
- Type: STT_FUNC
- Section: .text
- Binding: STB_GLOBAL
- Value: 0x10220
-...
diff --git a/llvm/test/tools/llvm-objdump/ELF/ARM/plt-be8.test b/llvm/test/tools/llvm-objdump/ELF/ARM/plt-be8.test
deleted file mode 100644
index 5aeed9dbc7d6f..0000000000000
--- a/llvm/test/tools/llvm-objdump/ELF/ARM/plt-be8.test
+++ /dev/null
@@ -1,81 +0,0 @@
-# RUN: yaml2obj %s -o %t
-# RUN: llvm-objdump -d %t | FileCheck %s
-
-# CHECK: Disassembly of section .text:
-# CHECK: b {{.*}} <func1 at plt>
-# CHECK: bl {{.*}} <func2 at plt>
-# CHECK: beq {{.*}} <func3 at plt>
-
-# CHECK: Disassembly of section .plt:
-# CHECK: <func1 at plt>:
-# CHECK: <func2 at plt>:
-# CHECK: <func3 at plt>:
-
-# Test PLT section parsing on armeb with be8
-
---- !ELF
-FileHeader:
- Class: ELFCLASS32
- Data: ELFDATA2MSB
- Type: ET_DYN
- Machine: EM_ARM
- Flags: [ EF_ARM_SOFT_FLOAT, EF_ARM_EABI_VER5, EF_ARM_BE8 ]
- Entry: 0x10220
-Sections:
- - Name: .rel.plt
- Type: SHT_REL
- Flags: [ SHF_ALLOC, SHF_INFO_LINK ]
- Address: 0x1FC
- Link: .dynsym
- AddressAlign: 0x4
- Info: .got.plt
- Relocations:
- - Offset: 0x302E4
- Symbol: func1
- Type: R_ARM_JUMP_SLOT
- - Offset: 0x302E8
- Symbol: func2
- Type: R_ARM_JUMP_SLOT
- - Offset: 0x302EC
- Symbol: func3
- Type: R_ARM_JUMP_SLOT
- - Name: .text
- Type: SHT_PROGBITS
- Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
- Address: 0x10214
- AddressAlign: 0x4
- Content: 1EFF2FE11EFF2FE11EFF2FE10A0000EA0D0000EB1000000A
- - Name: .plt
- Type: SHT_PROGBITS
- Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
- Address: 0x10230
- AddressAlign: 0x10
- Content: 04E02DE500E68FE220EA8EE2A4F0BEE5D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D400C68FE220CA8CE28CF0BCE5D4D4D4D400C68FE220CA8CE280F0BCE5D4D4D4D400C68FE220CA8CE274F0BCE5D4D4D4D4
- - Name: .got.plt
- Type: SHT_PROGBITS
- Flags: [ SHF_WRITE, SHF_ALLOC ]
- Address: 0x302D8
- AddressAlign: 0x4
- Content: '000000000000000000000000000102300001023000010230'
-DynamicSymbols:
- - Name: func1
- Type: STT_FUNC
- Section: .text
- Binding: STB_GLOBAL
- Value: 0x10214
- - Name: func2
- Type: STT_FUNC
- Section: .text
- Binding: STB_GLOBAL
- Value: 0x10218
- - Name: func3
- Type: STT_FUNC
- Section: .text
- Binding: STB_GLOBAL
- Value: 0x1021C
- - Name: _start
- Type: STT_FUNC
- Section: .text
- Binding: STB_GLOBAL
- Value: 0x10220
-...
diff --git a/llvm/test/tools/llvm-objdump/ELF/ARM/plt-long-be.test b/llvm/test/tools/llvm-objdump/ELF/ARM/plt-long-be.test
deleted file mode 100644
index 7a0d388ed4044..0000000000000
--- a/llvm/test/tools/llvm-objdump/ELF/ARM/plt-long-be.test
+++ /dev/null
@@ -1,84 +0,0 @@
-# RUN: yaml2obj %s -o %t
-# RUN: llvm-objdump -d %t | FileCheck %s
-
-# CHECK: Disassembly of section .text:
-# CHECK: b {{.*}} <func1 at plt>
-# CHECK: bl {{.*}} <func2 at plt>
-# CHECK: beq {{.*}} <func3 at plt>
-
-# CHECK: Disassembly of section .plt:
-# CHECK: <func1 at plt>:
-# CHECK: <func2 at plt>:
-# CHECK: <func3 at plt>:
-
-# Test PLT section with long entries parsing on armeb
-
---- !ELF
-FileHeader:
- Class: ELFCLASS32
- Data: ELFDATA2MSB
- Type: ET_DYN
- Machine: EM_ARM
- Flags: [ EF_ARM_SOFT_FLOAT, EF_ARM_EABI_VER5 ]
- Entry: 0x100C
-Sections:
- - Name: .rel.plt
- Type: SHT_REL
- Flags: [ SHF_ALLOC, SHF_INFO_LINK ]
- Address: 0x9C
- Link: .dynsym
- AddressAlign: 0x4
- Info: .got.plt
- Relocations:
- - Offset: 0x1111110C
- Symbol: func1
- Type: R_ARM_JUMP_SLOT
- - Offset: 0x11111110
- Symbol: func2
- Type: R_ARM_JUMP_SLOT
- - Offset: 0x11111114
- Symbol: func3
- Type: R_ARM_JUMP_SLOT
- - Name: .text
- Type: SHT_PROGBITS
- Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
- Address: 0x1000
- AddressAlign: 0x4
- Offset: 0x11000
- Content: E12FFF1EE12FFF1EE12FFF1EEA000403EB0004060A000409
- - Name: .plt
- Type: SHT_PROGBITS
- Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
- Address: 0x2000
- AddressAlign: 0x10
- Offset: 0x12000
- Content: E52DE004E59FE004E08FE00EE5BEF0081110F0F0D4D4D4D4D4D4D4D4D4D4D4D4E59FC004E08CC00FE59CF0001110F0E0E59FC004E08CC00FE59CF0001110F0D4E59FC004E08CC00FE59CF0001110F0C8
- - Name: .got.plt
- Type: SHT_PROGBITS
- Flags: [ SHF_WRITE, SHF_ALLOC ]
- Address: 0x11111100
- AddressAlign: 0x4
- Offset: 0x21100
- Content: '000000000000000000000000000020000000200000002000'
-DynamicSymbols:
- - Name: func1
- Type: STT_FUNC
- Section: .text
- Binding: STB_GLOBAL
- Value: 0x1000
- - Name: func2
- Type: STT_FUNC
- Section: .text
- Binding: STB_GLOBAL
- Value: 0x1004
- - Name: func3
- Type: STT_FUNC
- Section: .text
- Binding: STB_GLOBAL
- Value: 0x1008
- - Name: _start
- Type: STT_FUNC
- Section: .text
- Binding: STB_GLOBAL
- Value: 0x100C
-...
diff --git a/llvm/test/tools/llvm-objdump/ELF/ARM/plt-long-be8.test b/llvm/test/tools/llvm-objdump/ELF/ARM/plt-long-be8.test
deleted file mode 100644
index 03bbbfd0e911f..0000000000000
--- a/llvm/test/tools/llvm-objdump/ELF/ARM/plt-long-be8.test
+++ /dev/null
@@ -1,84 +0,0 @@
-# RUN: yaml2obj %s -o %t
-# RUN: llvm-objdump -d %t | FileCheck %s
-
-# CHECK: Disassembly of section .text:
-# CHECK: b {{.*}} <func1 at plt>
-# CHECK: bl {{.*}} <func2 at plt>
-# CHECK: beq {{.*}} <func3 at plt>
-
-# CHECK: Disassembly of section .plt:
-# CHECK: <func1 at plt>:
-# CHECK: <func2 at plt>:
-# CHECK: <func3 at plt>:
-
-# Test PLT section with long entries parsing on armeb with be8
-
---- !ELF
-FileHeader:
- Class: ELFCLASS32
- Data: ELFDATA2MSB
- Type: ET_DYN
- Machine: EM_ARM
- Flags: [ EF_ARM_SOFT_FLOAT, EF_ARM_EABI_VER5, EF_ARM_BE8 ]
- Entry: 0x100C
-Sections:
- - Name: .rel.plt
- Type: SHT_REL
- Flags: [ SHF_ALLOC, SHF_INFO_LINK ]
- Address: 0x9C
- Link: .dynsym
- AddressAlign: 0x4
- Info: .got.plt
- Relocations:
- - Offset: 0x1111110C
- Symbol: func1
- Type: R_ARM_JUMP_SLOT
- - Offset: 0x11111110
- Symbol: func2
- Type: R_ARM_JUMP_SLOT
- - Offset: 0x11111114
- Symbol: func3
- Type: R_ARM_JUMP_SLOT
- - Name: .text
- Type: SHT_PROGBITS
- Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
- Address: 0x1000
- AddressAlign: 0x4
- Offset: 0x11000
- Content: 1EFF2FE11EFF2FE11EFF2FE1030400EA060400EB0904000A
- - Name: .plt
- Type: SHT_PROGBITS
- Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
- Address: 0x2000
- AddressAlign: 0x10
- Offset: 0x12000
- Content: 04E02DE504E09FE50EE08FE008F0BEE51110F0F0D4D4D4D4D4D4D4D4D4D4D4D404C09FE50FC08CE000F09CE51110F0E004C09FE50FC08CE000F09CE51110F0D404C09FE50FC08CE000F09CE51110F0C8
- - Name: .got.plt
- Type: SHT_PROGBITS
- Flags: [ SHF_WRITE, SHF_ALLOC ]
- Address: 0x11111100
- AddressAlign: 0x4
- Offset: 0x21100
- Content: '000000000000000000000000000020000000200000002000'
-DynamicSymbols:
- - Name: func1
- Type: STT_FUNC
- Section: .text
- Binding: STB_GLOBAL
- Value: 0x1000
- - Name: func2
- Type: STT_FUNC
- Section: .text
- Binding: STB_GLOBAL
- Value: 0x1004
- - Name: func3
- Type: STT_FUNC
- Section: .text
- Binding: STB_GLOBAL
- Value: 0x1008
- - Name: _start
- Type: STT_FUNC
- Section: .text
- Binding: STB_GLOBAL
- Value: 0x100C
-...
diff --git a/llvm/test/tools/llvm-objdump/ELF/ARM/plt-long.test b/llvm/test/tools/llvm-objdump/ELF/ARM/plt-long.test
index 7dcf82099e7e1..f3955cdc9dc3c 100644
--- a/llvm/test/tools/llvm-objdump/ELF/ARM/plt-long.test
+++ b/llvm/test/tools/llvm-objdump/ELF/ARM/plt-long.test
@@ -1,4 +1,26 @@
-# RUN: yaml2obj %s -o %t
+# Test PLT section with long entries parsing on arm
+
+# RUN: yaml2obj -DENDIAN=LSB -DTEXT=1EFF2FE11EFF2FE11EFF2FE1030400EA060400EB0904000A \
+# RUN: -DPLT=04E02DE504E09FE50EE08FE008F0BEE5F0F01011D4D4D4D4D4D4D4D4D4D4D4D404C09FE50FC08CE000F09CE5E0F0101104C09FE50FC08CE000F09CE5D4F0101104C09FE50FC08CE000F09CE5C8F01011 \
+# RUN: -DGOTPLT=000000000000000000000000002000000020000000200000 \
+# RUN: %s -o %t
+# RUN: llvm-objdump -d %t | FileCheck %s
+
+# Test PLT section with long entries parsing on armeb
+
+# RUN: yaml2obj -DENDIAN=MSB -DTEXT=E12FFF1EE12FFF1EE12FFF1EEA000403EB0004060A000409 \
+# RUN: -DPLT=E52DE004E59FE004E08FE00EE5BEF0081110F0F0D4D4D4D4D4D4D4D4D4D4D4D4E59FC004E08CC00FE59CF0001110F0E0E59FC004E08CC00FE59CF0001110F0D4E59FC004E08CC00FE59CF0001110F0C8 \
+# RUN: -DGOTPLT=000000000000000000000000000020000000200000002000 \
+# RUN: %s -o %t
+# RUN: llvm-objdump -d %t | FileCheck %s
+
+# Test PLT section with long entries parsing on armeb with be8
+
+# RUN: yaml2obj -DENDIAN=MSB -DTEXT=1EFF2FE11EFF2FE11EFF2FE1030400EA060400EB0904000A \
+# RUN: -DPLT=04E02DE504E09FE50EE08FE008F0BEE51110F0F0D4D4D4D4D4D4D4D4D4D4D4D404C09FE50FC08CE000F09CE51110F0E004C09FE50FC08CE000F09CE51110F0D404C09FE50FC08CE000F09CE51110F0C8 \
+# RUN: -DGOTPLT=000000000000000000000000000020000000200000002000 \
+# RUN: -DFLAGS=EF_ARM_BE8 \
+# RUN: %s -o %t
# RUN: llvm-objdump -d %t | FileCheck %s
# CHECK: Disassembly of section .text:
@@ -11,15 +33,13 @@
# CHECK: <func2 at plt>:
# CHECK: <func3 at plt>:
-# Test PLT section with long entries parsing on arm
-
--- !ELF
FileHeader:
Class: ELFCLASS32
- Data: ELFDATA2LSB
+ Data: ELFDATA2[[ENDIAN]]
Type: ET_DYN
Machine: EM_ARM
- Flags: [ EF_ARM_SOFT_FLOAT, EF_ARM_EABI_VER5 ]
+ Flags: [ EF_ARM_SOFT_FLOAT, EF_ARM_EABI_VER5, [[FLAGS=]]]
Entry: 0x100C
Sections:
- Name: .rel.plt
@@ -45,21 +65,21 @@ Sections:
Address: 0x1000
AddressAlign: 0x4
Offset: 0x11000
- Content: 1EFF2FE11EFF2FE11EFF2FE1030400EA060400EB0904000A
+ Content: [[TEXT]]
- Name: .plt
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
Address: 0x2000
AddressAlign: 0x10
Offset: 0x12000
- Content: 04E02DE504E09FE50EE08FE008F0BEE5F0F01011D4D4D4D4D4D4D4D4D4D4D4D404C09FE50FC08CE000F09CE5E0F0101104C09FE50FC08CE000F09CE5D4F0101104C09FE50FC08CE000F09CE5C8F01011
+ Content: [[PLT]]
- Name: .got.plt
Type: SHT_PROGBITS
Flags: [ SHF_WRITE, SHF_ALLOC ]
Address: 0x11111100
AddressAlign: 0x4
Offset: 0x21100
- Content: '000000000000000000000000002000000020000000200000'
+ Content: [[GOTPLT]]
DynamicSymbols:
- Name: func1
Type: STT_FUNC
diff --git a/llvm/test/tools/llvm-objdump/ELF/ARM/plt-thumb-be.test b/llvm/test/tools/llvm-objdump/ELF/ARM/plt-thumb-be.test
deleted file mode 100644
index 4d58ab7a62af7..0000000000000
--- a/llvm/test/tools/llvm-objdump/ELF/ARM/plt-thumb-be.test
+++ /dev/null
@@ -1,91 +0,0 @@
-# RUN: yaml2obj %s -o %t
-# RUN: llvm-objdump --no-print-imm-hex -d %t | FileCheck %s
-
-# CHECK: Disassembly of section .text:
-# CHECK: bl {{.*}} <func1 at plt>
-# CHECK: bl {{.*}} <func2 at plt>
-# CHECK: bl {{.*}} <func3 at plt>
-# CHECK: b.w {{.*}} <func1 at plt>
-# CHECK: b.w {{.*}} <func2 at plt>
-# CHECK: b.w {{.*}} <func3 at plt>
-# CHECK: beq.w {{.*}} <func1 at plt>
-# CHECK: beq.w {{.*}} <func2 at plt>
-# CHECK: beq.w {{.*}} <func3 at plt>
-
-# CHECK: Disassembly of section .plt:
-# CHECK: <func1 at plt>:
-# CHECK: <func2 at plt>:
-# CHECK: <func3 at plt>:
-
-# Test PLT section parsing on thumbeb
-
---- !ELF
-FileHeader:
- Class: ELFCLASS32
- Data: ELFDATA2MSB
- Type: ET_DYN
- Machine: EM_ARM
- Flags: [ EF_ARM_SOFT_FLOAT, EF_ARM_EABI_VER5 ]
- Entry: 0x1021D
-Sections:
- - Name: .rel.plt
- Type: SHT_REL
- Flags: [ SHF_ALLOC, SHF_INFO_LINK ]
- Address: 0x1FC
- Link: .dynsym
- AddressAlign: 0x4
- Info: .got.plt
- Relocations:
- - Offset: 0x302F4
- Symbol: func1
- Type: R_ARM_JUMP_SLOT
- - Offset: 0x302F8
- Symbol: func2
- Type: R_ARM_JUMP_SLOT
- - Offset: 0x302FC
- Symbol: func3
- Type: R_ARM_JUMP_SLOT
- - Name: .text
- Type: SHT_PROGBITS
- Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
- Address: 0x10214
- AddressAlign: 0x4
- Content: 477047704770D4D4F000F820F000F826F000F82CF000B81AF000B820F000B826F0008014F000801AF0008020
- - Name: .plt
- Type: SHT_PROGBITS
- Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
- Address: 0x10240
- AddressAlign: 0x10
- Content: B500F8DFE00844FEF85EFF0800020098D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4F2400C88F2C00C0244FCF8DCF000E7FCF2400C7CF2C00C0244FCF8DCF000E7FCF2400C70F2C00C0244FCF8DCF000E7FC
- - Name: .got.plt
- Type: SHT_PROGBITS
- Flags: [ SHF_WRITE, SHF_ALLOC ]
- Address: 0x302E8
- AddressAlign: 0x4
- Content: '000000000000000000000000000102400001024000010240'
- - Name: .ARM.attributes
- Type: SHT_ARM_ATTRIBUTES
- AddressAlign: 0x1
- Content: 410000002D616561626900010000002305636F727465782D6D3333000611074D080009030A081B01220124012E01
-DynamicSymbols:
- - Name: func1
- Type: STT_FUNC
- Section: .text
- Binding: STB_GLOBAL
- Value: 0x10215
- - Name: func2
- Type: STT_FUNC
- Section: .text
- Binding: STB_GLOBAL
- Value: 0x10217
- - Name: func3
- Type: STT_FUNC
- Section: .text
- Binding: STB_GLOBAL
- Value: 0x10219
- - Name: _start
- Type: STT_FUNC
- Section: .text
- Binding: STB_GLOBAL
- Value: 0x1021D
-...
diff --git a/llvm/test/tools/llvm-objdump/ELF/ARM/plt-thumb-be8.test b/llvm/test/tools/llvm-objdump/ELF/ARM/plt-thumb-be8.test
deleted file mode 100644
index c2a22725590a9..0000000000000
--- a/llvm/test/tools/llvm-objdump/ELF/ARM/plt-thumb-be8.test
+++ /dev/null
@@ -1,97 +0,0 @@
-# RUN: yaml2obj %s -o %t
-# RUN: llvm-objdump --no-print-imm-hex -d %t | FileCheck %s
-
-# CHECK: Disassembly of section .text:
-# CHECK: bl {{.*}} <func1 at plt>
-# CHECK: bl {{.*}} <func2 at plt>
-# CHECK: bl {{.*}} <func3 at plt>
-# CHECK: b.w {{.*}} <func1 at plt>
-# CHECK: b.w {{.*}} <func2 at plt>
-# CHECK: b.w {{.*}} <func3 at plt>
-# CHECK: beq.w {{.*}} <func1 at plt>
-# CHECK: beq.w {{.*}} <func2 at plt>
-# CHECK: beq.w {{.*}} <func3 at plt>
-
-# CHECK: Disassembly of section .plt:
-# CHECK: <func1 at plt>:
-# CHECK: <func2 at plt>:
-# CHECK: <func3 at plt>:
-
-# Test PLT section parsing on thumbeb with be8
-
---- !ELF
-FileHeader:
- Class: ELFCLASS32
- Data: ELFDATA2MSB
- Type: ET_DYN
- Machine: EM_ARM
- Flags: [ EF_ARM_SOFT_FLOAT, EF_ARM_EABI_VER5, EF_ARM_BE8 ]
- Entry: 0x1021D
-Sections:
- - Name: .rel.plt
- Type: SHT_REL
- Flags: [ SHF_ALLOC, SHF_INFO_LINK ]
- Address: 0x1FC
- Link: .dynsym
- AddressAlign: 0x4
- Info: .got.plt
- Relocations:
- - Offset: 0x302F4
- Symbol: func1
- Type: R_ARM_JUMP_SLOT
- - Offset: 0x302F8
- Symbol: func2
- Type: R_ARM_JUMP_SLOT
- - Offset: 0x302FC
- Symbol: func3
- Type: R_ARM_JUMP_SLOT
- - Name: .text
- Type: SHT_PROGBITS
- Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
- Address: 0x10214
- AddressAlign: 0x4
- Content: 704770477047D4D400F020F800F026F800F02CF800F01AB800F020B800F026B800F0148000F01A8000F02080
- - Name: .plt
- Type: SHT_PROGBITS
- Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
- Address: 0x10240
- AddressAlign: 0x10
- Content: 00B5DFF808E0FE445EF808FF00020098D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D440F2880CC0F2020CFC44DCF800F0FCE740F27C0CC0F2020CFC44DCF800F0FCE740F2700CC0F2020CFC44DCF800F0FCE7
- - Name: .got.plt
- Type: SHT_PROGBITS
- Flags: [ SHF_WRITE, SHF_ALLOC ]
- Address: 0x302E8
- AddressAlign: 0x4
- Content: '000000000000000000000000000102400001024000010240'
- - Name: .ARM.attributes
- Type: SHT_ARM_ATTRIBUTES
- AddressAlign: 0x1
- Content: 410000002D616561626900010000002305636F727465782D6D3333000611074D080009030A081B01220124012E01
- - Name: .comment
- Type: SHT_PROGBITS
- Flags: [ SHF_MERGE, SHF_STRINGS ]
- AddressAlign: 0x1
- EntSize: 0x1
- Content: 4C4C4420312E3000
-DynamicSymbols:
- - Name: func1
- Type: STT_FUNC
- Section: .text
- Binding: STB_GLOBAL
- Value: 0x10215
- - Name: func2
- Type: STT_FUNC
- Section: .text
- Binding: STB_GLOBAL
- Value: 0x10217
- - Name: func3
- Type: STT_FUNC
- Section: .text
- Binding: STB_GLOBAL
- Value: 0x10219
- - Name: _start
- Type: STT_FUNC
- Section: .text
- Binding: STB_GLOBAL
- Value: 0x1021D
-...
diff --git a/llvm/test/tools/llvm-objdump/ELF/ARM/plt-thumb.test b/llvm/test/tools/llvm-objdump/ELF/ARM/plt-thumb.test
index 41bf1ec882a19..eb8e96018b135 100644
--- a/llvm/test/tools/llvm-objdump/ELF/ARM/plt-thumb.test
+++ b/llvm/test/tools/llvm-objdump/ELF/ARM/plt-thumb.test
@@ -1,5 +1,30 @@
-# RUN: yaml2obj %s -o %t
-# RUN: llvm-objdump --no-print-imm-hex -d %t | FileCheck %s
+# Test PLT section parsing on thumb
+
+# RUN: yaml2obj -DENDIAN=LSB -DTEXT=704770477047D4D400F020F800F026F800F02CF800F01AB800F020B800F026B800F0148000F01A8000F02080 \
+# RUN: -DPLT=00B5DFF808E0FE445EF808FF98000200D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D440F2880CC0F2020CFC44DCF800F0FCE740F27C0CC0F2020CFC44DCF800F0FCE740F2700CC0F2020CFC44DCF800F0FCE7 \
+# RUN: -DGOTPLT=000000000000000000000000400201004002010040020100 \
+# RUN: -DARMATTR=412D000000616561626900012300000005636F727465782D6D3333000611074D080009030A081B01220124012E01 \
+# RUN: %s -o %t
+# RUN: llvm-objdump -d %t | FileCheck %s
+
+# Test PLT section parsing on thumbeb
+
+# RUN: yaml2obj -DENDIAN=MSB -DTEXT=477047704770D4D4F000F820F000F826F000F82CF000B81AF000B820F000B826F0008014F000801AF0008020 \
+# RUN: -DPLT=B500F8DFE00844FEF85EFF0800020098D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4F2400C88F2C00C0244FCF8DCF000E7FCF2400C7CF2C00C0244FCF8DCF000E7FCF2400C70F2C00C0244FCF8DCF000E7FC \
+# RUN: -DGOTPLT=000000000000000000000000000102400001024000010240 \
+# RUN: -DARMATTR=410000002D616561626900010000002305636F727465782D6D3333000611074D080009030A081B01220124012E01 \
+# RUN: %s -o %t
+# RUN: llvm-objdump -d %t | FileCheck %s
+
+# Test PLT section parsing on thumbeb with be8
+
+# RUN: yaml2obj -DENDIAN=MSB -DTEXT=704770477047D4D400F020F800F026F800F02CF800F01AB800F020B800F026B800F0148000F01A8000F02080 \
+# RUN: -DPLT=00B5DFF808E0FE445EF808FF00020098D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D440F2880CC0F2020CFC44DCF800F0FCE740F27C0CC0F2020CFC44DCF800F0FCE740F2700CC0F2020CFC44DCF800F0FCE7 \
+# RUN: -DGOTPLT=000000000000000000000000000102400001024000010240 \
+# RUN: -DARMATTR=410000002D616561626900010000002305636F727465782D6D3333000611074D080009030A081B01220124012E01 \
+# RUN: -DFLAGS=EF_ARM_BE8 \
+# RUN: %s -o %t
+# RUN: llvm-objdump -d %t | FileCheck %s
# CHECK: Disassembly of section .text:
# CHECK: bl {{.*}} <func1 at plt>
@@ -17,15 +42,13 @@
# CHECK: <func2 at plt>:
# CHECK: <func3 at plt>:
-# Test PLT section parsing on thumb
-
--- !ELF
FileHeader:
Class: ELFCLASS32
- Data: ELFDATA2LSB
+ Data: ELFDATA2[[ENDIAN]]
Type: ET_DYN
Machine: EM_ARM
- Flags: [ EF_ARM_SOFT_FLOAT, EF_ARM_EABI_VER5 ]
+ Flags: [ EF_ARM_SOFT_FLOAT, EF_ARM_EABI_VER5, [[FLAGS=]]]
Entry: 0x1021D
Sections:
- Name: .rel.plt
@@ -50,23 +73,23 @@ Sections:
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
Address: 0x10214
AddressAlign: 0x4
- Content: 704770477047D4D400F020F800F026F800F02CF800F01AB800F020B800F026B800F0148000F01A8000F02080
+ Content: [[TEXT]]
- Name: .plt
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
Address: 0x10240
AddressAlign: 0x10
- Content: 00B5DFF808E0FE445EF808FF98000200D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D440F2880CC0F2020CFC44DCF800F0FCE740F27C0CC0F2020CFC44DCF800F0FCE740F2700CC0F2020CFC44DCF800F0FCE7
+ Content: [[PLT]]
- Name: .got.plt
Type: SHT_PROGBITS
Flags: [ SHF_WRITE, SHF_ALLOC ]
Address: 0x302E8
AddressAlign: 0x4
- Content: '000000000000000000000000400201004002010040020100'
+ Content: [[GOTPLT]]
- Name: .ARM.attributes
Type: SHT_ARM_ATTRIBUTES
AddressAlign: 0x1
- Content: 412D000000616561626900012300000005636F727465782D6D3333000611074D080009030A081B01220124012E01
+ Content: [[ARMATTR]]
DynamicSymbols:
- Name: func1
Type: STT_FUNC
diff --git a/llvm/test/tools/llvm-objdump/ELF/ARM/plt.test b/llvm/test/tools/llvm-objdump/ELF/ARM/plt.test
index 5da7a7f91b98b..de35eb0ede0c3 100644
--- a/llvm/test/tools/llvm-objdump/ELF/ARM/plt.test
+++ b/llvm/test/tools/llvm-objdump/ELF/ARM/plt.test
@@ -1,4 +1,26 @@
-# RUN: yaml2obj %s -o %t
+# Test PLT section parsing on arm
+
+# RUN: yaml2obj -DENDIAN=LSB -DTEXT=1EFF2FE11EFF2FE11EFF2FE10A0000EA0D0000EB1000000A \
+# RUN: -DPLT=04E02DE500E68FE220EA8EE2A4F0BEE5D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D400C68FE220CA8CE28CF0BCE5D4D4D4D400C68FE220CA8CE280F0BCE5D4D4D4D400C68FE220CA8CE274F0BCE5D4D4D4D4 \
+# RUN: -DGOTPLT=000000000000000000000000300201003002010030020100 \
+# RUN: %s -o %t
+# RUN: llvm-objdump -d %t | FileCheck %s
+
+# Test PLT section parsing on armeb
+
+# RUN: yaml2obj -DENDIAN=MSB -DTEXT=E12FFF1EE12FFF1EE12FFF1EEA00000AEB00000D0A000010 \
+# RUN: -DPLT=E52DE004E28FE600E28EEA20E5BEF0A4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4E28FC600E28CCA20E5BCF08CD4D4D4D4E28FC600E28CCA20E5BCF080D4D4D4D4E28FC600E28CCA20E5BCF074D4D4D4D4 \
+# RUN: -DGOTPLT=000000000000000000000000000102300001023000010230 \
+# RUN: %s -o %t
+# RUN: llvm-objdump -d %t | FileCheck %s
+
+# Test PLT section parsing on armeb with be8
+
+# RUN: yaml2obj -DENDIAN=MSB -DTEXT=1EFF2FE11EFF2FE11EFF2FE10A0000EA0D0000EB1000000A \
+# RUN: -DPLT=04E02DE500E68FE220EA8EE2A4F0BEE5D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D400C68FE220CA8CE28CF0BCE5D4D4D4D400C68FE220CA8CE280F0BCE5D4D4D4D400C68FE220CA8CE274F0BCE5D4D4D4D4 \
+# RUN: -DGOTPLT=000000000000000000000000000102300001023000010230 \
+# RUN: -DFLAGS=EF_ARM_BE8 \
+# RUN: %s -o %t
# RUN: llvm-objdump -d %t | FileCheck %s
# CHECK: Disassembly of section .text:
@@ -11,15 +33,13 @@
# CHECK: <func2 at plt>:
# CHECK: <func3 at plt>:
-# Test PLT section parsing on arm
-
--- !ELF
FileHeader:
Class: ELFCLASS32
- Data: ELFDATA2LSB
+ Data: ELFDATA2[[ENDIAN]]
Type: ET_DYN
Machine: EM_ARM
- Flags: [ EF_ARM_SOFT_FLOAT, EF_ARM_EABI_VER5 ]
+ Flags: [ EF_ARM_SOFT_FLOAT, EF_ARM_EABI_VER5, [[FLAGS=]]]
Entry: 0x10220
Sections:
- Name: .rel.plt
@@ -44,19 +64,19 @@ Sections:
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
Address: 0x10214
AddressAlign: 0x4
- Content: 1EFF2FE11EFF2FE11EFF2FE10A0000EA0D0000EB1000000A
+ Content: [[TEXT]]
- Name: .plt
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
Address: 0x10230
AddressAlign: 0x10
- Content: 04E02DE500E68FE220EA8EE2A4F0BEE5D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D400C68FE220CA8CE28CF0BCE5D4D4D4D400C68FE220CA8CE280F0BCE5D4D4D4D400C68FE220CA8CE274F0BCE5D4D4D4D4
+ Content: [[PLT]]
- Name: .got.plt
Type: SHT_PROGBITS
Flags: [ SHF_WRITE, SHF_ALLOC ]
Address: 0x302D8
AddressAlign: 0x4
- Content: '000000000000000000000000300201003002010030020100'
+ Content: [[GOTPLT]]
DynamicSymbols:
- Name: func1
Type: STT_FUNC
>From 8369c5f1a439c06d77922fbc7632a33aa89913dd Mon Sep 17 00:00:00 2001
From: Vladislav Dzhidzhoev <vdzhidzhoev at accesssoftek.com>
Date: Tue, 11 Mar 2025 20:15:41 +0100
Subject: [PATCH 3/3] Use macros for yaml2obj in plt-mix.test
---
.../llvm-objdump/ELF/ARM/plt-mix-be.test | 93 -------------------
.../llvm-objdump/ELF/ARM/plt-mix-be8.test | 93 -------------------
.../tools/llvm-objdump/ELF/ARM/plt-mix.test | 36 +++++--
3 files changed, 28 insertions(+), 194 deletions(-)
delete mode 100644 llvm/test/tools/llvm-objdump/ELF/ARM/plt-mix-be.test
delete mode 100644 llvm/test/tools/llvm-objdump/ELF/ARM/plt-mix-be8.test
diff --git a/llvm/test/tools/llvm-objdump/ELF/ARM/plt-mix-be.test b/llvm/test/tools/llvm-objdump/ELF/ARM/plt-mix-be.test
deleted file mode 100644
index 3c5813d66a2bb..0000000000000
--- a/llvm/test/tools/llvm-objdump/ELF/ARM/plt-mix-be.test
+++ /dev/null
@@ -1,93 +0,0 @@
-# RUN: yaml2obj %s -o %t
-# RUN: llvm-objdump -d %t | FileCheck %s
-
-# CHECK: Disassembly of section .text:
-# CHECK: b {{.*}} <func1 at plt>
-# CHECK: bl {{.*}} <func2 at plt>
-# CHECK: beq {{.*}} <func3 at plt>
-
-# CHECK: Disassembly of section .plt:
-# CHECK: <func1 at plt>:
-# CHECK-NEXT: ldr
-# CHECK-NEXT: add
-# CHECK-NEXT: ldr
-# CHECK: <func2 at plt>:
-# CHECK-NEXT: add
-# CHECK-NEXT: add
-# CHECK-NEXT: ldr
-# CHECK: <func3 at plt>:
-# CHECK-NEXT: add
-# CHECK-NEXT: add
-# CHECK-NEXT: ldr
-
-# Test PLT section with mixed long and short entries parsing on armeb
-
---- !ELF
-FileHeader:
- Class: ELFCLASS32
- Data: ELFDATA2MSB
- Type: ET_DYN
- Machine: EM_ARM
- Flags: [ EF_ARM_SOFT_FLOAT, EF_ARM_EABI_VER5 ]
- Entry: 0x100C
-Sections:
- - Name: .rel.plt
- Type: SHT_REL
- Flags: [ SHF_ALLOC, SHF_INFO_LINK ]
- Address: 0x9C
- Link: .dynsym
- AddressAlign: 0x4
- Info: .got.plt
- Relocations:
- - Offset: 0x800202C
- Symbol: func1
- Type: R_ARM_JUMP_SLOT
- - Offset: 0x8002030
- Symbol: func2
- Type: R_ARM_JUMP_SLOT
- - Offset: 0x8002034
- Symbol: func3
- Type: R_ARM_JUMP_SLOT
- - Name: .text
- Type: SHT_PROGBITS
- Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
- Address: 0x1000
- AddressAlign: 0x4
- Offset: 0x11000
- Content: E12FFF1EE12FFF1EE12FFF1EEA000403EB0004060A000409
- - Name: .plt
- Type: SHT_PROGBITS
- Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
- Address: 0x2000
- AddressAlign: 0x10
- Offset: 0x12000
- Content: E52DE004E59FE004E08FE00EE5BEF00808000010D4D4D4D4D4D4D4D4D4D4D4D4E59FC004E08CC00FE59CF00008000000E28FC67FE28CCAFFE5BCFFF8D4D4D4D4E28FC67FE28CCAFFE5BCFFECD4D4D4D4
- - Name: .got.plt
- Type: SHT_PROGBITS
- Flags: [ SHF_WRITE, SHF_ALLOC ]
- Address: 0x8002020
- AddressAlign: 0x4
- Offset: 0x22020
- Content: '000000000000000000000000000020000000200000002000'
-DynamicSymbols:
- - Name: func1
- Type: STT_FUNC
- Section: .text
- Binding: STB_GLOBAL
- Value: 0x1000
- - Name: func2
- Type: STT_FUNC
- Section: .text
- Binding: STB_GLOBAL
- Value: 0x1004
- - Name: func3
- Type: STT_FUNC
- Section: .text
- Binding: STB_GLOBAL
- Value: 0x1008
- - Name: _start
- Type: STT_FUNC
- Section: .text
- Binding: STB_GLOBAL
- Value: 0x100C
-...
diff --git a/llvm/test/tools/llvm-objdump/ELF/ARM/plt-mix-be8.test b/llvm/test/tools/llvm-objdump/ELF/ARM/plt-mix-be8.test
deleted file mode 100644
index 633485de2da08..0000000000000
--- a/llvm/test/tools/llvm-objdump/ELF/ARM/plt-mix-be8.test
+++ /dev/null
@@ -1,93 +0,0 @@
-# RUN: yaml2obj %s -o %t
-# RUN: llvm-objdump -d %t | FileCheck %s
-
-# CHECK: Disassembly of section .text:
-# CHECK: b {{.*}} <func1 at plt>
-# CHECK: bl {{.*}} <func2 at plt>
-# CHECK: beq {{.*}} <func3 at plt>
-
-# CHECK: Disassembly of section .plt:
-# CHECK: <func1 at plt>:
-# CHECK-NEXT: ldr
-# CHECK-NEXT: add
-# CHECK-NEXT: ldr
-# CHECK: <func2 at plt>:
-# CHECK-NEXT: add
-# CHECK-NEXT: add
-# CHECK-NEXT: ldr
-# CHECK: <func3 at plt>:
-# CHECK-NEXT: add
-# CHECK-NEXT: add
-# CHECK-NEXT: ldr
-
-# Test PLT section with mixed long and short entries parsing on armeb with be8
-
---- !ELF
-FileHeader:
- Class: ELFCLASS32
- Data: ELFDATA2MSB
- Type: ET_DYN
- Machine: EM_ARM
- Flags: [ EF_ARM_SOFT_FLOAT, EF_ARM_EABI_VER5, EF_ARM_BE8 ]
- Entry: 0x100C
-Sections:
- - Name: .rel.plt
- Type: SHT_REL
- Flags: [ SHF_ALLOC, SHF_INFO_LINK ]
- Address: 0x9C
- Link: .dynsym
- AddressAlign: 0x4
- Info: .got.plt
- Relocations:
- - Offset: 0x800202C
- Symbol: func1
- Type: R_ARM_JUMP_SLOT
- - Offset: 0x8002030
- Symbol: func2
- Type: R_ARM_JUMP_SLOT
- - Offset: 0x8002034
- Symbol: func3
- Type: R_ARM_JUMP_SLOT
- - Name: .text
- Type: SHT_PROGBITS
- Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
- Address: 0x1000
- AddressAlign: 0x4
- Offset: 0x11000
- Content: 1EFF2FE11EFF2FE11EFF2FE1030400EA060400EB0904000A
- - Name: .plt
- Type: SHT_PROGBITS
- Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
- Address: 0x2000
- AddressAlign: 0x10
- Offset: 0x12000
- Content: 04E02DE504E09FE50EE08FE008F0BEE508000010D4D4D4D4D4D4D4D4D4D4D4D404C09FE50FC08CE000F09CE5080000007FC68FE2FFCA8CE2F8FFBCE5D4D4D4D47FC68FE2FFCA8CE2ECFFBCE5D4D4D4D4
- - Name: .got.plt
- Type: SHT_PROGBITS
- Flags: [ SHF_WRITE, SHF_ALLOC ]
- Address: 0x8002020
- AddressAlign: 0x4
- Offset: 0x22020
- Content: '000000000000000000000000000020000000200000002000'
-DynamicSymbols:
- - Name: func1
- Type: STT_FUNC
- Section: .text
- Binding: STB_GLOBAL
- Value: 0x1000
- - Name: func2
- Type: STT_FUNC
- Section: .text
- Binding: STB_GLOBAL
- Value: 0x1004
- - Name: func3
- Type: STT_FUNC
- Section: .text
- Binding: STB_GLOBAL
- Value: 0x1008
- - Name: _start
- Type: STT_FUNC
- Section: .text
- Binding: STB_GLOBAL
- Value: 0x100C
-...
diff --git a/llvm/test/tools/llvm-objdump/ELF/ARM/plt-mix.test b/llvm/test/tools/llvm-objdump/ELF/ARM/plt-mix.test
index 6e117f5a27cd5..78d0ce6422bdc 100644
--- a/llvm/test/tools/llvm-objdump/ELF/ARM/plt-mix.test
+++ b/llvm/test/tools/llvm-objdump/ELF/ARM/plt-mix.test
@@ -1,4 +1,26 @@
-# RUN: yaml2obj %s -o %t
+# Test PLT section with mixed long and short entries parsing on arm
+
+# RUN: yaml2obj -DENDIAN=LSB -DTEXT=1EFF2FE11EFF2FE11EFF2FE1030400EA060400EB0904000A \
+# RUN: -DPLT=04E02DE504E09FE50EE08FE008F0BEE510000008D4D4D4D4D4D4D4D4D4D4D4D404C09FE50FC08CE000F09CE5000000087FC68FE2FFCA8CE2F8FFBCE5D4D4D4D47FC68FE2FFCA8CE2ECFFBCE5D4D4D4D4 \
+# RUN: -DGOTPLT=000000000000000000000000002000000020000000200000 \
+# RUN: %s -o %t
+# RUN: llvm-objdump -d %t | FileCheck %s
+
+# Test PLT section with mixed long and short entries parsing on armeb
+
+# RUN: yaml2obj -DENDIAN=MSB -DTEXT=E12FFF1EE12FFF1EE12FFF1EEA000403EB0004060A000409 \
+# RUN: -DPLT=E52DE004E59FE004E08FE00EE5BEF00808000010D4D4D4D4D4D4D4D4D4D4D4D4E59FC004E08CC00FE59CF00008000000E28FC67FE28CCAFFE5BCFFF8D4D4D4D4E28FC67FE28CCAFFE5BCFFECD4D4D4D4 \
+# RUN: -DGOTPLT=000000000000000000000000000020000000200000002000 \
+# RUN: %s -o %t
+# RUN: llvm-objdump -d %t | FileCheck %s
+
+# Test PLT section with mixed long and short entries parsing on armeb with be8
+
+# RUN: yaml2obj -DENDIAN=MSB -DTEXT=1EFF2FE11EFF2FE11EFF2FE1030400EA060400EB0904000A \
+# RUN: -DPLT=04E02DE504E09FE50EE08FE008F0BEE508000010D4D4D4D4D4D4D4D4D4D4D4D404C09FE50FC08CE000F09CE5080000007FC68FE2FFCA8CE2F8FFBCE5D4D4D4D47FC68FE2FFCA8CE2ECFFBCE5D4D4D4D4 \
+# RUN: -DGOTPLT=000000000000000000000000000020000000200000002000 \
+# RUN: -DFLAGS=EF_ARM_BE8 \
+# RUN: %s -o %t
# RUN: llvm-objdump -d %t | FileCheck %s
# CHECK: Disassembly of section .text:
@@ -20,15 +42,13 @@
# CHECK-NEXT: add
# CHECK-NEXT: ldr
-# Test PLT section with mixed long and short entries parsing on arm
-
--- !ELF
FileHeader:
Class: ELFCLASS32
- Data: ELFDATA2LSB
+ Data: ELFDATA2[[ENDIAN]]
Type: ET_DYN
Machine: EM_ARM
- Flags: [ EF_ARM_SOFT_FLOAT, EF_ARM_EABI_VER5 ]
+ Flags: [ EF_ARM_SOFT_FLOAT, EF_ARM_EABI_VER5, [[FLAGS=]]]
Entry: 0x100C
Sections:
- Name: .rel.plt
@@ -54,21 +74,21 @@ Sections:
Address: 0x1000
AddressAlign: 0x4
Offset: 0x11000
- Content: 1EFF2FE11EFF2FE11EFF2FE1030400EA060400EB0904000A
+ Content: [[TEXT]]
- Name: .plt
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
Address: 0x2000
AddressAlign: 0x10
Offset: 0x12000
- Content: 04E02DE504E09FE50EE08FE008F0BEE510000008D4D4D4D4D4D4D4D4D4D4D4D404C09FE50FC08CE000F09CE5000000087FC68FE2FFCA8CE2F8FFBCE5D4D4D4D47FC68FE2FFCA8CE2ECFFBCE5D4D4D4D4
+ Content: [[PLT]]
- Name: .got.plt
Type: SHT_PROGBITS
Flags: [ SHF_WRITE, SHF_ALLOC ]
Address: 0x8002020
AddressAlign: 0x4
Offset: 0x22020
- Content: '000000000000000000000000002000000020000000200000'
+ Content: [[GOTPLT]]
DynamicSymbols:
- Name: func1
Type: STT_FUNC
More information about the llvm-commits
mailing list