xref: /aosp_15_r20/external/llvm/test/MC/ARM/elf-reloc-02.s (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker// RUN: llvm-mc -triple=armv7-linux-gnueabi \
2*9880d681SAndroid Build Coastguard Worker// RUN:    -mcpu=cortex-a8 -mattr=-neon -mattr=+vfp2  \
3*9880d681SAndroid Build Coastguard Worker// RUN:    -filetype=obj %s -o - | \
4*9880d681SAndroid Build Coastguard Worker// RUN:   llvm-readobj -r | FileCheck -check-prefix=OBJ %s
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Worker// Ensure no regression on ARM/gcc compatibility for
7*9880d681SAndroid Build Coastguard Worker// emitting explicit symbol relocs for nonexternal symbols
8*9880d681SAndroid Build Coastguard Worker// versus section symbol relocs (with offset) -
9*9880d681SAndroid Build Coastguard Worker//
10*9880d681SAndroid Build Coastguard Worker// Default llvm behavior is to emit as section symbol relocs nearly
11*9880d681SAndroid Build Coastguard Worker// everything that is not an undefined external. Unfortunately, this
12*9880d681SAndroid Build Coastguard Worker// diverges from what codesourcery ARM/gcc does!
13*9880d681SAndroid Build Coastguard Worker//
14*9880d681SAndroid Build Coastguard Worker// Tests that reloc to .L.str* show up as explicit symbols
15*9880d681SAndroid Build Coastguard Worker
16*9880d681SAndroid Build Coastguard Worker	movw	r1, :lower16:.L.str
17*9880d681SAndroid Build Coastguard Worker	movt	r1, :upper16:.L.str
18*9880d681SAndroid Build Coastguard Worker
19*9880d681SAndroid Build Coastguard Worker	.section	.rodata,"a",%progbits
20*9880d681SAndroid Build Coastguard Worker.L.str:
21*9880d681SAndroid Build Coastguard Worker	.asciz	"@null\n"
22*9880d681SAndroid Build Coastguard Worker
23*9880d681SAndroid Build Coastguard Worker// OBJ:      Relocations [
24*9880d681SAndroid Build Coastguard Worker// OBJ:        Section {{.*}} .rel.text {
25*9880d681SAndroid Build Coastguard Worker// OBJ-NEXT:     0x{{[0-9,A-F]+}} R_ARM_MOVW_ABS_NC .L.str
26*9880d681SAndroid Build Coastguard Worker// OBJ:        }
27*9880d681SAndroid Build Coastguard Worker// OBJ:      ]
28