xref: /aosp_15_r20/external/llvm/test/MC/ARM/elf-reloc-01.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 _MergedGlobals show up as explicit symbol reloc
15*9880d681SAndroid Build Coastguard Worker
16*9880d681SAndroid Build Coastguard Worker	movw	r2, :lower16:_MergedGlobals
17*9880d681SAndroid Build Coastguard Worker
18*9880d681SAndroid Build Coastguard Worker_MergedGlobals:
19*9880d681SAndroid Build Coastguard Worker	.long	1
20*9880d681SAndroid Build Coastguard Worker
21*9880d681SAndroid Build Coastguard Worker
22*9880d681SAndroid Build Coastguard Worker// OBJ: Relocations [
23*9880d681SAndroid Build Coastguard Worker// OBJ:   Section {{.*}} .rel.text {
24*9880d681SAndroid Build Coastguard Worker// OBJ:     0x{{[0-9,A-F]+}} R_ARM_MOVW_ABS_NC _MergedGlobals
25*9880d681SAndroid Build Coastguard Worker// OBJ:   }
26*9880d681SAndroid Build Coastguard Worker// OBJ: ]
27