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