63 lines · plain
1RUN: yaml2obj %p/Inputs/only-keep-sections.yaml -o %t.in.exe2 3RUN: llvm-objcopy --only-keep-debug %t.in.exe %t.out.exe4RUN: llvm-readobj --sections %t.out.exe | FileCheck %s --check-prefix=SECTIONS5RUN: llvm-objdump -t %t.out.exe | FileCheck %s --check-prefix=SYMBOLS6 7## --only-keep-debug suppresses the default --strip-all.8RUN: llvm-strip --only-keep-debug %t.in.exe -o %t-strip.out.exe9RUN: cmp %t.out.exe %t-strip.out.exe10 11Check that all non-debug/buildid sections with IMAGE_SCN_CNT_CODE12or IMAGE_SCN_CNT_INITIALIZED_DATA are truncated, and no others.13 14SECTIONS: Sections [15SECTIONS-NEXT: Section {16SECTIONS-NEXT: Number: 117SECTIONS-NEXT: Name: .text18SECTIONS-NEXT: VirtualSize: 0x419SECTIONS-NEXT: VirtualAddress:20SECTIONS-NEXT: RawDataSize: 021SECTIONS: Section {22SECTIONS-NEXT: Number: 223SECTIONS-NEXT: Name: .rdata24SECTIONS-NEXT: VirtualSize: 0x425SECTIONS-NEXT: VirtualAddress:26SECTIONS-NEXT: RawDataSize: 027SECTIONS: Section {28SECTIONS-NEXT: Number: 329SECTIONS-NEXT: Name: .buildid30SECTIONS-NEXT: VirtualSize: 0x431SECTIONS-NEXT: VirtualAddress:32SECTIONS-NEXT: RawDataSize: 51233SECTIONS: Section {34SECTIONS-NEXT: Number: 435SECTIONS-NEXT: Name: .reloc36SECTIONS-NEXT: VirtualSize: 0x437SECTIONS-NEXT: VirtualAddress:38SECTIONS-NEXT: RawDataSize: 039SECTIONS: Section {40SECTIONS-NEXT: Number: 541SECTIONS-NEXT: Name: .debug_discardable42SECTIONS-NEXT: VirtualSize: 0x443SECTIONS-NEXT: VirtualAddress:44SECTIONS-NEXT: RawDataSize: 51245SECTIONS: Section {46SECTIONS-NEXT: Number: 647SECTIONS-NEXT: Name: .debug_undiscardable48SECTIONS-NEXT: VirtualSize: 0x449SECTIONS-NEXT: VirtualAddress:50SECTIONS-NEXT: RawDataSize: 51251SECTIONS: Section {52SECTIONS-NEXT: Number: 753SECTIONS-NEXT: Name: .unflagged54SECTIONS-NEXT: VirtualSize: 0x455SECTIONS-NEXT: VirtualAddress:56SECTIONS-NEXT: RawDataSize: 51257 58SYMBOLS: SYMBOL TABLE:59SYMBOLS-NEXT: main60SYMBOLS-NEXT: debug_discardable_sym61SYMBOLS-NEXT: debug_undiscardable_sym62SYMBOLS-EMPTY:63