|
| 1 | +## Test that bogus associative section symbols in executables are ignored. |
| 2 | +## |
| 3 | +## The executable contains two (bogus) associative section symbols, both for |
| 4 | +## (parts of) the .rdata section; one pointing at the .debug_info section |
| 5 | +## (which will be stripped out) and one pointing at a nonexistent section. |
| 6 | +## |
| 7 | +## Check that stripping does succeed, and that it doesn't end up removing |
| 8 | +## the .rdata section. |
| 9 | + |
| 10 | +# RUN: yaml2obj %s -o %t.in.exe |
| 11 | + |
| 12 | +# RUN: llvm-strip --strip-debug %t.in.exe -o %t.out.exe |
| 13 | +# RUN: llvm-readobj --sections %t.out.exe | FileCheck %s |
| 14 | + |
| 15 | +# CHECK: Name: .rdata |
| 16 | + |
| 17 | +--- !COFF |
| 18 | +OptionalHeader: |
| 19 | + AddressOfEntryPoint: 4096 |
| 20 | + ImageBase: 5368709120 |
| 21 | + SectionAlignment: 4096 |
| 22 | + FileAlignment: 512 |
| 23 | + MajorOperatingSystemVersion: 4 |
| 24 | + MinorOperatingSystemVersion: 0 |
| 25 | + MajorImageVersion: 0 |
| 26 | + MinorImageVersion: 0 |
| 27 | + MajorSubsystemVersion: 5 |
| 28 | + MinorSubsystemVersion: 2 |
| 29 | + Subsystem: IMAGE_SUBSYSTEM_WINDOWS_CUI |
| 30 | + DLLCharacteristics: [ ] |
| 31 | + SizeOfStackReserve: 2097152 |
| 32 | + SizeOfStackCommit: 4096 |
| 33 | + SizeOfHeapReserve: 1048576 |
| 34 | + SizeOfHeapCommit: 4096 |
| 35 | +header: |
| 36 | + Machine: IMAGE_FILE_MACHINE_AMD64 |
| 37 | + Characteristics: [ ] |
| 38 | +sections: |
| 39 | + - Name: .text |
| 40 | + Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ] |
| 41 | + VirtualAddress: 4096 |
| 42 | + VirtualSize: 48 |
| 43 | + SectionData: E806000000E802000000C3C3C30F1F00FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000 |
| 44 | + SizeOfRawData: 512 |
| 45 | + - Name: .rdata |
| 46 | + Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ] |
| 47 | + VirtualAddress: 8192 |
| 48 | + VirtualSize: 4 |
| 49 | + SectionData: '00000000' |
| 50 | + SizeOfRawData: 512 |
| 51 | + - Name: .debug_info |
| 52 | + Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ] |
| 53 | + VirtualAddress: 16384 |
| 54 | + VirtualSize: 4 |
| 55 | + SectionData: '00000000' |
| 56 | + SizeOfRawData: 512 |
| 57 | +symbols: |
| 58 | + - Name: .text |
| 59 | + Value: 0 |
| 60 | + SectionNumber: 1 |
| 61 | + SimpleType: IMAGE_SYM_TYPE_NULL |
| 62 | + ComplexType: IMAGE_SYM_DTYPE_NULL |
| 63 | + StorageClass: IMAGE_SYM_CLASS_STATIC |
| 64 | + SectionDefinition: |
| 65 | + Length: 11 |
| 66 | + NumberOfRelocations: 2 |
| 67 | + NumberOfLinenumbers: 0 |
| 68 | + CheckSum: 1703692295 |
| 69 | + Number: 1 |
| 70 | + - Name: '.text$func1' |
| 71 | + Value: 11 |
| 72 | + SectionNumber: 1 |
| 73 | + SimpleType: IMAGE_SYM_TYPE_NULL |
| 74 | + ComplexType: IMAGE_SYM_DTYPE_NULL |
| 75 | + StorageClass: IMAGE_SYM_CLASS_STATIC |
| 76 | + SectionDefinition: |
| 77 | + Length: 1 |
| 78 | + NumberOfRelocations: 0 |
| 79 | + NumberOfLinenumbers: 0 |
| 80 | + CheckSum: 40735498 |
| 81 | + Number: 3 |
| 82 | + Selection: IMAGE_COMDAT_SELECT_ANY |
| 83 | + - Name: .rdata |
| 84 | + Value: 0 |
| 85 | + SectionNumber: 2 |
| 86 | + SimpleType: IMAGE_SYM_TYPE_NULL |
| 87 | + ComplexType: IMAGE_SYM_DTYPE_NULL |
| 88 | + StorageClass: IMAGE_SYM_CLASS_STATIC |
| 89 | + SectionDefinition: |
| 90 | + Length: 1 |
| 91 | + NumberOfRelocations: 0 |
| 92 | + NumberOfLinenumbers: 0 |
| 93 | + CheckSum: 0 |
| 94 | + Number: 3 |
| 95 | + Selection: IMAGE_COMDAT_SELECT_ASSOCIATIVE |
| 96 | + - Name: '.text$func2' |
| 97 | + Value: 12 |
| 98 | + SectionNumber: 1 |
| 99 | + SimpleType: IMAGE_SYM_TYPE_NULL |
| 100 | + ComplexType: IMAGE_SYM_DTYPE_NULL |
| 101 | + StorageClass: IMAGE_SYM_CLASS_STATIC |
| 102 | + SectionDefinition: |
| 103 | + Length: 1 |
| 104 | + NumberOfRelocations: 0 |
| 105 | + NumberOfLinenumbers: 0 |
| 106 | + CheckSum: 40735498 |
| 107 | + Number: 4 |
| 108 | + Selection: IMAGE_COMDAT_SELECT_ANY |
| 109 | + - Name: .rdata |
| 110 | + Value: 1 |
| 111 | + SectionNumber: 2 |
| 112 | + SimpleType: IMAGE_SYM_TYPE_NULL |
| 113 | + ComplexType: IMAGE_SYM_DTYPE_NULL |
| 114 | + StorageClass: IMAGE_SYM_CLASS_STATIC |
| 115 | + SectionDefinition: |
| 116 | + Length: 1 |
| 117 | + NumberOfRelocations: 0 |
| 118 | + NumberOfLinenumbers: 0 |
| 119 | + CheckSum: 0 |
| 120 | + Number: 4 |
| 121 | + Selection: IMAGE_COMDAT_SELECT_ASSOCIATIVE |
| 122 | + - Name: .debug_info |
| 123 | + Value: 0 |
| 124 | + SectionNumber: 3 |
| 125 | + SimpleType: IMAGE_SYM_TYPE_NULL |
| 126 | + ComplexType: IMAGE_SYM_DTYPE_NULL |
| 127 | + StorageClass: IMAGE_SYM_CLASS_STATIC |
| 128 | + SectionDefinition: |
| 129 | + Length: 4 |
| 130 | + NumberOfRelocations: 0 |
| 131 | + NumberOfLinenumbers: 0 |
| 132 | + CheckSum: 0 |
| 133 | + Number: 0 |
| 134 | +... |
0 commit comments