xref: /llvm-project/llvm/test/tools/llvm-readobj/thin-archive.test (revision 42a21778f61cdc8462ce2cfb6ad7bc1992b2063c)
1# RUN: rm -f %t.a
2# RUN: rm -rf %t
3# RUN: mkdir -p %t
4# RUN: yaml2obj --docnum=1 %s -o %t/1.o
5# RUN: yaml2obj --docnum=2 %s -o %t/2.o
6# RUN: yaml2obj --docnum=3 %s -o %t/3.o
7# RUN: llvm-ar rcT %t.a %t/1.o %t/2.o %t/3.o
8
9# Test that basic dumping works for all members.
10# RUN: llvm-readobj --all %t.a | FileCheck %s --check-prefixes=LLVM,COFF
11# RUN: llvm-readelf --all %t.a | FileCheck %s --check-prefixes=GNU,COFF
12
13# LLVM: File: {{.*}}1.o
14# LLVM: Format: elf64-x86-64
15# LLVM: ElfHeader {
16# LLVM:   SectionHeaderCount: 3
17# LLVM: Sections [
18# LLVM: Relocations [
19# LLVM: Symbols [
20
21# GNU: ELF Header:
22# GNU:   Number of section headers: 3
23# GNU: Section Headers:
24
25# LLVM: File: {{.*}}2.o
26# LLVM: Format: elf32-i386
27# LLVM: ElfHeader {
28# LLVM:   SectionHeaderCount: 4
29# LLVM: Sections [
30# LLVM: Relocations [
31# LLVM: Symbols [
32
33# GNU: ELF Header:
34# GNU:   Number of section headers: 4
35# GNU: Section Headers:
36
37# LLVM: File: {{.*}}3.o
38# LLVM: Format: COFF-ARM
39# COFF: ImageFileHeader {
40# COFF: Sections [
41# COFF: Relocations [
42# COFF: Symbols [
43
44# Overwrite one of the members with a member of a different size to show that
45# the size field in the member header is not relevant.
46# RUN: rm -f %t/2.o
47# RUN: cp %t/1.o %t/2.o
48# RUN: llvm-readobj --file-headers %t.a | FileCheck %s --check-prefix=RESIZED
49
50# RESIZED: File: {{.*}}1.o
51# RESIZED: Format: elf64-x86-64
52# RESIZED: File: {{.*}}2.o
53# RESIZED: Format: elf64-x86-64
54
55# Remove the second member and show that the first can still be dumped, but that the last isn't.
56# RUN: rm %t/2.o
57# RUN: not llvm-readobj --file-headers %t.a 2> %t.err | FileCheck %s --check-prefix=MISSING
58# RUN: FileCheck -DMSG=%errc_ENOENT %s --check-prefix=ERR --input-file=%t.err
59
60# MISSING:     File: {{.*}}1.o
61# MISSING:     Format: elf64-x86-64
62# MISSING-NOT: File: {{.*}}3.o
63# ERR: error: '{{.*}}.a': '{{.*}}2.o': [[MSG]]
64
65--- !ELF
66FileHeader:
67  Class:   ELFCLASS64
68  Data:    ELFDATA2LSB
69  Type:    ET_REL
70  Machine: EM_X86_64
71
72--- !ELF
73FileHeader:
74  Class:   ELFCLASS32
75  Data:    ELFDATA2LSB
76  Type:    ET_REL
77  Machine: EM_386
78Sections:
79  - Name: .foo
80    Type: SHT_PROGBITS
81
82--- !COFF
83header:
84  Machine:         IMAGE_FILE_MACHINE_ARMNT
85  Characteristics: [  ]
86sections: []
87symbols: []
88