[lld] 6b90f2b - [ELF][test] Clean up some thunk tests
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 23 12:44:22 PST 2019
Author: Fangrui Song
Date: 2019-11-23T12:42:39-08:00
New Revision: 6b90f2bbec72cbdbc7e8a316e1dbc494c294a632
URL: https://github.com/llvm/llvm-project/commit/6b90f2bbec72cbdbc7e8a316e1dbc494c294a632
DIFF: https://github.com/llvm/llvm-project/commit/6b90f2bbec72cbdbc7e8a316e1dbc494c294a632.diff
LOG: [ELF][test] Clean up some thunk tests
Use llvm-objdump --no-show-raw-insn --print-imm-hex
Prefer generic aarch64 triple to linux/freebsd specific triples.
Added:
Modified:
lld/test/ELF/aarch64-call26-thunk.s
lld/test/ELF/aarch64-jump26-thunk.s
lld/test/ELF/aarch64-thunk-pi.s
lld/test/ELF/aarch64-thunk-script.s
lld/test/ELF/aarch64-thunk-section-location.s
lld/test/ELF/arm-thumb-condbranch-thunk.s
Removed:
################################################################################
diff --git a/lld/test/ELF/aarch64-call26-thunk.s b/lld/test/ELF/aarch64-call26-thunk.s
index 62b9db1cda48..c4700d523f13 100644
--- a/lld/test/ELF/aarch64-call26-thunk.s
+++ b/lld/test/ELF/aarch64-call26-thunk.s
@@ -1,8 +1,8 @@
// REQUIRES: aarch64
-// RUN: llvm-mc -filetype=obj -triple=aarch64-pc-freebsd %S/Inputs/abs.s -o %tabs
-// RUN: llvm-mc -filetype=obj -triple=aarch64-pc-freebsd %s -o %t
-// RUN: ld.lld %t %tabs -o %t2 2>&1
-// RUN: llvm-objdump -d -triple=aarch64-pc-freebsd %t2 | FileCheck %s
+// RUN: llvm-mc -filetype=obj -triple=aarch64 %S/Inputs/abs.s -o %tabs.o
+// RUN: llvm-mc -filetype=obj -triple=aarch64 %s -o %t.o
+// RUN: ld.lld %t.o %tabs.o -o %t
+// RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
.text
.globl _start
@@ -12,11 +12,11 @@ _start:
// CHECK: Disassembly of section .text:
// CHECK-EMPTY:
// CHECK-NEXT: _start:
-// CHECK-NEXT: 210120: 02 00 00 94 bl #8
+// CHECK-NEXT: 210120: bl #8
// CHECK: __AArch64AbsLongThunk_big:
-// CHECK-NEXT: 210128: 50 00 00 58 ldr x16, #8
-// CHECK-NEXT: 21012c: 00 02 1f d6 br x16
+// CHECK-NEXT: 210128: ldr x16, #8
+// CHECK-NEXT: 21012c: br x16
// CHECK: $d:
-// CHECK-NEXT: 210130: 00 00 00 00 .word 0x00000000
-// CHECK-NEXT: 210134: 10 00 00 00 .word 0x00000010
+// CHECK-NEXT: 210130: 00 00 00 00 .word 0x00000000
+// CHECK-NEXT: 210134: 10 00 00 00 .word 0x00000010
diff --git a/lld/test/ELF/aarch64-jump26-thunk.s b/lld/test/ELF/aarch64-jump26-thunk.s
index 4acac426f247..808dbe3c37af 100644
--- a/lld/test/ELF/aarch64-jump26-thunk.s
+++ b/lld/test/ELF/aarch64-jump26-thunk.s
@@ -1,6 +1,6 @@
// REQUIRES: aarch64
-// RUN: llvm-mc -filetype=obj -triple=aarch64-pc-freebsd %S/Inputs/abs.s -o %tabs.o
-// RUN: llvm-mc -filetype=obj -triple=aarch64-pc-freebsd %s -o %t.o
+// RUN: llvm-mc -filetype=obj -triple=aarch64 %S/Inputs/abs.s -o %tabs.o
+// RUN: llvm-mc -filetype=obj -triple=aarch64 %s -o %t.o
// RUN: ld.lld %t.o %tabs.o -o %t
// RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
diff --git a/lld/test/ELF/aarch64-thunk-pi.s b/lld/test/ELF/aarch64-thunk-pi.s
index 834a069fb53b..965a93764a73 100644
--- a/lld/test/ELF/aarch64-thunk-pi.s
+++ b/lld/test/ELF/aarch64-thunk-pi.s
@@ -1,11 +1,11 @@
// REQUIRES: aarch64
-// RUN: llvm-mc -filetype=obj -triple=aarch64-linux-gnu %s -o %t
+// RUN: llvm-mc -filetype=obj -triple=aarch64 %s -o %t.o
// RUN: echo "SECTIONS { \
// RUN: .text_low : { *(.text_low) } \
// RUN: .text_high 0x10000000 : { *(.text_high) } \
// RUN: } " > %t.script
-// RUN: ld.lld --script %t.script --shared %t -o %t2 2>&1
-// RUN: llvm-objdump -d -triple=aarch64-linux-gnu %t2 | FileCheck %s
+// RUN: ld.lld --script %t.script --shared %t.o -o %t.so 2>&1
+// RUN: llvm-objdump -d --no-show-raw-insn --print-imm-hex %t.so | FileCheck %s
// Check that Position Independent thunks are generated for shared libraries.
.section .text_low, "ax", %progbits
@@ -16,8 +16,8 @@ low_target:
bl high_target
ret
// CHECK: low_target:
-// CHECK-NEXT: 8: 04 00 00 94 bl #16
-// CHECK-NEXT: c: c0 03 5f d6 ret
+// CHECK-NEXT: d8: bl #0x10 <__AArch64ADRPThunk_high_target>
+// CHECK-NEXT: ret
.hidden low_target2
.globl low_target2
@@ -27,19 +27,19 @@ low_target2:
bl high_target2
ret
// CHECK: low_target2:
-// CHECK-NEXT: 0: 05 00 00 94 bl #20
-// CHECK-NEXT: 4: c0 03 5f d6 ret
+// CHECK-NEXT: e0: bl #0x14 <__AArch64ADRPThunk_high_target2>
+// CHECK-NEXT: ret
// Expect range extension thunks for .text_low
// adrp calculation is (PC + signed immediate) & (!0xfff)
// CHECK: __AArch64ADRPThunk_high_target:
-// CHECK-NEXT: e8: 10 00 08 90 adrp x16, #268435456
-// CHECK-NEXT: ec: 10 02 01 91 add x16, x16, #64
-// CHECK-NEXT: f0: 00 02 1f d6 br x16
+// CHECK-NEXT: e8: adrp x16, #0x10000000
+// CHECK-NEXT: add x16, x16, #0x40
+// CHECK-NEXT: br x16
// CHECK: __AArch64ADRPThunk_high_target2:
-// CHECK-NEXT: f4: 10 00 08 90 adrp x16, #268435456
-// CHECK-NEXT: f8: 10 22 00 91 add x16, x16, #8
-// CHECK-NEXT: fc: 00 02 1f d6 br x16
+// CHECK-NEXT: f4: adrp x16, #0x10000000
+// CHECK-NEXT: add x16, x16, #0x8
+// CHECK-NEXT: br x16
.section .text_high, "ax", %progbits
@@ -50,8 +50,8 @@ high_target:
bl low_target
ret
// CHECK: high_target:
-// CHECK-NEXT: 10000000: 14 00 00 94 bl #80
-// CHECK-NEXT: 10000004: c0 03 5f d6 ret
+// CHECK-NEXT: 10000000: bl #0x50 <low_target at plt>
+// CHECK-NEXT: ret
.hidden high_target2
.globl high_target2
@@ -61,36 +61,36 @@ high_target2:
bl low_target2
ret
// CHECK: high_target2:
-// CHECK-NEXT: 10000008: 02 00 00 94 bl #8
-// CHECK-NEXT: 1000000c: c0 03 5f d6 ret
+// CHECK-NEXT: 10000008: bl #0x8 <__AArch64ADRPThunk_low_target2>
+// CHECK-NEXT: ret
// Expect Thunk for .text.high
// CHECK: __AArch64ADRPThunk_low_target2:
-// CHECK-NEXT: 10000010: 10 00 f8 90 adrp x16, #-268435456
-// CHECK-NEXT: 10000014: 10 82 03 91 add x16, x16, #224
-// CHECK-NEXT: 10000018: 00 02 1f d6 br x16
+// CHECK-NEXT: 10000010: adrp x16, #-0x10000000
+// CHECK-NEXT: add x16, x16, #0xe0
+// CHECK-NEXT: br x16
// CHECK: Disassembly of section .plt:
// CHECK-EMPTY:
// CHECK-NEXT: .plt:
-// CHECK-NEXT: 10000020: f0 7b bf a9 stp x16, x30, [sp, #-16]!
-// CHECK-NEXT: 10000024: 10 00 00 90 adrp x16, #0
-// CHECK-NEXT: 10000028: 11 92 40 f9 ldr x17, [x16, #288]
-// CHECK-NEXT: 1000002c: 10 82 04 91 add x16, x16, #288
-// CHECK-NEXT: 10000030: 20 02 1f d6 br x17
-// CHECK-NEXT: 10000034: 1f 20 03 d5 nop
-// CHECK-NEXT: 10000038: 1f 20 03 d5 nop
-// CHECK-NEXT: 1000003c: 1f 20 03 d5 nop
+// CHECK-NEXT: 10000020: stp x16, x30, [sp, #-0x10]!
+// CHECK-NEXT: adrp x16, #0
+// CHECK-NEXT: ldr x17, [x16, #0x120]
+// CHECK-NEXT: add x16, x16, #0x120
+// CHECK-NEXT: br x17
+// CHECK-NEXT: nop
+// CHECK-NEXT: nop
+// CHECK-NEXT: nop
// CHECK-EMPTY:
// CHECK-NEXT: high_target at plt:
-// CHECK-NEXT: 10000040: 10 00 00 90 adrp x16, #0
-// CHECK-NEXT: 10000044: 11 96 40 f9 ldr x17, [x16, #296]
-// CHECK-NEXT: 10000048: 10 a2 04 91 add x16, x16, #296
-// CHECK-NEXT: 1000004c: 20 02 1f d6 br x17
+// CHECK-NEXT: 10000040: adrp x16, #0x0
+// CHECK-NEXT: ldr x17, [x16, #0x128]
+// CHECK-NEXT: add x16, x16, #0x128
+// CHECK-NEXT: br x17
// CHECK-EMPTY:
// CHECK-NEXT: low_target at plt:
-// CHECK-NEXT: 10000050: 10 00 00 90 adrp x16, #0
-// CHECK-NEXT: 10000054: 11 9a 40 f9 ldr x17, [x16, #304]
-// CHECK-NEXT: 10000058: 10 c2 04 91 add x16, x16, #304
-// CHECK-NEXT: 1000005c: 20 02 1f d6 br x17
+// CHECK-NEXT: 10000050: adrp x16, #0x0
+// CHECK-NEXT: ldr x17, [x16, #0x130]
+// CHECK-NEXT: add x16, x16, #0x130
+// CHECK-NEXT: br x17
diff --git a/lld/test/ELF/aarch64-thunk-script.s b/lld/test/ELF/aarch64-thunk-script.s
index 0d735fe9b776..cf8187dd5bb3 100644
--- a/lld/test/ELF/aarch64-thunk-script.s
+++ b/lld/test/ELF/aarch64-thunk-script.s
@@ -1,11 +1,11 @@
// REQUIRES: aarch64
-// RUN: llvm-mc -filetype=obj -triple=aarch64-linux-gnu %s -o %t
+// RUN: llvm-mc -filetype=obj -triple=aarch64 %s -o %t.o
// RUN: echo "SECTIONS { \
// RUN: .text_low 0x2000: { *(.text_low) } \
// RUN: .text_high 0x8002000 : { *(.text_high) } \
// RUN: } " > %t.script
-// RUN: ld.lld --script %t.script %t -o %t2 2>&1
-// RUN: llvm-objdump -d -triple=aarch64-linux-gnu %t2 | FileCheck %s
+// RUN: ld.lld --script %t.script %t.o -o %t
+// RUN: llvm-objdump -d --no-show-raw-insn --print-imm-hex %t | FileCheck %s
// Check that we have the out of branch range calculation right. The immediate
// field is signed so we have a slightly higher negative displacement.
@@ -28,16 +28,16 @@ high_target:
// CHECK: Disassembly of section .text_low:
// CHECK-EMPTY:
// CHECK-NEXT: _start:
-// CHECK-NEXT: 2000: 02 00 00 94 bl #8
-// CHECK-NEXT: 2004: c0 03 5f d6 ret
+// CHECK-NEXT: 2000: bl #0x8 <__AArch64AbsLongThunk_high_target>
+// CHECK-NEXT: ret
// CHECK: __AArch64AbsLongThunk_high_target:
-// CHECK-NEXT: 2008: 50 00 00 58 ldr x16, #8
-// CHECK-NEXT: 200c: 00 02 1f d6 br x16
+// CHECK-NEXT: 2008: ldr x16, #0x8
+// CHECK-NEXT: br x16
// CHECK: $d:
// CHECK-NEXT: 2010: 00 20 00 08 .word 0x08002000
// CHECK-NEXT: 2014: 00 00 00 00 .word 0x00000000
// CHECK: Disassembly of section .text_high:
// CHECK-EMPTY:
// CHECK-NEXT: high_target:
-// CHECK-NEXT: 8002000: 00 00 00 96 bl #-134217728
-// CHECK-NEXT: 8002004: c0 03 5f d6 ret
+// CHECK-NEXT: 8002000: bl #-0x8000000 <_start>
+// CHECK-NEXT: ret
diff --git a/lld/test/ELF/aarch64-thunk-section-location.s b/lld/test/ELF/aarch64-thunk-section-location.s
index f1bc584983f7..71283717419b 100644
--- a/lld/test/ELF/aarch64-thunk-section-location.s
+++ b/lld/test/ELF/aarch64-thunk-section-location.s
@@ -1,7 +1,7 @@
// REQUIRES: aarch64
-// RUN: llvm-mc -filetype=obj -triple=aarch64-linux-gnu %s -o %t
-// RUN: ld.lld %t -o %t2 2>&1
-// RUN: llvm-objdump -d --start-address=0x81d1008 -stop-address=0x81d1014 -triple=aarch64-linux-gnu %t2 | FileCheck %s
+// RUN: llvm-mc -filetype=obj -triple=aarch64-linux-gnu %s -o %t.o
+// RUN: ld.lld %t.o -o %t
+// RUN: llvm-objdump -d --start-address=0x81d1008 -stop-address=0x81d1014 --no-show-raw-insn %t | FileCheck %s
// Check that the range extension thunks are dumped close to the aarch64 branch
// range of 128 MiB
.section .text.1, "ax", %progbits
@@ -35,7 +35,7 @@ high_target:
ret
// CHECK: __AArch64AbsLongThunk_high_target:
-// CHECK-NEXT: 81d1008: 50 00 00 58 ldr x16, #8
-// CHECK-NEXT: 81d100c: 00 02 1f d6 br x16
+// CHECK-NEXT: 81d1008: ldr x16, #8
+// CHECK-NEXT: 81d100c: br x16
// CHECK: $d:
-// CHECK-NEXT: 81d1010: 00 20 21 08 .word 0x08212000
+// CHECK-NEXT: 81d1010: 00 20 21 08 .word 0x08212000
diff --git a/lld/test/ELF/arm-thumb-condbranch-thunk.s b/lld/test/ELF/arm-thumb-condbranch-thunk.s
index b00736688859..522d7aa8567f 100644
--- a/lld/test/ELF/arm-thumb-condbranch-thunk.s
+++ b/lld/test/ELF/arm-thumb-condbranch-thunk.s
@@ -1,15 +1,15 @@
// REQUIRES: arm
-// RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=thumbv7a-none-linux-gnueabi %s -o %t
-// RUN: ld.lld %t -o %t2
+// RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=thumbv7a-none-linux-gnueabi %s -o %t.o
+// RUN: ld.lld %t.o -o %t
// The output file is large, most of it zeroes. We dissassemble only the
// parts we need to speed up the test and avoid a large output file
-// RUN: llvm-objdump -d %t2 -start-address=524288 -stop-address=524316 -triple=thumbv7a-linux-gnueabihf | FileCheck -check-prefix=CHECK1 %s
-// RUN: llvm-objdump -d %t2 -start-address=1048576 -stop-address=1048584 -triple=thumbv7a-linux-gnueabihf | FileCheck -check-prefix=CHECK2 %s
-// RUN: llvm-objdump -d %t2 -start-address=1572864 -stop-address=1572872 -triple=thumbv7a-linux-gnueabihf | FileCheck -check-prefix=CHECK3 %s
-// RUN: llvm-objdump -d %t2 -start-address=5242884 -stop-address=5242894 -triple=thumbv7a-linux-gnueabihf | FileCheck -check-prefix=CHECK4 %s
-// RUN: llvm-objdump -d %t2 -start-address=5767168 -stop-address=5767174 -triple=thumbv7a-linux-gnueabihf | FileCheck -check-prefix=CHECK5 %s
-// RUN: llvm-objdump -d %t2 -start-address=16777220 -stop-address=16777240 -triple=thumbv7a-linux-gnueabihf | FileCheck -check-prefix=CHECK6 %s
-// RUN: llvm-objdump -d %t2 -start-address=17825792 -stop-address=17825798 -triple=thumbv7a-linux-gnueabihf | FileCheck -check-prefix=CHECK7 %s
+// RUN: llvm-objdump -d %t --print-imm-hex --start-address=0x80000 --stop-address=0x80010 -triple=thumbv7a-linux-gnueabihf | FileCheck -check-prefix=CHECK1 %s
+// RUN: llvm-objdump -d %t --print-imm-hex --start-address=0x100000 --stop-address=0x100008 -triple=thumbv7a-linux-gnueabihf | FileCheck -check-prefix=CHECK2 %s
+// RUN: llvm-objdump -d %t --print-imm-hex --start-address=0x180000 --stop-address=0x18000a -triple=thumbv7a-linux-gnueabihf | FileCheck -check-prefix=CHECK3 %s
+// RUN: llvm-objdump -d %t --print-imm-hex --start-address=0x500004 --stop-address=0x500008 -triple=thumbv7a-linux-gnueabihf | FileCheck -check-prefix=CHECK4 %s
+// RUN: llvm-objdump -d %t --print-imm-hex --start-address=0x580000 --stop-address=0x580006 -triple=thumbv7a-linux-gnueabihf | FileCheck -check-prefix=CHECK5 %s
+// RUN: llvm-objdump -d %t --print-imm-hex --start-address=0x1000004 --stop-address=0x100000c -triple=thumbv7a-linux-gnueabihf | FileCheck -check-prefix=CHECK6 %s
+// RUN: llvm-objdump -d %t --print-imm-hex --start-address=0x1100000 --stop-address=0x1100006 -triple=thumbv7a-linux-gnueabihf | FileCheck -check-prefix=CHECK7 %s
// Test Range extension Thunks for the Thumb conditional branch instruction.
// This instruction only has a range of 1Mb whereas all the other Thumb wide
// Branch instructions have 16Mb range. We still place our pre-created Thunk
@@ -37,11 +37,11 @@ _start:
// CHECK1-EMPTY:
// CHECK1-NEXT: tfunc00:
// CHECK1-NEXT: 80000: 70 47 bx lr
-// CHECK1-NEXT: 80002: 7f f3 ff d7 bl #16252926
+// CHECK1-NEXT: 80002: 7f f3 ff d7 bl #0xf7fffe
// CHECK1: __Thumbv7ABSLongThunk_tfunc05:
-// CHECK1-NEXT: 80008: 7f f2 fa bf b.w #2621428 <tfunc05>
+// CHECK1-NEXT: 80008: 7f f2 fa bf b.w #0x27fff4 <tfunc05>
// CHECK1: __Thumbv7ABSLongThunk_tfunc00:
-// CHECK1-NEXT: 8000c: ff f7 f8 bf b.w #-16 <tfunc00>
+// CHECK1-NEXT: 8000c: ff f7 f8 bf b.w #-0x10 <tfunc00>
FUNCTION 01
// tfunc02 is within range of tfunc02
beq.w tfunc02
@@ -50,15 +50,15 @@ _start:
bne.w tfunc05
// CHECK2: tfunc01:
// CHECK2-NEXT: 100000: 70 47 bx lr
-// CHECK2-NEXT: 100002: 3f f0 fd a7 beq.w #524282 <tfunc02>
-// CHECK2-NEXT: 100006: 7f f4 ff a7 bne.w #-524290 <__Thumbv7ABSLongThunk_tfunc05>
+// CHECK2-NEXT: 100002: 3f f0 fd a7 beq.w #0x7fffa <tfunc02>
+// CHECK2-NEXT: 100006: 7f f4 ff a7 bne.w #-0x80002 <__Thumbv7ABSLongThunk_tfunc05>
FUNCTION 02
// We can reach the Thunk Section created for bne.w tfunc05
bne.w tfunc05
beq.w tfunc00
-// CHECK3: 180000: 70 47 bx lr
-// CHECK3-NEXT: 180002: 40 f4 01 80 bne.w #-1048574 <__Thumbv7ABSLongThunk_tfunc05>
-// CHECK3-NEXT: 180006: 00 f4 01 80 beq.w #-1048574 <__Thumbv7ABSLongThunk_tfunc00>
+// CHECK3: 180000: 70 47 bx lr
+// CHECK3-NEXT: 180002: 40 f4 01 80 bne.w #-0xffffe <__Thumbv7ABSLongThunk_tfunc05>
+// CHECK3-NEXT: 180006: 00 f4 01 80 beq.w #-0xffffe <__Thumbv7ABSLongThunk_tfunc00>
FUNCTION 03
FUNCTION 04
FUNCTION 05
@@ -67,13 +67,13 @@ _start:
FUNCTION 08
FUNCTION 09
// CHECK4: __Thumbv7ABSLongThunk_tfunc03:
-// CHECK4-NEXT: 500004: ff f4 fc bf b.w #-3145736 <tfunc03>
+// CHECK4-NEXT: 500004: ff f4 fc bf b.w #-0x300008 <tfunc03>
FUNCTION 10
// We can't reach any Thunk Section, create a new one
beq.w tfunc03
// CHECK5: tfunc10:
// CHECK5-NEXT: 580000: 70 47 bx lr
-// CHECK5-NEXT: 580002: 3f f4 ff a7 beq.w #-524290 <__Thumbv7ABSLongThunk_tfunc03>
+// CHECK5-NEXT: 580002: 3f f4 ff a7 beq.w #-0x80002 <__Thumbv7ABSLongThunk_tfunc03>
FUNCTION 11
FUNCTION 12
FUNCTION 13
@@ -96,13 +96,13 @@ _start:
FUNCTION 30
FUNCTION 31
// CHECK6: __Thumbv7ABSLongThunk_tfunc33:
-// CHECK6-NEXT: 1000004: ff f0 fc bf b.w #1048568 <tfunc33>
+// CHECK6-NEXT: 1000004: ff f0 fc bf b.w #0xffff8 <tfunc33>
// CHECK6: __Thumbv7ABSLongThunk_tfunc00:
-// CHECK6-NEXT: 1000008: 7f f4 fa 97 b.w #-16252940 <tfunc00>
+// CHECK6-NEXT: 1000008: 7f f4 fa 97 b.w #-0xf8000c <tfunc00>
FUNCTION 32
FUNCTION 33
// We should be able to reach an existing ThunkSection.
b.w tfunc00
// CHECK7: tfunc33:
-// CHECK7-NEXT: 1100000: 70 47 bx lr
-// CHECK7-NEXT: 1100002: 00 f7 01 b8 b.w #-1048574 <__Thumbv7ABSLongThunk_tfunc00>
+// CHECK7-NEXT: 1100000: 70 47 bx lr
+// CHECK7-NEXT: 1100002: 00 f7 01 b8 b.w #-0xffffe <__Thumbv7ABSLongThunk_tfunc00>
More information about the llvm-commits
mailing list