]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/ELF/mips-64-rels.s
Vendor import of lld trunk r338150:
[FreeBSD/FreeBSD.git] / test / ELF / mips-64-rels.s
1 # REQUIRES: mips
2 # Check handling multiple MIPS N64 ABI relocations packed
3 # into the single relocation record.
4
5 # RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux %s -o %t.o
6 # RUN: ld.lld %t.o -o %t.exe
7 # RUN: llvm-objdump -d -s -t %t.exe | FileCheck %s
8 # RUN: llvm-readobj -r %t.exe | FileCheck -check-prefix=REL %s
9
10 # CHECK:      __start:
11 # CHECK-NEXT:    20000:   3c 1c 00 01   lui     $gp, 1
12 #                                                    ^-- 0x20000 - 0x37ff0
13 #                                                    ^-- 0 - 0xfffffffffffe8010
14 #                                                    ^-- %hi(0x17ff0)
15 # CHECK:      loc:
16 # CHECK-NEXT:    20004:   67 9c 7f f0   daddiu  $gp, $gp, 32752
17 #                                                    ^-- 0x20000 - 0x37ff0
18 #                                                    ^-- 0 - 0xfffffffffffe8010
19 #                                                    ^-- %lo(0x17ff0)
20
21 # CHECK:      Contents of section .rodata:
22 # CHECK-NEXT:  {{[0-9a-f]+}} ffffffff fffe8014
23 #                            ^-- 0x20004 - 0x37ff0 = 0xfffffffffffe8014
24
25 # CHECK: 0000000000020004   .text   00000000 loc
26 # CHECK: 0000000000037ff0   .got    00000000 .hidden _gp
27 # CHECK: 0000000000020000   .text   00000000 __start
28
29 # REL:      Relocations [
30 # REL-NEXT: ]
31
32   .text
33   .global  __start
34 __start:
35   lui     $gp,%hi(%neg(%gp_rel(__start)))     # R_MIPS_GPREL16
36                                               # R_MIPS_SUB
37                                               # R_MIPS_HI16
38 loc:
39   daddiu  $gp,$gp,%lo(%neg(%gp_rel(__start))) # R_MIPS_GPREL16
40                                               # R_MIPS_SUB
41                                               # R_MIPS_LO16
42
43   .section  .rodata,"a",@progbits
44   .gpdword(loc)                               # R_MIPS_GPREL32
45                                               # R_MIPS_64