1## Test how we dump archives.
2
3## Show that dumping operations apply to all members in an archive.
4
5# RUN: rm -f %t.a
6# RUN: rm -rf %t.dir
7# RUN: mkdir -p %t.dir
8# RUN: yaml2obj --docnum=1 %s -o %t.dir/trivial.obj.elf-x86-64
9# RUN: yaml2obj --docnum=2 %s -o %t.dir/trivial.obj.elf-i386
10# RUN: yaml2obj --docnum=3 %s -o %t.dir/trivial.obj.coff-arm
11
12# RUN: llvm-ar rc %t.a %t.dir/trivial.obj.elf-x86-64 %t.dir/trivial.obj.elf-i386 %t.dir/trivial.obj.coff-arm
13# RUN: llvm-readobj --all %t.a | FileCheck %s -DARFILE="%t.a" --check-prefixes=LLVM,COFF
14# RUN: llvm-readelf --all %t.a | FileCheck %s -DARFILE="%t.a" --check-prefixes=GNU,COFF
15
16# LLVM: {{^$}}
17# LLVM-NEXT: File: [[ARFILE]](trivial.obj.elf-x86-64)
18# LLVM: Format: elf64-x86-64
19# LLVM: ElfHeader {
20# LLVM:   Machine: EM_X86_64
21# LLVM: Sections [
22# LLVM: Relocations [
23# LLVM: Symbols [
24# LLVM: Notes [
25# LLVM: ]
26# LLVM: StackSizes [
27# LLVM: ]
28
29# GNU: {{^$}}
30# GNU-NEXT: File: [[ARFILE]](trivial.obj.elf-x86-64)
31# GNU: ELF Header:
32# GNU:   Machine: Advanced Micro Devices X86-64
33# GNU: Section Headers:
34# GNU: There are no section groups in this file.
35
36# LLVM-EMPTY:
37# LLVM-NEXT: File: [[ARFILE]](trivial.obj.elf-i386)
38# LLVM: Format: elf32-i386
39# LLVM: ElfHeader {
40# LLVM:   Machine: EM_386
41# LLVM: Sections [
42# LLVM: Relocations [
43# LLVM: Symbols [
44# LLVM: Notes [
45# LLVM: ]
46# LLVM: StackSizes [
47# LLVM: ]
48
49# GNU-EMPTY:
50# GNU-NEXT: File: [[ARFILE]](trivial.obj.elf-i386)
51# GNU: ELF Header:
52# GNU:   Machine: Intel 80386
53# GNU: Section Headers:
54# GNU: There are no section groups in this file.
55
56# LLVM-EMPTY:
57# LLVM-NEXT: File: [[ARFILE]](trivial.obj.coff-arm)
58# LLVM: Format: COFF-ARM
59# GNU-EMPTY:
60# GNU-NEXT: File: [[ARFILE]](trivial.obj.coff-arm)
61# COFF: ImageFileHeader {
62# COFF:   Machine: IMAGE_FILE_MACHINE_ARMNT
63# COFF: Sections [
64# COFF: Relocations [
65# COFF: Symbols [
66
67--- !ELF
68FileHeader:
69  Class:   ELFCLASS64
70  Data:    ELFDATA2LSB
71  Type:    ET_REL
72  Machine: EM_X86_64
73
74--- !ELF
75FileHeader:
76  Class:   ELFCLASS32
77  Data:    ELFDATA2LSB
78  Type:    ET_REL
79  Machine: EM_386
80
81--- !COFF
82header:
83  Machine:         IMAGE_FILE_MACHINE_ARMNT
84  Characteristics: [  ]
85sections: []
86symbols: []
87
88## Here we test that we report a warning and continue dumping when an archive contains
89## an unrecognized object. We add a dummy archive to the middle of another archive,
90## so that it is between two valid objects.
91
92# RUN: rm -f %t2.a
93# RUN: llvm-ar rc %t.dir/broken.a %t.dir/trivial.obj.elf-x86-64
94# RUN: llvm-ar qc %t2.a %t.dir/trivial.obj.elf-x86-64 %t.dir/broken.a %t.dir/trivial.obj.elf-x86-64
95# RUN: llvm-readobj --all %t2.a 2>&1 | FileCheck %s -DARFILE="%t2.a" --check-prefix=BROKEN
96# RUN: llvm-readelf --all %t2.a 2>&1 | FileCheck %s -DARFILE="%t2.a" --check-prefix=BROKEN
97
98# BROKEN: File: [[ARFILE]](trivial.obj.elf-x86-64)
99# BROKEN: warning: '[[ARFILE]]': broken.a has an unsupported file type
100# BROKEN: File: [[ARFILE]](trivial.obj.elf-x86-64)
101