xref: /aosp_15_r20/external/llvm/test/MC/Mips/relocation-n64.s (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker// RUN: llvm-mc -triple mips64-unknown-linux < %s -show-encoding \
2*9880d681SAndroid Build Coastguard Worker// RUN:     | FileCheck -check-prefixes=ENCBE,FIXUP %s
3*9880d681SAndroid Build Coastguard Worker// RUN: llvm-mc -triple mips64el-unknown-linux < %s -show-encoding \
4*9880d681SAndroid Build Coastguard Worker// RUN:     | FileCheck -check-prefixes=ENCLE,FIXUP %s
5*9880d681SAndroid Build Coastguard Worker// RUN: llvm-mc -filetype=obj -triple mips64el-unknown-linux < %s \
6*9880d681SAndroid Build Coastguard Worker// RUN:     | llvm-readobj -r | FileCheck -check-prefix=RELOC %s
7*9880d681SAndroid Build Coastguard Worker// RUN: llvm-mc -filetype=obj -triple mips64-unknown-linux < %s \
8*9880d681SAndroid Build Coastguard Worker// RUN:     | llvm-readobj -sections -section-data \
9*9880d681SAndroid Build Coastguard Worker// RUN:     | FileCheck -check-prefix=DATA %s
10*9880d681SAndroid Build Coastguard Worker
11*9880d681SAndroid Build Coastguard Worker// Test that we produce the correct relocation.
12*9880d681SAndroid Build Coastguard Worker// FIXME: move more relocation only tests here.
13*9880d681SAndroid Build Coastguard Worker
14*9880d681SAndroid Build Coastguard Worker// Check prefixes:
15*9880d681SAndroid Build Coastguard Worker// RELOC - Check the relocation in the object.
16*9880d681SAndroid Build Coastguard Worker// FIXUP - Check the fixup on the instruction.
17*9880d681SAndroid Build Coastguard Worker// ENCBE - Check the big-endian encoding on the instruction.
18*9880d681SAndroid Build Coastguard Worker// ENCLE - Check the little-endian encoding on the instruction.
19*9880d681SAndroid Build Coastguard Worker// ????? - Placeholder. Relocation is defined but the way of generating it is
20*9880d681SAndroid Build Coastguard Worker//         unknown.
21*9880d681SAndroid Build Coastguard Worker// FIXME - Placeholder. Generation method is known but doesn't work.
22*9880d681SAndroid Build Coastguard Worker
23*9880d681SAndroid Build Coastguard Worker// DATA-LABEL: Name: .text
24*9880d681SAndroid Build Coastguard Worker// DATA:       SectionData (
25*9880d681SAndroid Build Coastguard Worker
26*9880d681SAndroid Build Coastguard Worker// DATA-NEXT:  0000: 24620000 24620000
27*9880d681SAndroid Build Coastguard Worker        addiu $2, $3, %lo(%neg(%gp_rel(foo))) // RELOC: R_MIPS_GPREL16/R_MIPS_SUB/R_MIPS_LO16 foo
28*9880d681SAndroid Build Coastguard Worker                                              // ENCBE: addiu $2, $3, %lo(%neg(%gp_rel(foo))) # encoding: [0x24,0x62,A,A]
29*9880d681SAndroid Build Coastguard Worker                                              // ENCLE: addiu $2, $3, %lo(%neg(%gp_rel(foo))) # encoding: [A,A,0x62,0x24]
30*9880d681SAndroid Build Coastguard Worker                                              // FIXUP: # fixup A - offset: 0, value: %lo(%neg(%gp_rel(foo))), kind: fixup_Mips_GPOFF_LO
31*9880d681SAndroid Build Coastguard Worker
32*9880d681SAndroid Build Coastguard Worker        addiu $2, $3, %lo(%neg(%gp_rel(bar))) // RELOC: R_MIPS_GPREL16/R_MIPS_SUB/R_MIPS_LO16 .data
33*9880d681SAndroid Build Coastguard Worker                                              // ENCBE: addiu $2, $3, %lo(%neg(%gp_rel(bar))) # encoding: [0x24,0x62,A,A]
34*9880d681SAndroid Build Coastguard Worker                                              // ENCLE: addiu $2, $3, %lo(%neg(%gp_rel(bar))) # encoding: [A,A,0x62,0x24]
35*9880d681SAndroid Build Coastguard Worker                                              // FIXUP: # fixup A - offset: 0, value: %lo(%neg(%gp_rel(bar))), kind: fixup_Mips_GPOFF_LO
36*9880d681SAndroid Build Coastguard Worker
37*9880d681SAndroid Build Coastguard Worker        .data
38*9880d681SAndroid Build Coastguard Worker        .word 0
39*9880d681SAndroid Build Coastguard Workerbar:
40*9880d681SAndroid Build Coastguard Worker        .word 1
41*9880d681SAndroid Build Coastguard Worker// DATA-LABEL: Section {
42