aboutsummaryrefslogtreecommitdiff
path: root/test/elf/Mips/got-page-64.test
blob: 21bece5d32420aa5d50024b68c9e4fbaed284deb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
# Check handling of R_MIPS_GOT_DISP / PAGE / OFST relocations.

# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o
# RUN: lld -flavor gnu -target mips64el -shared -o %t.so %t-so.o
# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o
# RUN: lld -flavor gnu -target mips64el -e T0 -o %t.exe %t-o.o %t.so
# RUN: llvm-readobj -symbols -dyn-symbols -mips-plt-got %t.exe \
# RUN:   | FileCheck -check-prefix=GOT %s
# RUN: llvm-objdump -s %t.exe | FileCheck -check-prefix=RAW %s

# GOT:      Symbol {
# GOT:        Name: T0 (1)
# GOT-NEXT:   Value: 0x1200001F0
# GOT:      Symbol {
# GOT:        Name: LT1 (4)
# GOT-NEXT:   Value: 0x120000218
# GOT:      Symbol {
# GOT:        Name: LT2 (8)
# GOT-NEXT:   Value: 0x12000021C
# GOT:      Symbol {
# GOT:        Name: T1@ (1)
# GOT-NEXT:   Value: 0x0
# GOT:      Symbol {
# GOT:        Name: T2@ (4)
# GOT-NEXT:   Value: 0x0

# GOT:      Primary GOT {
# GOT-NEXT:   Canonical gp value: 0x120008FF0
# GOT-NEXT:   Reserved entries [
# GOT-NEXT:     Entry {
# GOT-NEXT:       Address: 0x120001000
# GOT-NEXT:       Access: -32752
# GOT-NEXT:       Initial: 0x0
# GOT-NEXT:       Purpose: Lazy resolver
# GOT-NEXT:     }
# GOT-NEXT:     Entry {
# GOT-NEXT:       Address: 0x120001008
# GOT-NEXT:       Access: -32744
# GOT-NEXT:       Initial: 0x8000000000000000
# GOT-NEXT:       Purpose: Module pointer (GNU extension)
# GOT-NEXT:     }
# GOT-NEXT:   ]
# GOT-NEXT:   Local entries [
# GOT-NEXT:     Entry {
# GOT-NEXT:       Address: 0x120001010
# GOT-NEXT:       Access: -32736
# GOT-NEXT:       Initial: 0x120000218
# GOT-NEXT:     }
# GOT-NEXT:     Entry {
# GOT-NEXT:       Address: 0x120001018
# GOT-NEXT:       Access: -32728
# GOT-NEXT:       Initial: 0x120000000
# GOT-NEXT:     }
# GOT-NEXT:     Entry {
# GOT-NEXT:       Address: 0x120001020
# GOT-NEXT:       Access: -32720
# GOT-NEXT:       Initial: 0x120000000
# GOT-NEXT:     }
# GOT-NEXT:   ]
# GOT-NEXT:   Global entries [
# GOT-NEXT:     Entry {
# GOT-NEXT:       Address: 0x120001028
# GOT-NEXT:       Access: -32712
# GOT-NEXT:       Initial: 0x0
# GOT-NEXT:       Value: 0x0
# GOT-NEXT:       Type: Function (0x2)
# GOT-NEXT:       Section: Undefined (0x0)
# GOT-NEXT:       Name: T1@ (1)
# GOT-NEXT:     }
# GOT-NEXT:     Entry {
# GOT-NEXT:       Address: 0x120001030
# GOT-NEXT:       Access: -32704
# GOT-NEXT:       Initial: 0x0
# GOT-NEXT:       Value: 0x0
# GOT-NEXT:       Type: Function (0x2)
# GOT-NEXT:       Section: Undefined (0x0)
# GOT-NEXT:       Name: T2@ (4)
# GOT-NEXT:     }
# GOT-NEXT:   ]
# GOT-NEXT:   Number of TLS and multi-GOT entries: 0
# GOT-NEXT: }

# RAW:      Contents of section .text:
# RAW-NEXT:  1200001f0 38800000 20800000 38800000 40800000  8... ...8...@...
#                      ^ = -32712 (T1)
#                               ^ = -32736 (LT1)
#                                        ^ -32712 (T1)
#                                                 ^ -32704 (T2)
# RAW-NEXT:  120000200 28800000 30800000 00000000 00000000  (...0...........
#                      ^ -32728 (PAGE)
#                               ^ -32720 (PAGE)
#                                        ^ T1 OFST
#                                                 ^ T2 OFST
# RAW-NEXT:  120000210 18020000 1c020000 00000000 00000000  ................
#                      ^ LT1 OFST
#                               ^ LT2 OFST

# so.o
---
FileHeader:
  Class:   ELFCLASS64
  Data:    ELFDATA2LSB
  Type:    ET_REL
  Machine: EM_MIPS
  Flags:   [EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ARCH_64]

Sections:
- Name:         .text
  Type:         SHT_PROGBITS
  Size:         8
  AddressAlign: 16
  Flags:        [SHF_EXECINSTR, SHF_ALLOC]

Symbols:
  Global:
    - Name:    T1
      Section: .text
      Type:    STT_FUNC
      Value:   0x0
      Size:    0x4
    - Name:    T2
      Section: .text
      Type:    STT_FUNC
      Value:   0x4
      Size:    0x4

# o.o
---
FileHeader:
  Class:   ELFCLASS64
  Data:    ELFDATA2LSB
  Type:    ET_REL
  Machine: EM_MIPS
  Flags:   [EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ARCH_64]

Sections:
  - Name:            .text
    Type:            SHT_PROGBITS
    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
    AddressAlign:    0x4
    Size:            0x30

  - Name:            .rel.text
    Type:            SHT_RELA
    Link:            .symtab
    Info:            .text
    AddressAlign:    0x04
    Relocations:
      - Offset:      0x0
        Symbol:      T1
        Type:        R_MIPS_GOT_DISP
      - Offset:      0x4
        Symbol:      LT1
        Type:        R_MIPS_GOT_DISP
      - Offset:      0x8
        Symbol:      T1
        Type:        R_MIPS_GOT_PAGE
      - Offset:      0xC
        Symbol:      T2
        Type:        R_MIPS_GOT_PAGE
      - Offset:      0x10
        Symbol:      LT1
        Type:        R_MIPS_GOT_PAGE
      - Offset:      0x14
        Symbol:      LT2
        Type:        R_MIPS_GOT_PAGE
      - Offset:      0x18
        Symbol:      T1
        Type:        R_MIPS_GOT_OFST
      - Offset:      0x1C
        Symbol:      T2
        Type:        R_MIPS_GOT_OFST
      - Offset:      0x20
        Symbol:      LT1
        Type:        R_MIPS_GOT_OFST
      - Offset:      0x24
        Symbol:      LT2
        Type:        R_MIPS_GOT_OFST

Symbols:
  Local:
    - Name:    .text
      Type:    STT_SECTION
      Section: .text

  Global:
    - Name:    T0
      Type:    STT_FUNC
      Section: .text
      Size:    0x8
    - Name:    LT1
      Type:    STT_FUNC
      Section: .text
      Value:   0x28
      Size:    0x4
    - Name:    LT2
      Type:    STT_FUNC
      Section: .text
      Value:   0x2c
      Size:    0x4
    - Name:    T1
    - Name:    T2
...