2 # Check MIPS multi-GOT layout.
4 # RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t0.o
5 # RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \
6 # RUN: %p/Inputs/mips-mgot-1.s -o %t1.o
7 # RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \
8 # RUN: %p/Inputs/mips-mgot-2.s -o %t2.o
9 # RUN: echo "SECTIONS { \
10 # RUN: . = 0x10000; .text : { *(.text) } \
11 # RUN: . = 0x70000; .got : { *(.got) } \
13 # RUN: ld.lld -shared -mips-got-size 52 --script %t.script %t0.o %t1.o %t2.o -o %t.so
14 # RUN: llvm-objdump -s --section=.got -t %t.so | FileCheck %s
15 # RUN: llvm-readobj -r --dyn-syms -A %t.so | FileCheck -check-prefix=GOT %s
17 # CHECK: SYMBOL TABLE:
18 # CHECK: 00000000 l .tdata 00000000 loc0
19 # CHECK: [[FOO0:[0-9a-f]+]] g .text 00000000 foo0
20 # CHECK: 00000000 g .tdata 00000000 tls0
21 # CHECK: 00000004 g .tdata 00000000 tls1
22 # CHECK: [[FOO2:[0-9a-f]+]] g .text 00000000 foo2
24 # CHECK: Contents of section .got:
25 # CHECK-NEXT: 70000 00000000 80000000 [[FOO0]] [[FOO2]]
26 # CHECK-NEXT: 70010 00000000 00000004 00010000 00020000
27 # CHECK-NEXT: 70020 00030000 00040000 00050000 00060000
28 # CHECK-NEXT: 70030 00000000 00000000 00000000 00000000
29 # CHECK-NEXT: 70040 00000000 00000000 00000000
32 # GOT-NEXT: Section (7) .rel.dyn {
33 # GOT-NEXT: 0x70018 R_MIPS_REL32 -
34 # GOT-NEXT: 0x7001C R_MIPS_REL32 -
35 # GOT-NEXT: 0x70020 R_MIPS_REL32 -
36 # GOT-NEXT: 0x70024 R_MIPS_REL32 -
37 # GOT-NEXT: 0x70028 R_MIPS_REL32 -
38 # GOT-NEXT: 0x7002C R_MIPS_REL32 -
39 # GOT-NEXT: 0x70030 R_MIPS_REL32 foo0
40 # GOT-NEXT: 0x70034 R_MIPS_REL32 foo2
41 # GOT-NEXT: 0x70044 R_MIPS_TLS_DTPMOD32 -
42 # GOT-NEXT: 0x70010 R_MIPS_TLS_TPREL32 tls0
43 # GOT-NEXT: 0x70038 R_MIPS_TLS_TPREL32 tls0
44 # GOT-NEXT: 0x7003C R_MIPS_TLS_DTPMOD32 tls0
45 # GOT-NEXT: 0x70040 R_MIPS_TLS_DTPREL32 tls0
46 # GOT-NEXT: 0x70014 R_MIPS_TLS_TPREL32 tls1
50 # GOT: DynamicSymbols [
53 # GOT-NEXT: Value: 0x[[FOO0:[0-9A-F]+]]
56 # GOT-NEXT: Name: foo2
57 # GOT-NEXT: Value: 0x[[FOO2:[0-9A-F]+]]
62 # GOT-NEXT: Canonical gp value: 0x77FF0
63 # GOT-NEXT: Reserved entries [
66 # GOT-NEXT: Access: -32752
67 # GOT-NEXT: Initial: 0x0
68 # GOT-NEXT: Purpose: Lazy resolver
72 # GOT-NEXT: Access: -32748
73 # GOT-NEXT: Initial: 0x80000000
74 # GOT-NEXT: Purpose: Module pointer (GNU extension)
77 # GOT-NEXT: Local entries [
79 # GOT-NEXT: Global entries [
82 # GOT-NEXT: Access: -32744
83 # GOT-NEXT: Initial: 0x[[FOO0]]
84 # GOT-NEXT: Value: 0x[[FOO0]]
85 # GOT-NEXT: Type: None
86 # GOT-NEXT: Section: .text
87 # GOT-NEXT: Name: foo0
91 # GOT-NEXT: Access: -32740
92 # GOT-NEXT: Initial: 0x[[FOO2]]
93 # GOT-NEXT: Value: 0x[[FOO2]]
94 # GOT-NEXT: Type: None
95 # GOT-NEXT: Section: .text
96 # GOT-NEXT: Name: foo2
99 # GOT-NEXT: Number of TLS and multi-GOT entries: 15
105 lw $
2, %got
(.data)($gp) # page entry
106 addi $
2, $
2, %lo
(.data)
107 lw $
2, %call16
(foo0
)($gp
) # global entry
108 addiu $
2, $
2, %tlsgd
(tls0
) # tls gd entry
109 addiu $
2, $
2, %gottprel
(tls0
) # tls got entry
110 addiu $
2, $
2, %tlsldm
(loc0
) # tls ld entry
115 .section .tdata,"awT",%progbits