Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / llvm / test / tools / llvm-objcopy / COFF / only-keep-debug.test
blob3ba5f4eb0cd076269fb057ff519795bfa8226c97
1 RUN: yaml2obj %p/Inputs/only-keep-sections.yaml -o %t.in.exe
3 RUN: llvm-objcopy --only-keep-debug %t.in.exe %t.out.exe
4 RUN: llvm-readobj --sections %t.out.exe | FileCheck %s --check-prefix=SECTIONS
5 RUN: llvm-objdump -t %t.out.exe | FileCheck %s --check-prefix=SYMBOLS
7 ## --only-keep-debug suppresses the default --strip-all.
8 RUN: llvm-strip --only-keep-debug %t.in.exe -o %t-strip.out.exe
9 RUN: cmp %t.out.exe %t-strip.out.exe
11 Check that all non-debug/buildid sections with IMAGE_SCN_CNT_CODE
12 or IMAGE_SCN_CNT_INITIALIZED_DATA are truncated, and no others.
14 SECTIONS:      Sections [
15 SECTIONS-NEXT:  Section {
16 SECTIONS-NEXT:   Number: 1
17 SECTIONS-NEXT:   Name: .text
18 SECTIONS-NEXT:   VirtualSize: 0x4
19 SECTIONS-NEXT:   VirtualAddress:
20 SECTIONS-NEXT:   RawDataSize: 0
21 SECTIONS:       Section {
22 SECTIONS-NEXT:   Number: 2
23 SECTIONS-NEXT:   Name: .rdata
24 SECTIONS-NEXT:   VirtualSize: 0x4
25 SECTIONS-NEXT:   VirtualAddress:
26 SECTIONS-NEXT:   RawDataSize: 0
27 SECTIONS:       Section {
28 SECTIONS-NEXT:   Number: 3
29 SECTIONS-NEXT:   Name: .buildid
30 SECTIONS-NEXT:   VirtualSize: 0x4
31 SECTIONS-NEXT:   VirtualAddress:
32 SECTIONS-NEXT:   RawDataSize: 512
33 SECTIONS:       Section {
34 SECTIONS-NEXT:   Number: 4
35 SECTIONS-NEXT:   Name: .reloc
36 SECTIONS-NEXT:   VirtualSize: 0x4
37 SECTIONS-NEXT:   VirtualAddress:
38 SECTIONS-NEXT:   RawDataSize: 0
39 SECTIONS:       Section {
40 SECTIONS-NEXT:   Number: 5
41 SECTIONS-NEXT:   Name: .debug_discardable
42 SECTIONS-NEXT:   VirtualSize: 0x4
43 SECTIONS-NEXT:   VirtualAddress:
44 SECTIONS-NEXT:   RawDataSize: 512
45 SECTIONS:       Section {
46 SECTIONS-NEXT:   Number: 6
47 SECTIONS-NEXT:   Name: .debug_undiscardable
48 SECTIONS-NEXT:   VirtualSize: 0x4
49 SECTIONS-NEXT:   VirtualAddress:
50 SECTIONS-NEXT:   RawDataSize: 512
51 SECTIONS:       Section {
52 SECTIONS-NEXT:   Number: 7
53 SECTIONS-NEXT:   Name: .unflagged
54 SECTIONS-NEXT:   VirtualSize: 0x4
55 SECTIONS-NEXT:   VirtualAddress:
56 SECTIONS-NEXT:   RawDataSize: 512
58 SYMBOLS:      SYMBOL TABLE:
59 SYMBOLS-NEXT: main
60 SYMBOLS-NEXT: debug_discardable_sym
61 SYMBOLS-NEXT: debug_undiscardable_sym
62 SYMBOLS-EMPTY: