blob: e24843d46b006c91df33e57a1f2060b4d65cc17a [file] [log] [blame]
Jake Ehrlich1bfefc12017-11-13 22:13:08 +00001# RUN: yaml2obj %s > %t
2# RUN: llvm-objcopy -strip-debug %t %t2
3# RUN: llvm-readobj -file-headers -sections -symbols %t2 | FileCheck %s
4
Alexander Shaposhnikovcca69982018-05-07 19:32:09 +00005# We run yaml2obj again rather than copy %t to avoid interfering
6# with llvm-objcopy's test (which potentially could have corrupted/updated the binary).
7
8# RUN: yaml2obj %s > %t3
9# RUN: llvm-strip -strip-debug %t3
10# RUN: llvm-readobj -file-headers -sections -symbols %t3 | FileCheck %s
11# RUN: cmp %t2 %t3
12
13# RUN: not llvm-strip -strip-debug 2>&1 | FileCheck %s --check-prefix=NO-INPUT-FILES
14
Jake Ehrlich1bfefc12017-11-13 22:13:08 +000015!ELF
16FileHeader:
17 Class: ELFCLASS64
18 Data: ELFDATA2LSB
19 Type: ET_REL
20 Machine: EM_X86_64
21Sections:
22 - Name: .debugfoo
23 Type: SHT_PROGBITS
24 Content: "00000000"
25 - Name: .text
26 Type: SHT_PROGBITS
27 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
28 AddressAlign: 0x0000000000000010
29 Content: "00000000"
30Symbols:
31 Global:
32 - Name: foo
33 Section: .text
34 - Name: debugfoo
35 Section: .debugfoo
36
37# CHECK: SectionHeaderCount: 5
38
39# CHECK: Name: .text
40# CHECK: Name: .symtab
41# CHECK: Name: .strtab
42# CHECK: Name: .shstrtab
43
44# Check that *only* foo is copied and not debugfoo
45# CHECK: Symbols [
46# CHECK-NEXT: Symbol {
47# CHECK-NEXT: Name:
48# CHECK-NEXT: Value:
49# CHECK-NEXT: Size:
50# CHECK-NEXT: Binding:
51# CHECK-NEXT: Type:
52# CHECK-NEXT: Other:
53# CHECK-NEXT: Section: Undefined
54# CHECK-NEXT: }
55# CHECK-NEXT: Symbol {
56# CHECK-NEXT: Name: foo
57# CHECK-NEXT: Value:
58# CHECK-NEXT: Size:
59# CHECK-NEXT: Binding: Global
60# CHECK-NEXT: Type:
61# CHECK-NEXT: Other:
62# CHECK-NEXT: Section: .text
63# CHECK-NEXT: }
64# CHECK-NEXT: ]
Alexander Shaposhnikovcca69982018-05-07 19:32:09 +000065
66# NO-INPUT-FILES: No input file specified