155c81d42SFangrui SongRUN: yaml2obj %p/Inputs/only-keep-sections.yaml -o %t.in.exe 21868d88bSMartin Storsjo 31868d88bSMartin StorsjoRUN: llvm-objcopy --only-keep-debug %t.in.exe %t.out.exe 41868d88bSMartin StorsjoRUN: llvm-readobj --sections %t.out.exe | FileCheck %s --check-prefix=SECTIONS 51868d88bSMartin StorsjoRUN: llvm-objdump -t %t.out.exe | FileCheck %s --check-prefix=SYMBOLS 6*3787de40SJohn McIver 7*3787de40SJohn McIver## --only-keep-debug suppresses the default --strip-all. 8*3787de40SJohn McIverRUN: llvm-strip --only-keep-debug %t.in.exe -o %t-strip.out.exe 912ed01dcSJordan RupprechtRUN: cmp %t.out.exe %t-strip.out.exe 101868d88bSMartin Storsjo 111868d88bSMartin StorsjoCheck that all non-debug/buildid sections with IMAGE_SCN_CNT_CODE 121868d88bSMartin Storsjoor IMAGE_SCN_CNT_INITIALIZED_DATA are truncated, and no others. 131868d88bSMartin Storsjo 141868d88bSMartin StorsjoSECTIONS: Sections [ 151868d88bSMartin StorsjoSECTIONS-NEXT: Section { 161868d88bSMartin StorsjoSECTIONS-NEXT: Number: 1 171868d88bSMartin StorsjoSECTIONS-NEXT: Name: .text 181868d88bSMartin StorsjoSECTIONS-NEXT: VirtualSize: 0x4 191868d88bSMartin StorsjoSECTIONS-NEXT: VirtualAddress: 201868d88bSMartin StorsjoSECTIONS-NEXT: RawDataSize: 0 211868d88bSMartin StorsjoSECTIONS: Section { 221868d88bSMartin StorsjoSECTIONS-NEXT: Number: 2 231868d88bSMartin StorsjoSECTIONS-NEXT: Name: .rdata 241868d88bSMartin StorsjoSECTIONS-NEXT: VirtualSize: 0x4 251868d88bSMartin StorsjoSECTIONS-NEXT: VirtualAddress: 261868d88bSMartin StorsjoSECTIONS-NEXT: RawDataSize: 0 271868d88bSMartin StorsjoSECTIONS: Section { 281868d88bSMartin StorsjoSECTIONS-NEXT: Number: 3 291868d88bSMartin StorsjoSECTIONS-NEXT: Name: .buildid 301868d88bSMartin StorsjoSECTIONS-NEXT: VirtualSize: 0x4 311868d88bSMartin StorsjoSECTIONS-NEXT: VirtualAddress: 321868d88bSMartin StorsjoSECTIONS-NEXT: RawDataSize: 512 331868d88bSMartin StorsjoSECTIONS: Section { 341868d88bSMartin StorsjoSECTIONS-NEXT: Number: 4 351868d88bSMartin StorsjoSECTIONS-NEXT: Name: .reloc 361868d88bSMartin StorsjoSECTIONS-NEXT: VirtualSize: 0x4 371868d88bSMartin StorsjoSECTIONS-NEXT: VirtualAddress: 381868d88bSMartin StorsjoSECTIONS-NEXT: RawDataSize: 0 391868d88bSMartin StorsjoSECTIONS: Section { 401868d88bSMartin StorsjoSECTIONS-NEXT: Number: 5 411868d88bSMartin StorsjoSECTIONS-NEXT: Name: .debug_discardable 421868d88bSMartin StorsjoSECTIONS-NEXT: VirtualSize: 0x4 431868d88bSMartin StorsjoSECTIONS-NEXT: VirtualAddress: 441868d88bSMartin StorsjoSECTIONS-NEXT: RawDataSize: 512 451868d88bSMartin StorsjoSECTIONS: Section { 461868d88bSMartin StorsjoSECTIONS-NEXT: Number: 6 471868d88bSMartin StorsjoSECTIONS-NEXT: Name: .debug_undiscardable 481868d88bSMartin StorsjoSECTIONS-NEXT: VirtualSize: 0x4 491868d88bSMartin StorsjoSECTIONS-NEXT: VirtualAddress: 501868d88bSMartin StorsjoSECTIONS-NEXT: RawDataSize: 512 511868d88bSMartin StorsjoSECTIONS: Section { 521868d88bSMartin StorsjoSECTIONS-NEXT: Number: 7 531868d88bSMartin StorsjoSECTIONS-NEXT: Name: .unflagged 541868d88bSMartin StorsjoSECTIONS-NEXT: VirtualSize: 0x4 551868d88bSMartin StorsjoSECTIONS-NEXT: VirtualAddress: 561868d88bSMartin StorsjoSECTIONS-NEXT: RawDataSize: 512 571868d88bSMartin Storsjo 581868d88bSMartin StorsjoSYMBOLS: SYMBOL TABLE: 591868d88bSMartin StorsjoSYMBOLS-NEXT: main 601868d88bSMartin StorsjoSYMBOLS-NEXT: debug_discardable_sym 611868d88bSMartin StorsjoSYMBOLS-NEXT: debug_undiscardable_sym 621868d88bSMartin StorsjoSYMBOLS-EMPTY: 63