blob: abc0a7ce5a811ed1f1e6744948bb27473d880346 (
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
|
# REQUIRES: mips
# Check handling of R_MIPS_26 relocation.
# Build shared library
# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o
# RUN: lld -flavor gnu -target mipsel -shared -o %t.so %t-so.o
# Build executable
# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o
# RUN: llvm-readobj -relocations %t-o.o | \
# RUN: FileCheck -check-prefix=OBJ-REL %s
# RUN: lld -flavor gnu -target mipsel -e glob -o %t.exe %t-o.o %t.so
# RUN: llvm-objdump -section-headers -disassemble %t.exe | \
# RUN: FileCheck -check-prefix=EXE %s
# RUN: llvm-readobj -relocations %t.exe | FileCheck -check-prefix=EXE-REL %s
# Object file has three R_MIPS_26 relocations
# OBJ-REL: Relocations [
# OBJ-REL-NEXT: Section (2) .rel.text {
# OBJ-REL-NEXT: 0x8 R_MIPS_26 .text 0x0
# OBJ-REL-NEXT: 0x10 R_MIPS_26 glob 0x0
# OBJ-REL-NEXT: 0x18 R_MIPS_26 T1 0x0
# OBJ-REL-NEXT: }
# OBJ-REL-NEXT: ]
# Executable file has the only relocation for external symbol
# EXE-REL: Relocations [
# EXE-REL-NEXT: Section (5) .rel.plt {
# EXE-REL-NEXT: 0x402008 R_MIPS_JUMP_SLOT T1 0x0
# EXE-REL-NEXT: }
# EXE-REL-NEXT: ]
# EXE: Disassembly of section .plt:
# EXE: .plt:
# PLTA entry. Points to the .got.plt[1]
# EXE: 400180: 40 00 0f 3c lui $15, 64
# EXE-NEXT: 400184: 08 20 f9 8d lw $25, 8200($15)
# EXE-NEXT: 400188: 08 00 20 03 jr $25
# EXE-NEXT: 40018c: 08 20 f8 25 addiu $24, $15, 8200
# EXE: Disassembly of section .text:
# EXE: glob:
# EXE-NEXT: 400190: 09 f8 20 03 jalr $25
# EXE-NEXT: 400194: 00 00 00 00 nop
#
# Jump to 'loc' label address
# EXE-NEXT: 400198: 68 00 10 0c jal 4194720
# EXE-NEXT: 40019c: 00 00 00 00 nop
#
# EXE: loc:
# Jump to 'glob' label address
# EXE-NEXT: 4001a0: 64 00 10 0c jal 4194704
# EXE-NEXT: 4001a4: 00 00 00 00 nop
#
# Jump to the first PLT entry (.plt + 32) for T1 entry
# EXE-NEXT: 4001a8: 60 00 10 0c jal 4194688
# EXE-NEXT: 4001ac: 00 00 00 00 nop
# EXE: Sections:
# EXE: Idx Name Size Address Type
# EXE: 6 .plt 00000030 0000000000400160 TEXT DATA
# EXE: 10 .got.plt 0000000c 0000000000402000 DATA
# so.o
---
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_MIPS
Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32]
Sections:
- Name: .text
Type: SHT_PROGBITS
Size: 0x0C
AddressAlign: 16
Flags: [SHF_EXECINSTR, SHF_ALLOC]
Symbols:
Global:
- Name: T1
Section: .text
Type: STT_FUNC
Value: 0x0
Size: 4
# o.o
---
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_MIPS
Flags: [ EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32 ]
Sections:
- Name: .text
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
AddressAlign: 0x04
Content: '09F82003000000000400000C000000000000000C000000000000000C00000000'
- Name: .rel.text
Type: SHT_REL
Link: .symtab
AddressAlign: 0x04
Info: .text
Relocations:
- Offset: 0x08
Symbol: .text
Type: R_MIPS_26
- Offset: 0x10
Symbol: glob
Type: R_MIPS_26
- Offset: 0x18
Symbol: T1
Type: R_MIPS_26
Symbols:
Local:
- Name: loc
Section: .text
Value: 0x10
- Name: .text
Type: STT_SECTION
Section: .text
Global:
- Name: glob
Section: .text
- Name: T1
...
|