]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/ELF/mips-hilo-gp-disp.s
Vendor import of lld trunk r338150:
[FreeBSD/FreeBSD.git] / test / ELF / mips-hilo-gp-disp.s
1 # REQUIRES: mips
2 # Check R_MIPS_HI16 / LO16 relocations calculation against _gp_disp.
3
4 # RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t1.o
5 # RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \
6 # RUN:         %S/Inputs/mips-dynamic.s -o %t2.o
7 # RUN: ld.lld %t1.o %t2.o -o %t.exe
8 # RUN: llvm-objdump -d -t %t.exe | FileCheck -check-prefix=EXE %s
9 # RUN: ld.lld %t1.o %t2.o -shared -o %t.so
10 # RUN: llvm-objdump -d -t %t.so | FileCheck -check-prefix=SO %s
11
12   .text
13   .globl  __start
14 __start:
15   lui    $t0,%hi(_gp_disp)
16   addi   $t0,$t0,%lo(_gp_disp)
17   lw     $v0,%call16(_foo)($gp)
18 bar:
19   lui    $t0,%hi(_gp_disp)
20   addi   $t0,$t0,%lo(_gp_disp)
21
22 # EXE:      Disassembly of section .text:
23 # EXE-NEXT: __start:
24 # EXE-NEXT:  20000:   3c 08 00 02   lui    $8, 2
25 #                                              ^-- %hi(0x47ff0-0x20000)
26 # EXE-NEXT:  20004:   21 08 80 00   addi   $8, $8, -32768
27 #                                                  ^-- %lo(0x38000-0x20004+4)
28 # EXE:      bar:
29 # EXE-NEXT:  2000c:   3c 08 00 01   lui    $8, 1
30 #                                              ^-- %hi(0x38000-0x2000c)
31 # EXE-NEXT:  20010:   21 08 7f f4   addi   $8, $8, 32756
32 #                                                  ^-- %lo(0x38000-0x20010+4)
33
34 # EXE: SYMBOL TABLE:
35 # EXE: 0002000c     .text   00000000 bar
36 # EXE: 00038000     .got    00000000 .hidden _gp
37 # EXE: 00020000     .text   00000000 __start
38
39 # SO:      Disassembly of section .text:
40 # SO-NEXT: __start:
41 # SO-NEXT:  10000:   3c 08 00 02   lui    $8, 2
42 #                                             ^-- %hi(0x28000-0x10000)
43 # SO-NEXT:  10004:   21 08 80 00   addi   $8, $8, -32768
44 #                                                 ^-- %lo(0x28000-0x10004+4)
45 # SO:       bar:
46 # SO-NEXT:   1000c:   3c 08 00 01   lui    $8, 1
47 #                                              ^-- %hi(0x28000-0x1000c)
48 # SO-NEXT:   10010:   21 08 7f f4   addi   $8, $8, 32756
49 #                                                  ^-- %lo(0x28000-0x10010+4)
50
51 # SO: SYMBOL TABLE:
52 # SO: 0001000c     .text   00000000 bar
53 # SO: 00028000     .got    00000000 .hidden _gp
54 # SO: 00010000     .text   00000000 __start