dynamic-reloc-no-section-headers.test
1.91 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
## Test that we are able to print dynamic relocations with --dyn-relocations
## even when there are no section headers.
# RUN: yaml2obj %s -o %t
# RUN: llvm-readobj --dyn-relocations %t 2>&1 \
# RUN: | FileCheck %s -DFILE=%t --implicit-check-not="warning:" --check-prefix=LLVM-NO-SEC-TABLE
# RUN: llvm-readelf --dyn-relocations %t 2>&1 \
# RUN: | FileCheck %s -DFILE=%t --implicit-check-not="warning:" --check-prefix=GNU-NO-SEC-TABLE
# LLVM-NO-SEC-TABLE: Dynamic Relocations {
# LLVM-NO-SEC-TABLE-NEXT: 0x0 R_X86_64_NONE foo 0x0
# LLVM-NO-SEC-TABLE-NEXT: }
# GNU-NO-SEC-TABLE: 'RELA' relocation section at offset 0xb0 contains 24 bytes:
# GNU-NO-SEC-TABLE-NEXT: Offset Info Type Symbol's Value Symbol's Name + Addend
# GNU-NO-SEC-TABLE-NEXT: 0000000000000000 0000000100000000 R_X86_64_NONE 0000000000000000 foo + 0
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_DYN
Machine: EM_X86_64
Sections:
- Name: .rela.dyn
Type: SHT_RELA
Relocations:
- Type: R_X86_64_NONE
Symbol: 0x1
- Name: .dynamic
Type: SHT_DYNAMIC
Entries:
- Tag: DT_RELA
Value: 0x0
- Tag: DT_RELASZ
Value: 0x18
- Tag: DT_RELAENT
Value: 0x18
## Offset of .dynsym is 0x138. Offset of PT_LOAD is 0xb0.
## 0x138 - 0xb0 == 0x88
- Tag: DT_SYMTAB
Value: 0x88
- Tag: DT_STRSZ
Value: 0x5
## Offset of .dynstr is 0x168. Offset of PT_LOAD is 0xb0.
## 0x168 - 0xb0 == 0xb8
- Tag: DT_STRTAB
Value: 0xb8
- Tag: DT_NULL
Value: 0x0
- Name: .dynsym
Type: SHT_DYNSYM
DynamicSymbols:
- Name: foo
ProgramHeaders:
- Type: PT_LOAD
Sections:
- Section: .rela.dyn
- Section: .dynamic
Section: .dynsym
Section: .dynstr
- Type: PT_DYNAMIC
Sections:
- Section: .dynamic
SectionHeaderTable:
NoHeaders: true