mips-dynamic.s
4.05 KB
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
# REQUIRES: mips
# Check MIPS specific .dynamic section entries.
# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t.o
# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %p/Inputs/mips-dynamic.s -o %td.o
# RUN: ld.lld -shared %td.o -o %td.so
# RUN: ld.lld %t.o %td.so -o %t.exe
# RUN: llvm-readobj --sections --dynamic-table %t.exe \
# RUN: | FileCheck -check-prefixes=EXE,NOPIE %s
# RUN: ld.lld -pie %t.o %td.so -o %t.so
# RUN: llvm-readobj --sections --dyn-syms --dynamic-table %t.so \
# RUN: | FileCheck -check-prefixes=EXE,PIE %s
# RUN: ld.lld %t.o --image-base=0x123000 %td.so -o %t.exe
# RUN: llvm-readobj --sections --dynamic-table %t.exe \
# RUN: | FileCheck -check-prefix=IMAGE_BASE %s
# RUN: ld.lld -shared %t.o %td.so -o %t.so
# RUN: llvm-readobj --sections --dyn-syms --dynamic-table %t.so \
# RUN: | FileCheck -check-prefix=DSO %s
# EXE: Sections [
# EXE: Name: .dynamic
# EXE-NEXT: Type: SHT_DYNAMIC
# EXE-NEXT: Flags [
# EXE-NEXT: SHF_ALLOC
# EXE-NEXT: ]
# EXE: Name: .rld_map
# EXE-NEXT: Type: SHT_PROGBITS
# EXE-NEXT: Flags [
# EXE-NEXT: SHF_ALLOC
# EXE-NEXT: SHF_WRITE
# EXE-NEXT: ]
# EXE-NEXT: Address: [[RLDMAPADDR:0x[0-9a-f]+]]
# EXE-NEXT: Offset:
# EXE-NEXT: Size: 4
# EXE: Name: .got
# EXE-NEXT: Type: SHT_PROGBITS
# EXE-NEXT: Flags [ (0x10000003)
# EXE-NEXT: SHF_ALLOC
# EXE-NEXT: SHF_MIPS_GPREL
# EXE-NEXT: SHF_WRITE
# EXE-NEXT: ]
# EXE-NEXT: Address: [[GOTADDR:0x[0-9a-f]+]]
# EXE-NEXT: Offset:
# EXE-NEXT: Size: 8
# EXE: ]
# PIE: DynamicSection [
# PIE-NEXT: Tag Type Name/Value
# PIE: 0x00000004 HASH 0x{{[0-9A-F]+}}
# PIE-NEXT: 0x70000001 MIPS_RLD_VERSION 1
# PIE-NEXT: 0x70000005 MIPS_FLAGS NOTPOT
# PIE-NEXT: 0x70000006 MIPS_BASE_ADDRESS 0x0
# PIE-NEXT: 0x70000011 MIPS_SYMTABNO 2
# PIE-NEXT: 0x7000000A MIPS_LOCAL_GOTNO 2
# PIE-NEXT: 0x70000013 MIPS_GOTSYM 0x2
# PIE-NEXT: 0x00000003 PLTGOT [[GOTADDR]]
# PIE-NEXT: 0x70000035 MIPS_RLD_MAP_REL 0x{{[0-9A-F]+}}
# PIE-NEXT: 0x00000000 NULL 0x0
# PIE-NEXT: ]
# NOPIE: DynamicSection [
# NOPIE-NEXT: Tag Type Name/Value
# NOPIE: 0x00000004 HASH 0x{{[0-9A-F]+}}
# NOPIE-NEXT: 0x70000001 MIPS_RLD_VERSION 1
# NOPIE-NEXT: 0x70000005 MIPS_FLAGS NOTPOT
# NOPIE-NEXT: 0x70000006 MIPS_BASE_ADDRESS 0x10000
# NOPIE-NEXT: 0x70000011 MIPS_SYMTABNO 2
# NOPIE-NEXT: 0x7000000A MIPS_LOCAL_GOTNO 2
# NOPIE-NEXT: 0x70000013 MIPS_GOTSYM 0x2
# NOPIE-NEXT: 0x00000003 PLTGOT [[GOTADDR]]
# NOPIE-NEXT: 0x70000016 MIPS_RLD_MAP [[RLDMAPADDR]]
# NOPIE-NEXT: 0x70000035 MIPS_RLD_MAP_REL 0x{{[0-9A-F]+}}
# NOPIE-NEXT: 0x00000000 NULL 0x0
# NOPIE-NEXT: ]
# IMAGE_BASE: 0x70000006 MIPS_BASE_ADDRESS 0x123000
# DSO: Sections [
# DSO: Name: .dynamic
# DSO-NEXT: Type: SHT_DYNAMIC
# DSO-NEXT: Flags [
# DSO-NEXT: SHF_ALLOC
# DSO-NEXT: ]
# DSO: Name: .got
# DSO-NEXT: Type: SHT_PROGBITS
# DSO-NEXT: Flags [ (0x10000003)
# DSO-NEXT: SHF_ALLOC
# DSO-NEXT: SHF_MIPS_GPREL
# DSO-NEXT: SHF_WRITE
# DSO-NEXT: ]
# DSO-NEXT: Address: [[GOTADDR:0x[0-9a-f]+]]
# DSO-NEXT: Offset:
# DSO-NEXT: Size: 8
# DSO: ]
# DSO: DynamicSymbols [
# DSO: Name:
# DSO: Name: __start
# DSO: Name: _foo
# DSO: ]
# DSO: DynamicSection [
# DSO-NEXT: Tag Type Name/Value
# DSO-DAG: 0x00000003 PLTGOT [[GOTADDR]]
# DSO-DAG: 0x70000001 MIPS_RLD_VERSION 1
# DSO-DAG: 0x70000005 MIPS_FLAGS NOTPOT
# DSO-DAG: 0x70000006 MIPS_BASE_ADDRESS 0x0
# DSO-DAG: 0x7000000A MIPS_LOCAL_GOTNO 2
# DSO-DAG: 0x70000011 MIPS_SYMTABNO 3
# DSO-DAG: 0x70000013 MIPS_GOTSYM 0x3
# DSO: ]
.text
.globl __start,_foo
.type _foo,@function
__start:
nop