Skip to content

Commit b06f16f

Browse files
committed
[ARM][test] Test .long thumb_func - .
Commit 9746286 from 2011 is related to a subtle case that is untested. GNU assembler produces an R_ARM_REL32 relocation. We currently don't, therefore we have to add a workaround in MCExpr.cpp to make the value odd (see commit 8ee6c0e "[MC] Remove isThumbFunc special case").
1 parent ac00726 commit b06f16f

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

llvm/test/MC/ARM/pcrel-global.s

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,21 @@
11
@ RUN: llvm-mc -filetype=obj -triple=armv7 %s -o %t
22
@ RUN: llvm-readelf -r %t | FileCheck %s
3+
@ RUN: llvm-objdump -dr --triple=armv7 %t | FileCheck %s --check-prefix=DISASM
34
@ RUN: llvm-mc -filetype=obj -triple=armebv7 %s -o %t
45
@ RUN: llvm-readelf -r %t | FileCheck %s
56

67
@ CHECK: There are no relocations in this file.
8+
9+
@ DISASM-LABEL: <bar>:
10+
@ DISASM-NEXT: adr.w r0, #-4
11+
@ DISASM-NEXT: adr.w r0, #-8
12+
@ DISASM-NEXT: ldr.w pc, [pc, #-0xc] @ 0x10 <bar>
13+
@ DISASM-NEXT: ldr r0, [pc, #0x0] @ 0x20 <bar+0x10>
14+
@ DISASM-NEXT: add r0, pc
15+
@ DISASM-NEXT: .word 0xffffffef
16+
@@ GNU assembler creates an R_ARM_REL32 referencing bar.
17+
@ DISASM-NOT: {{.}}
18+
719
.syntax unified
820

921
.globl foo
@@ -15,9 +27,16 @@ ldr r0, foo @ arm_ldst_pcrel_12
1527

1628
.thumb
1729
.thumb_func
18-
30+
.type bar, %function
1931
.globl bar
2032
bar:
2133
adr r0, bar @ thumb_adr_pcrel_10
2234
adr.w r0, bar @ t2_adr_pcrel_12
2335
ldr.w pc, bar @ t2_ldst_pcrel_12
36+
37+
ldr r0, .LCPI
38+
.LPC0_1:
39+
add r0, pc
40+
41+
.LCPI:
42+
.long bar-(.LPC0_1+4) @ if there is no relocation, the value should be odd

0 commit comments

Comments
 (0)