From 308915ade233f7edbad7edec70fe61b1bc98564c Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Wed, 29 Jul 2015 19:17:15 +0000 Subject: [PATCH] COFF: Fix seh.test. seh.test was testing -flavor link. This should have been testing -flavor link2. llvm-svn: 243557 --- lld/test/COFF/Inputs/seh.c | 13 -- lld/test/COFF/Inputs/seh.obj.yaml | 387 -------------------------------------- lld/test/COFF/seh.test | 92 ++++++--- 3 files changed, 69 insertions(+), 423 deletions(-) delete mode 100644 lld/test/COFF/Inputs/seh.c delete mode 100644 lld/test/COFF/Inputs/seh.obj.yaml diff --git a/lld/test/COFF/Inputs/seh.c b/lld/test/COFF/Inputs/seh.c deleted file mode 100644 index b1c139a..0000000 --- a/lld/test/COFF/Inputs/seh.c +++ /dev/null @@ -1,13 +0,0 @@ -__declspec(noinline) void triggerSEH() { - volatile int *p = 0; - *p = 1; -} - -int main() { - __try { - triggerSEH(); - } __except(1) { - return 42; - } - return 0; -} diff --git a/lld/test/COFF/Inputs/seh.obj.yaml b/lld/test/COFF/Inputs/seh.obj.yaml deleted file mode 100644 index 6767671..0000000 --- a/lld/test/COFF/Inputs/seh.obj.yaml +++ /dev/null @@ -1,387 +0,0 @@ ---- -header: - Machine: IMAGE_FILE_MACHINE_I386 - Characteristics: [ ] -sections: - - Name: .drectve - Characteristics: [ IMAGE_SCN_LNK_INFO, IMAGE_SCN_LNK_REMOVE ] - Alignment: 1 - SectionData: 2020202F44454641554C544C49423A22757569642E6C696222202F44454641554C544C49423A22757569642E6C696222202F4641494C49464D49534D415443483A225F4D53435F5645523D3138303022202F4641494C49464D49534D415443483A225F4954455241544F525F44454255475F4C4556454C3D3022202F4641494C49464D49534D415443483A2252756E74696D654C6962726172793D4D445F44796E616D696352656C6561736522202F44454641554C544C49423A226D73766370727422202F44454641554C544C49423A224D535643525422202F44454641554C544C49423A224F4C444E414D45532220 - - Name: '.debug$S' - Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ] - Alignment: 1 - SectionData: 04000000F1000000600000002200011100000000433A5C63796777696E5C686F6D655C727569755C7365682E6F626A003A003C11012200000700120000000D520100120000000D5201004D6963726F736F667420285229204F7074696D697A696E6720436F6D70696C657200 - - Name: .rdata - Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_READ ] - Alignment: 1 - SectionData: 00 - - Name: .rdata - Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_READ ] - Alignment: 1 - SectionData: 01 - - Name: .rdata - Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ] - Alignment: 4 - SectionData: 54726967676572696E672053454820657863657074696F6E0D0A0000457865637574696E6720534548205F5F65786365707420626C6F636B20696E20666F6F0D0A000000457865637574696E6720534548205F5F65786365707420626C6F636B0D0A00 - - Name: '.text$mn' - Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ] - Alignment: 16 - SectionData: 558BEC516800000000FF150000000083C404C745FC000000008B45FCC700140000008BE55DC3CCCCCCCCCCCCCCCCCCCC558BEC51E8000000008D4DFFE8000000008BE55DC3CCCCCCCCCCCCCCCCCCCCCC558BEC6AFE6800000000680000000064A1000000005083EC08535657A1000000003145F833C5508D45F064A3000000008965E8C745FC00000000E800000000C745FCFEFFFFFFEB1EB801000000C38B65E86800000000FF150000000083C404C745FCFEFFFFFF8B4DF064890D00000000595F5E5B8BE55DC3CCCCCCCCCCCCCCCC558BEC6AFE6800000000680000000064A1000000005083EC08535657A1000000003145F833C5508D45F064A3000000008965E8C745FC00000000E800000000E800000000C745FCFEFFFFFFEB1EB801000000C38B65E86800000000FF150000000083C404C745FCFEFFFFFF33C08B4DF064890D00000000595F5E5B8BE55DC3 - Relocations: - - VirtualAddress: 5 - SymbolName: '$SG73531' - Type: IMAGE_REL_I386_DIR32 - - VirtualAddress: 11 - SymbolName: __imp__printf - Type: IMAGE_REL_I386_DIR32 - - VirtualAddress: 53 - SymbolName: '?TestCPPEX@@YAXXZ' - Type: IMAGE_REL_I386_REL32 - - VirtualAddress: 61 - SymbolName: '??1TestClass@@QAE@XZ' - Type: IMAGE_REL_I386_REL32 - - VirtualAddress: 86 - SymbolName: '__sehtable$?foo@@YAXXZ' - Type: IMAGE_REL_I386_DIR32 - - VirtualAddress: 91 - SymbolName: __except_handler4 - Type: IMAGE_REL_I386_DIR32 - - VirtualAddress: 109 - SymbolName: ___security_cookie - Type: IMAGE_REL_I386_DIR32 - - VirtualAddress: 139 - SymbolName: '?TestExceptions@@YAXXZ' - Type: IMAGE_REL_I386_REL32 - - VirtualAddress: 162 - SymbolName: '$SG73539' - Type: IMAGE_REL_I386_DIR32 - - VirtualAddress: 168 - SymbolName: __imp__printf - Type: IMAGE_REL_I386_DIR32 - - VirtualAddress: 214 - SymbolName: '__sehtable$_main' - Type: IMAGE_REL_I386_DIR32 - - VirtualAddress: 219 - SymbolName: __except_handler4 - Type: IMAGE_REL_I386_DIR32 - - VirtualAddress: 237 - SymbolName: ___security_cookie - Type: IMAGE_REL_I386_DIR32 - - VirtualAddress: 267 - SymbolName: '?foo@@YAXXZ' - Type: IMAGE_REL_I386_REL32 - - VirtualAddress: 272 - SymbolName: '?TestExceptions@@YAXXZ' - Type: IMAGE_REL_I386_REL32 - - VirtualAddress: 295 - SymbolName: '$SG73543' - Type: IMAGE_REL_I386_DIR32 - - VirtualAddress: 301 - SymbolName: __imp__printf - Type: IMAGE_REL_I386_DIR32 - - Name: '.text$mn' - Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ] - Alignment: 16 - SectionData: 558BEC51894DFC6800000000FF150000000083C4048BE55DC3 - Relocations: - - VirtualAddress: 8 - SymbolName: '??_C@_0BI@BBHGNMOG@Destroying?5TestClass?$CB?$AN?6?$AA@' - Type: IMAGE_REL_I386_DIR32 - - VirtualAddress: 14 - SymbolName: __imp__printf - Type: IMAGE_REL_I386_DIR32 - - Name: '.xdata$x' - Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ] - Alignment: 8 - SectionData: FEFFFFFF00000000D8FFFFFF00000000FEFFFFFF000000000000000000000000FEFFFFFF00000000D8FFFFFF00000000FEFFFFFF0000000000000000 - Relocations: - - VirtualAddress: 20 - SymbolName: '$LN5' - Type: IMAGE_REL_I386_DIR32 - - VirtualAddress: 24 - SymbolName: '$LN6' - Type: IMAGE_REL_I386_DIR32 - - VirtualAddress: 52 - SymbolName: '$LN5' - Type: IMAGE_REL_I386_DIR32 - - VirtualAddress: 56 - SymbolName: '$LN6' - Type: IMAGE_REL_I386_DIR32 - - Name: .rdata - Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_READ ] - Alignment: 4 - SectionData: 44657374726F79696E672054657374436C617373210D0A00 - - Name: .sxdata - Characteristics: [ IMAGE_SCN_LNK_INFO ] - Alignment: 4 - SectionData: 1B0000001A000000 -symbols: - - Name: '@comp.id' - Value: 14766605 - SectionNumber: 65535 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_NULL - StorageClass: IMAGE_SYM_CLASS_STATIC - - Name: '@feat.00' - Value: 2147484049 - SectionNumber: 65535 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_NULL - StorageClass: IMAGE_SYM_CLASS_STATIC - - Name: .drectve - Value: 0 - SectionNumber: 1 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_NULL - StorageClass: IMAGE_SYM_CLASS_STATIC - SectionDefinition: - Length: 240 - NumberOfRelocations: 0 - NumberOfLinenumbers: 0 - CheckSum: 0 - Number: 0 - - Name: '.debug$S' - Value: 0 - SectionNumber: 2 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_NULL - StorageClass: IMAGE_SYM_CLASS_STATIC - SectionDefinition: - Length: 108 - NumberOfRelocations: 0 - NumberOfLinenumbers: 0 - CheckSum: 0 - Number: 0 - - Name: .rdata - Value: 0 - SectionNumber: 3 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_NULL - StorageClass: IMAGE_SYM_CLASS_STATIC - SectionDefinition: - Length: 1 - NumberOfRelocations: 0 - NumberOfLinenumbers: 0 - CheckSum: 0 - Number: 0 - Selection: IMAGE_COMDAT_SELECT_ANY - - Name: '?value@?$integral_constant@_N$0A@@std@@2_NB' - Value: 0 - SectionNumber: 3 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_NULL - StorageClass: IMAGE_SYM_CLASS_EXTERNAL - - Name: .rdata - Value: 0 - SectionNumber: 4 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_NULL - StorageClass: IMAGE_SYM_CLASS_STATIC - SectionDefinition: - Length: 1 - NumberOfRelocations: 0 - NumberOfLinenumbers: 0 - CheckSum: 1996959894 - Number: 0 - Selection: IMAGE_COMDAT_SELECT_ANY - - Name: '?value@?$integral_constant@_N$00@std@@2_NB' - Value: 0 - SectionNumber: 4 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_NULL - StorageClass: IMAGE_SYM_CLASS_EXTERNAL - - Name: .rdata - Value: 0 - SectionNumber: 5 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_NULL - StorageClass: IMAGE_SYM_CLASS_STATIC - SectionDefinition: - Length: 99 - NumberOfRelocations: 0 - NumberOfLinenumbers: 0 - CheckSum: 2801625422 - Number: 0 - - Name: '$SG73531' - Value: 0 - SectionNumber: 5 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_NULL - StorageClass: IMAGE_SYM_CLASS_STATIC - - Name: '$SG73539' - Value: 28 - SectionNumber: 5 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_NULL - StorageClass: IMAGE_SYM_CLASS_STATIC - - Name: '$SG73543' - Value: 68 - SectionNumber: 5 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_NULL - StorageClass: IMAGE_SYM_CLASS_STATIC - - Name: '.text$mn' - Value: 0 - SectionNumber: 6 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_NULL - StorageClass: IMAGE_SYM_CLASS_STATIC - SectionDefinition: - Length: 335 - NumberOfRelocations: 17 - NumberOfLinenumbers: 0 - CheckSum: 2488225337 - Number: 0 - - Name: '.text$mn' - Value: 0 - SectionNumber: 7 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_NULL - StorageClass: IMAGE_SYM_CLASS_STATIC - SectionDefinition: - Length: 25 - NumberOfRelocations: 2 - NumberOfLinenumbers: 0 - CheckSum: 210566957 - Number: 0 - Selection: IMAGE_COMDAT_SELECT_ANY - - Name: __imp__printf - Value: 0 - SectionNumber: 0 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_NULL - StorageClass: IMAGE_SYM_CLASS_EXTERNAL - - Name: '??1TestClass@@QAE@XZ' - Value: 0 - SectionNumber: 7 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_FUNCTION - StorageClass: IMAGE_SYM_CLASS_EXTERNAL - - Name: '?TestCPPEX@@YAXXZ' - Value: 0 - SectionNumber: 6 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_FUNCTION - StorageClass: IMAGE_SYM_CLASS_EXTERNAL - - Name: '?TestExceptions@@YAXXZ' - Value: 48 - SectionNumber: 6 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_FUNCTION - StorageClass: IMAGE_SYM_CLASS_EXTERNAL - - Name: '?foo@@YAXXZ' - Value: 80 - SectionNumber: 6 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_FUNCTION - StorageClass: IMAGE_SYM_CLASS_EXTERNAL - - Name: _main - Value: 208 - SectionNumber: 6 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_FUNCTION - StorageClass: IMAGE_SYM_CLASS_EXTERNAL - - Name: __except_handler4 - Value: 0 - SectionNumber: 0 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_FUNCTION - StorageClass: IMAGE_SYM_CLASS_EXTERNAL - - Name: '$LN5' - Value: 152 - SectionNumber: 6 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_NULL - StorageClass: IMAGE_SYM_CLASS_LABEL - - Name: '$LN7' - Value: 157 - SectionNumber: 6 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_NULL - StorageClass: IMAGE_SYM_CLASS_LABEL - - Name: '$LN6' - Value: 158 - SectionNumber: 6 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_NULL - StorageClass: IMAGE_SYM_CLASS_LABEL - - Name: '$LN5' - Value: 285 - SectionNumber: 6 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_NULL - StorageClass: IMAGE_SYM_CLASS_LABEL - - Name: '$LN7' - Value: 290 - SectionNumber: 6 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_NULL - StorageClass: IMAGE_SYM_CLASS_LABEL - - Name: '$LN6' - Value: 291 - SectionNumber: 6 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_NULL - StorageClass: IMAGE_SYM_CLASS_LABEL - - Name: '.xdata$x' - Value: 0 - SectionNumber: 8 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_NULL - StorageClass: IMAGE_SYM_CLASS_STATIC - SectionDefinition: - Length: 60 - NumberOfRelocations: 4 - NumberOfLinenumbers: 0 - CheckSum: 2900129504 - Number: 0 - - Name: '__sehtable$?foo@@YAXXZ' - Value: 32 - SectionNumber: 8 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_NULL - StorageClass: IMAGE_SYM_CLASS_STATIC - - Name: '__sehtable$_main' - Value: 0 - SectionNumber: 8 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_NULL - StorageClass: IMAGE_SYM_CLASS_STATIC - - Name: .rdata - Value: 0 - SectionNumber: 9 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_NULL - StorageClass: IMAGE_SYM_CLASS_STATIC - SectionDefinition: - Length: 24 - NumberOfRelocations: 0 - NumberOfLinenumbers: 0 - CheckSum: 1296623929 - Number: 0 - Selection: IMAGE_COMDAT_SELECT_ANY - - Name: '??_C@_0BI@BBHGNMOG@Destroying?5TestClass?$CB?$AN?6?$AA@' - Value: 0 - SectionNumber: 9 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_NULL - StorageClass: IMAGE_SYM_CLASS_EXTERNAL - - Name: ___security_cookie - Value: 0 - SectionNumber: 0 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_NULL - StorageClass: IMAGE_SYM_CLASS_EXTERNAL - - Name: .sxdata - Value: 0 - SectionNumber: 10 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_NULL - StorageClass: IMAGE_SYM_CLASS_STATIC - SectionDefinition: - Length: 4 - NumberOfRelocations: 0 - NumberOfLinenumbers: 0 - CheckSum: 0 - Number: 0 -... diff --git a/lld/test/COFF/seh.test b/lld/test/COFF/seh.test index 2082aad..3a9b8af 100644 --- a/lld/test/COFF/seh.test +++ b/lld/test/COFF/seh.test @@ -1,24 +1,70 @@ -# RUN: yaml2obj %p/Inputs/seh.obj.yaml > %t.obj -# -# RUN: lld -flavor link /out:%t.exe /subsystem:console /force /nodefaultlib %t.obj -# RUN: llvm-objdump -private-headers %t.exe | FileCheck %s +# RUN: yaml2obj < %s > %t.obj +# RUN: lld -flavor link2 /out:%t.exe /subsystem:console /entry:main %t.obj +# RUN: llvm-objdump -s %t.exe | FileCheck %s -CHECK: Load configuration: -CHECK: Timestamp: 0 -CHECK: Major Version: 0 -CHECK: Minor Version: 0 -CHECK: GlobalFlags Clear: 0 -CHECK: GlobalFlags Set: 0 -CHECK: Critical Section Default Timeout: 0 -CHECK: Decommit Free Block Threshold: 0 -CHECK: Decommit Total Free Threshold: 0 -CHECK: Lock Prefix Table: 0 -CHECK: Maximum Allocation Size: 0 -CHECK: Virtual Memory Threshold: 0 -CHECK: Process Affinity Mask: 0 -CHECK: Process Heap Flags: 0 -CHECK: CSD Version: 0 -CHECK: Security Cookie: 0 -CHECK: SEH Table: 4206592 -CHECK: SEH Count: 2 -CHECK: SEH Table: 0x80001b 0x8040ea +# CHECK: Contents of section .rdata: +# CHECK: 2000 00100000 02100000 + +--- +header: + Machine: IMAGE_FILE_MACHINE_I386 + Characteristics: [ ] +sections: + - Name: .text + Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ] + Alignment: 1 + SectionData: 0000000000000000 + - Name: .sxdata + Characteristics: [ IMAGE_SCN_LNK_INFO ] + Alignment: 4 + SectionData: 0600000007000000 +symbols: + - Name: '@comp.id' + Value: 14766605 + SectionNumber: 65535 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + - Name: '@feat.00' + Value: 2147484049 + SectionNumber: 65535 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + - Name: .text + Value: 0 + SectionNumber: 1 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 8 + NumberOfRelocations: 0 + NumberOfLinenumbers: 0 + CheckSum: 0 + Number: 0 + - Name: .sxdata + Value: 0 + SectionNumber: 2 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 8 + NumberOfRelocations: 0 + NumberOfLinenumbers: 0 + CheckSum: 0 + Number: 0 + - Name: _main + Value: 0 + SectionNumber: 1 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_FUNCTION + StorageClass: IMAGE_SYM_CLASS_EXTERNAL + - Name: _foo + Value: 2 + SectionNumber: 1 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_FUNCTION + StorageClass: IMAGE_SYM_CLASS_EXTERNAL +... -- 2.7.4