Recommit "rL366894: [yaml2obj] - Allow custom fields for the SHT_UNDEF sections."
[llvm-complete.git] / test / tools / llvm-readobj / elf-dynamic-not-in-pt-dynamic.test
blob482d683f5c108ae0b20069344c3066f1423fd134
1 ## Show that llvm-readobj/llvm-readelf tools can dump the .dynamic
2 ## section when it is not in a PT_DYNAMIC segment.
4 # RUN: yaml2obj %s -o %t.o
5 # RUN: llvm-readobj --dynamic-table %t.o 2>&1 \
6 # RUN:   | FileCheck --check-prefixes=WARNING,LLVM %s
7 # RUN: llvm-readelf --dynamic-table %t.o 2>&1 \
8 # RUN:   | FileCheck --check-prefixes=WARNING,GNU %s
10 # WARNING:   warning: The SHT_DYNAMIC section '.dynamic' is not contained within the PT_DYNAMIC segment
12 # LLVM:      DynamicSection [ (2 entries)
13 # LLVM-NEXT:   Tag                Type     Name/Value
14 # LLVM-NEXT:   0x0000000000000018 BIND_NOW 0x1
15 # LLVM-NEXT:   0x0000000000000000 NULL     0x0
16 # LLVM-NEXT: ]
18 # GNU:      Dynamic section at offset 0x{{.*}} contains 2 entries:
19 # GNU-NEXT:   Tag                Type       Name/Value
20 # GNU-NEXT:   0x0000000000000018 (BIND_NOW) 0x1
21 # GNU-NEXT:   0x0000000000000000 (NULL)     0x0
23 --- !ELF
24 FileHeader:
25   Class:   ELFCLASS64
26   Data:    ELFDATA2LSB
27   Type:    ET_EXEC
28   Machine: EM_X86_64
29 Sections:
30   - Name: .dynamic
31     Type: SHT_DYNAMIC
32     Flags: [SHF_ALLOC]
33     Address: 0x1000
34     AddressAlign: 0x1000
35     Entries:
36       - Tag:   DT_BIND_NOW
37         Value: 0x1
38       - Tag:   DT_NULL
39         Value: 0x0
40   - Name: .text
41     Type: SHT_PROGBITS
42     Flags: [SHF_ALLOC]
43     Address: 0x1100
44     AddressAlign: 0x100
45     Content: "00"
46 ProgramHeaders:
47   - Type: PT_LOAD
48     VAddr: 0x1000
49     Sections:
50       - Section: .dynamic
51       - Section: .text
52   - Type: PT_DYNAMIC
53     VAddr: 0x1000
54     Sections:
55       - Section: .text