xref: /aosp_15_r20/external/llvm/test/MC/Mips/reloc-directive.s (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker# RUN: llvm-mc -triple mips-unknown-linux < %s -show-encoding -target-abi=o32 \
2*9880d681SAndroid Build Coastguard Worker# RUN:     | FileCheck -check-prefix=ASM %s
3*9880d681SAndroid Build Coastguard Worker# RUN: llvm-mc -triple mips64-unknown-linux < %s -show-encoding -target-abi=n32 \
4*9880d681SAndroid Build Coastguard Worker# RUN:     | FileCheck -check-prefix=ASM %s
5*9880d681SAndroid Build Coastguard Worker# RUN: llvm-mc -triple mips64-unknown-linux < %s -show-encoding -target-abi=n64 \
6*9880d681SAndroid Build Coastguard Worker# RUN:     | FileCheck -check-prefix=ASM %s
7*9880d681SAndroid Build Coastguard Worker# RUN: llvm-mc -triple mips-unknown-linux < %s -show-encoding -target-abi=o32 \
8*9880d681SAndroid Build Coastguard Worker# RUN:     -filetype=obj | llvm-readobj -sections -section-data -r | \
9*9880d681SAndroid Build Coastguard Worker# RUN:     FileCheck -check-prefix=OBJ-O32 %s
10*9880d681SAndroid Build Coastguard Worker# RUN: llvm-mc -triple mips64-unknown-linux < %s -show-encoding -target-abi=n32 \
11*9880d681SAndroid Build Coastguard Worker# RUN:     -filetype=obj | llvm-readobj -sections -section-data -r | \
12*9880d681SAndroid Build Coastguard Worker# RUN:     FileCheck -check-prefix=OBJ-N32 %s
13*9880d681SAndroid Build Coastguard Worker# RUN: llvm-mc -triple mips64-unknown-linux < %s -show-encoding -target-abi=n64 \
14*9880d681SAndroid Build Coastguard Worker# RUN:     -filetype=obj | llvm-readobj -sections -section-data -r | \
15*9880d681SAndroid Build Coastguard Worker# RUN:     FileCheck -check-prefix=OBJ-N64 %s
16*9880d681SAndroid Build Coastguard Worker	.text
17*9880d681SAndroid Build Coastguard Workerfoo:
18*9880d681SAndroid Build Coastguard Worker	.reloc 4, R_MIPS_NONE, foo   # ASM: .reloc 4, R_MIPS_NONE, foo
19*9880d681SAndroid Build Coastguard Worker	.reloc 0, R_MIPS_NONE, foo+4 # ASM: .reloc 0, R_MIPS_NONE, foo+4
20*9880d681SAndroid Build Coastguard Worker	.reloc 8, R_MIPS_32, foo+8   # ASM: .reloc 8, R_MIPS_32, foo+8
21*9880d681SAndroid Build Coastguard Worker	nop
22*9880d681SAndroid Build Coastguard Worker	nop
23*9880d681SAndroid Build Coastguard Worker	nop
24*9880d681SAndroid Build Coastguard Worker	.reloc 12, R_MIPS_NONE       # ASM: .reloc 12, R_MIPS_NONE{{$}}
25*9880d681SAndroid Build Coastguard Worker        nop
26*9880d681SAndroid Build Coastguard Worker
27*9880d681SAndroid Build Coastguard Worker# OBJ-O32-LABEL: Name: .text
28*9880d681SAndroid Build Coastguard Worker# OBJ-O32:       0000: 00000000 00000000 00000008
29*9880d681SAndroid Build Coastguard Worker# OBJ-O32-LABEL: }
30*9880d681SAndroid Build Coastguard Worker# OBJ-O32-LABEL: Relocations [
31*9880d681SAndroid Build Coastguard Worker# OBJ-O32:       0x0 R_MIPS_NONE .text 0x0
32*9880d681SAndroid Build Coastguard Worker# OBJ-O32:       0x4 R_MIPS_NONE .text 0x0
33*9880d681SAndroid Build Coastguard Worker# OBJ-O32:       0x8 R_MIPS_32 .text 0x0
34*9880d681SAndroid Build Coastguard Worker# OBJ-O32:       0xC R_MIPS_NONE -   0x0
35*9880d681SAndroid Build Coastguard Worker
36*9880d681SAndroid Build Coastguard Worker# FIXME: We can't get N32 correct at the moment. If we use a mips-* triple then
37*9880d681SAndroid Build Coastguard Worker#        we incorrectly drop the addend. If we use a mips64-* triple then we
38*9880d681SAndroid Build Coastguard Worker#        incorrectly use the 3-reloc encoding (and ELF64). mips64-* triples
39*9880d681SAndroid Build Coastguard Worker#        are closest to being correct so we use them for now.
40*9880d681SAndroid Build Coastguard Worker#        This should be corrected once the triple bugfixes allow us to be ABI
41*9880d681SAndroid Build Coastguard Worker#        dependent rather than triple dependent.
42*9880d681SAndroid Build Coastguard Worker# OBJ-N32-LABEL: Name: .text
43*9880d681SAndroid Build Coastguard Worker# OBJ-N32:       0000: 00000000 00000000 00000000
44*9880d681SAndroid Build Coastguard Worker# OBJ-N32-LABEL: }
45*9880d681SAndroid Build Coastguard Worker# OBJ-N32-LABEL: Relocations [
46*9880d681SAndroid Build Coastguard Worker# OBJ-N32:       0x0 R_MIPS_NONE/R_MIPS_NONE/R_MIPS_NONE .text 0x4
47*9880d681SAndroid Build Coastguard Worker# OBJ-N32:       0x4 R_MIPS_NONE/R_MIPS_NONE/R_MIPS_NONE .text 0x0
48*9880d681SAndroid Build Coastguard Worker# OBJ-N32:       0x8 R_MIPS_32/R_MIPS_NONE/R_MIPS_NONE .text 0x8
49*9880d681SAndroid Build Coastguard Worker# OBJ-N32:       0xC R_MIPS_NONE/R_MIPS_NONE/R_MIPS_NONE -   0x0
50*9880d681SAndroid Build Coastguard Worker
51*9880d681SAndroid Build Coastguard Worker# OBJ-N64-LABEL: Name: .text
52*9880d681SAndroid Build Coastguard Worker# OBJ-N64:       0000: 00000000 00000000 00000000
53*9880d681SAndroid Build Coastguard Worker# OBJ-N64-LABEL: }
54*9880d681SAndroid Build Coastguard Worker# OBJ-N64-LABEL: Relocations [
55*9880d681SAndroid Build Coastguard Worker# OBJ-N64:       0x0 R_MIPS_NONE/R_MIPS_NONE/R_MIPS_NONE .text 0x4
56*9880d681SAndroid Build Coastguard Worker# OBJ-N64:       0x4 R_MIPS_NONE/R_MIPS_NONE/R_MIPS_NONE .text 0x0
57*9880d681SAndroid Build Coastguard Worker# OBJ-N64:       0x8 R_MIPS_32/R_MIPS_NONE/R_MIPS_NONE .text 0x8
58*9880d681SAndroid Build Coastguard Worker# OBJ-N64:       0xC R_MIPS_NONE/R_MIPS_NONE/R_MIPS_NONE -   0x0
59