1 RUN: yaml2obj %p/Inputs/only-keep-sections.yaml > %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 Check that all non-debug/buildid sections with IMAGE_SCN_CNT_CODE
8 or IMAGE_SCN_CNT_INITIALIZED_DATA are truncated, and no others.
11 SECTIONS-NEXT: Section {
12 SECTIONS-NEXT: Number: 1
13 SECTIONS-NEXT: Name: .text
14 SECTIONS-NEXT: VirtualSize: 0x4
15 SECTIONS-NEXT: VirtualAddress:
16 SECTIONS-NEXT: RawDataSize: 0
18 SECTIONS-NEXT: Number: 2
19 SECTIONS-NEXT: Name: .rdata
20 SECTIONS-NEXT: VirtualSize: 0x4
21 SECTIONS-NEXT: VirtualAddress:
22 SECTIONS-NEXT: RawDataSize: 0
24 SECTIONS-NEXT: Number: 3
25 SECTIONS-NEXT: Name: .buildid
26 SECTIONS-NEXT: VirtualSize: 0x4
27 SECTIONS-NEXT: VirtualAddress:
28 SECTIONS-NEXT: RawDataSize: 512
30 SECTIONS-NEXT: Number: 4
31 SECTIONS-NEXT: Name: .reloc
32 SECTIONS-NEXT: VirtualSize: 0x4
33 SECTIONS-NEXT: VirtualAddress:
34 SECTIONS-NEXT: RawDataSize: 0
36 SECTIONS-NEXT: Number: 5
37 SECTIONS-NEXT: Name: .debug_discardable
38 SECTIONS-NEXT: VirtualSize: 0x4
39 SECTIONS-NEXT: VirtualAddress:
40 SECTIONS-NEXT: RawDataSize: 512
42 SECTIONS-NEXT: Number: 6
43 SECTIONS-NEXT: Name: .debug_undiscardable
44 SECTIONS-NEXT: VirtualSize: 0x4
45 SECTIONS-NEXT: VirtualAddress:
46 SECTIONS-NEXT: RawDataSize: 512
48 SECTIONS-NEXT: Number: 7
49 SECTIONS-NEXT: Name: .unflagged
50 SECTIONS-NEXT: VirtualSize: 0x4
51 SECTIONS-NEXT: VirtualAddress:
52 SECTIONS-NEXT: RawDataSize: 512
54 SYMBOLS: SYMBOL TABLE:
56 SYMBOLS-NEXT: debug_discardable_sym
57 SYMBOLS-NEXT: debug_undiscardable_sym