1# RUN: yaml2obj %s -o %t.obj 2# 3# RUN: lld-link -safeseh:no /out:%t.dll /dll %t.obj /export:exportfn1 /export:exportfn2 4# RUN: llvm-objdump -p %t.dll | FileCheck --check-prefix=CHECK1 %s 5# 6# RUN: lld-link -safeseh:no /out:%t.dll /dll %t.obj /export:exportfn1 /export:exportfn2 /merge:.edata=.rdata 7# RUN: llvm-objdump -p %t.dll | FileCheck --check-prefix=CHECK1 %s 8# RUN: llvm-readobj --file-headers --sections %t.dll | FileCheck -check-prefix=HEADER-MERGE %s 9 10# CHECK1: Export Table: 11# CHECK1: DLL name: export32.test.tmp.dll 12# CHECK1: Ordinal RVA Name 13# CHECK1-NEXT: 0 0 14# CHECK1-NEXT: 1 0x1008 exportfn1 15# CHECK1-NEXT: 2 0x1010 exportfn2 16 17# HEADER-MERGE: ExportTableRVA: 0x2000 18# HEADER-MERGE-NEXT: ExportTableSize: 0x7E 19# HEADER-MERGE: Name: .rdata 20# HEADER-MERGE-NEXT: VirtualSize: 0x7E 21# HEADER-MERGE-NEXT: VirtualAddress: 0x2000 22 23# RUN: lld-link -safeseh:no /out:%t.dll /dll %t.obj /export:exportfn1,@5 \ 24# RUN: /export:exportfn2 /export:mangled 25# RUN: llvm-objdump -p %t.dll | FileCheck --check-prefix=CHECK2 %s 26 27# CHECK2: Export Table: 28# CHECK2: DLL name: export32.test.tmp.dll 29# CHECK2: Ordinal RVA Name 30# CHECK2-NEXT: 0 0 31# CHECK2-NEXT: 1 0 32# CHECK2-NEXT: 2 0 33# CHECK2-NEXT: 3 0 34# CHECK2-NEXT: 4 0 35# CHECK2-NEXT: 5 0x1008 exportfn1 36# CHECK2-NEXT: 6 0x1010 exportfn2 37# CHECK2-NEXT: 7 0x1010 exportfn3 38# CHECK2-NEXT: 8 0x1010 mangled 39 40# RUN: lld-link -safeseh:no /out:%t.dll /dll %t.obj /export:exportfn1,@5,noname /export:exportfn2 41# RUN: llvm-objdump -p %t.dll | FileCheck --check-prefix=CHECK3 %s 42 43# CHECK3: Export Table: 44# CHECK3: DLL name: export32.test.tmp.dll 45# CHECK3: Ordinal RVA Name 46# CHECK3-NEXT: 0 0 47# CHECK3-NEXT: 1 0 48# CHECK3-NEXT: 2 0 49# CHECK3-NEXT: 3 0 50# CHECK3-NEXT: 4 0 51# CHECK3-NEXT: 5 0x1008 52# CHECK3-NEXT: 6 0x1010 exportfn2 53 54# RUN: lld-link -safeseh:no /out:%t.dll /dll %t.obj /export:f1=exportfn1 /export:f2=exportfn2 55# RUN: llvm-objdump -p %t.dll | FileCheck --check-prefix=CHECK4 %s 56 57# CHECK4: Export Table: 58# CHECK4: DLL name: export32.test.tmp.dll 59# CHECK4: Ordinal RVA Name 60# CHECK4-NEXT: 0 0 61# CHECK4-NEXT: 1 0x1010 exportfn3 62# CHECK4-NEXT: 2 0x1008 f1 63# CHECK4-NEXT: 3 0x1010 f2 64 65# RUN: echo "EXPORTS exportfn1 @3" > %t.def 66# RUN: echo "fn2=exportfn2 @2" >> %t.def 67# RUN: lld-link -safeseh:no /out:%t.dll /dll %t.obj /def:%t.def 68# RUN: llvm-objdump -p %t.dll | FileCheck --check-prefix=CHECK5 %s 69 70# RUN: echo "EXPORTS exportfn1 @ 3" > %t.def 71# RUN: echo "fn2=exportfn2 @ 2" >> %t.def 72# RUN: lld-link -safeseh:no /out:%t.dll /dll %t.obj /def:%t.def 73# RUN: llvm-objdump -p %t.dll | FileCheck --check-prefix=CHECK5 %s 74 75# CHECK5: Export Table: 76# CHECK5: DLL name: export32.test.tmp.dll 77# CHECK5: Ordinal RVA Name 78# CHECK5-NEXT: 0 0 79# CHECK5-NEXT: 1 0 80# CHECK5-NEXT: 2 0x1010 fn2 81# CHECK5-NEXT: 3 0x1008 exportfn1 82# CHECK5-NEXT: 4 0x1010 exportfn3 83 84# RUN: lld-link -safeseh:no /out:%t.dll /dll %t.obj /export:exportfn1 /export:exportfn2 \ 85# RUN: /export:exportfn1 /export:exportfn2,@5 >& %t.log 86# RUN: FileCheck -check-prefix=CHECK6 %s < %t.log 87 88# CHECK6: duplicate /export option: _exportfn2 89# CHECK6-NOT: duplicate /export option: _exportfn1 90 91# RUN: lld-link -safeseh:no /out:%t.dll /dll %t.obj /export:foo=mangled 92# RUN: llvm-objdump -p %t.dll | FileCheck --check-prefix=CHECK7 %s 93 94# CHECK7: Export Table: 95# CHECK7: DLL name: export32.test.tmp.dll 96# CHECK7: Ordinal RVA Name 97# CHECK7-NEXT: 0 0 98# CHECK7-NEXT: 1 0 99# CHECK7-NEXT: 2 0x1010 foo 100 101--- !COFF 102header: 103 Machine: IMAGE_FILE_MACHINE_I386 104 Characteristics: [] 105sections: 106 - Name: .text 107 Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ] 108 Alignment: 4 109 SectionData: B800000000506800000000680000000050E80000000050E800000000 110 - Name: .drectve 111 Characteristics: [ IMAGE_SCN_LNK_INFO, IMAGE_SCN_LNK_REMOVE ] 112 Alignment: 1 113 SectionData: 2f6578706f72743a5f6578706f7274666e3300 # /export:_exportfn3 114symbols: 115 - Name: .text 116 Value: 0 117 SectionNumber: 1 118 SimpleType: IMAGE_SYM_TYPE_NULL 119 ComplexType: IMAGE_SYM_DTYPE_NULL 120 StorageClass: IMAGE_SYM_CLASS_STATIC 121 SectionDefinition: 122 Length: 28 123 NumberOfRelocations: 4 124 NumberOfLinenumbers: 0 125 CheckSum: 0 126 Number: 0 127 - Name: __DllMainCRTStartup@12 128 Value: 0 129 SectionNumber: 1 130 SimpleType: IMAGE_SYM_TYPE_NULL 131 ComplexType: IMAGE_SYM_DTYPE_NULL 132 StorageClass: IMAGE_SYM_CLASS_EXTERNAL 133 - Name: _exportfn1 134 Value: 8 135 SectionNumber: 1 136 SimpleType: IMAGE_SYM_TYPE_NULL 137 ComplexType: IMAGE_SYM_DTYPE_NULL 138 StorageClass: IMAGE_SYM_CLASS_EXTERNAL 139 - Name: _exportfn2@4 140 Value: 16 141 SectionNumber: 1 142 SimpleType: IMAGE_SYM_TYPE_NULL 143 ComplexType: IMAGE_SYM_DTYPE_NULL 144 StorageClass: IMAGE_SYM_CLASS_EXTERNAL 145 - Name: _exportfn3 146 Value: 16 147 SectionNumber: 1 148 SimpleType: IMAGE_SYM_TYPE_NULL 149 ComplexType: IMAGE_SYM_DTYPE_NULL 150 StorageClass: IMAGE_SYM_CLASS_EXTERNAL 151 - Name: '?mangled@@YAHXZ' 152 Value: 16 153 SectionNumber: 1 154 SimpleType: IMAGE_SYM_TYPE_NULL 155 ComplexType: IMAGE_SYM_DTYPE_NULL 156 StorageClass: IMAGE_SYM_CLASS_EXTERNAL 157... 158