1# RUN: yaml2obj %s -o %t
2# RUN: llvm-objdump --all-headers %t | FileCheck %s
3# RUN: llvm-objdump -x %t | FileCheck %s
4
5## Note: --all-headers (-x) is an alias for --archive-headers --file-headers
6## --section-headers --private-headers --reloc --syms (-afhprt). Test for them
7## in the following order which provides GNU objdump compatability.
8
9# CHECK:       file format elf64-x86-64
10# CHECK-EMPTY:
11# CHECK-NEXT:  architecture: x86_64
12# CHECK-NEXT:  start address: 0x0000000000000000
13# CHECK-EMPTY:
14# CHECK-NEXT: Program Header:
15# CHECK: Dynamic Section:
16# CHECK: Sections:
17# CHECK: SYMBOL TABLE:
18# CHECK: RELOCATION RECORDS FOR [.text]:
19
20## Check how we dump the archives.
21## Check we dump the appropriate headers for each file in the archive.
22
23# RUN: cp %t %t2
24# RUN: rm -f %t.a
25# RUN: llvm-ar rcs %t.a %t %t2
26# RUN: llvm-objdump --all-headers %t.a | FileCheck %s --check-prefix=ARCHIVE
27
28# ARCHIVE: {{.*}}.a({{.*}}):   file format elf64-x86-64
29# ARCHIVE: rw-r--r--
30# ARCHIVE: architecture: x86_64
31# ARCHIVE: start address: 0x0000000000000000
32# ARCHIVE: Program Header:
33# ARCHIVE: Dynamic Section:
34# ARCHIVE: Sections:
35# ARCHIVE: SYMBOL TABLE:
36# ARCHIVE: RELOCATION RECORDS FOR [.text]:
37# ARCHIVE: {{.*}}.a({{.*}}2):   file format elf64-x86-64
38# ARCHIVE: rw-r--r--
39# ARCHIVE: architecture: x86_64
40# ARCHIVE: start address: 0x0000000000000000
41# ARCHIVE: Program Header:
42# ARCHIVE: Dynamic Section:
43# ARCHIVE: Sections:
44# ARCHIVE: SYMBOL TABLE:
45# ARCHIVE: RELOCATION RECORDS FOR [.text]:
46
47!ELF
48FileHeader:
49  Class:           ELFCLASS64
50  Data:            ELFDATA2LSB
51  Type:            ET_REL
52  Machine:         EM_X86_64
53Sections:
54  - Name: .text
55    Type: SHT_PROGBITS
56  - Name: .rel.text
57    Type: SHT_REL
58    Info: .text
59    Relocations:
60      - Offset: 0x1
61        Symbol: foo
62        Type: R_X86_64_32
63  - Name:            .dynamic
64    Type:            SHT_DYNAMIC
65    Flags:           [ SHF_WRITE, SHF_ALLOC ]
66    EntSize:         0x0000000000000010
67    Entries:
68      - Tag:             DT_INIT
69        Value:           0x00000000000006A0
70      - Tag:             DT_NULL
71        Value:           0x0000000000000000
72Symbols:
73  - Name:    foo
74    Section: .text
75