brintos

brintos / llvm-project-archived public Read only

0
0
Text · 12.5 KiB · c83db2a Raw
310 lines · plain
1REQUIRES: aarch64, x862RUN: split-file %s %t.dir && cd %t.dir3 4RUN: llvm-mc -filetype=obj -triple=arm64ec-windows arm64ec-func.s -o arm64ec-func.obj5RUN: llvm-mc -filetype=obj -triple=aarch64-windows arm64-func.s -o arm64-func.obj6RUN: llvm-mc -filetype=obj -triple=arm64ec-windows func-drectve.s -o arm64ec-drectve.obj7RUN: llvm-mc -filetype=obj -triple=aarch64-windows func-drectve.s -o arm64-drectve.obj8RUN: llvm-mc -filetype=obj -triple=aarch64-windows edata.s -o arm64-edata.obj9RUN: llvm-mc -filetype=obj -triple=arm64ec-windows edata.s -o arm64ec-edata.obj10RUN: llvm-mc -filetype=obj -triple=arm64ec-windows %S/Inputs/loadconfig-arm64ec.s -o loadconfig-arm64ec.obj11RUN: llvm-mc -filetype=obj -triple=aarch64-windows %S/Inputs/loadconfig-arm64.s -o loadconfig-arm64.obj12 13 14# A command-line export applies only to EC exports.15 16RUN: lld-link -machine:arm64x -dll -out:out-cmd.dll arm64ec-func.obj arm64-func.obj \17RUN:          loadconfig-arm64.obj loadconfig-arm64ec.obj -noentry -export:func -output-def:out.def18 19RUN: llvm-objdump -d out-cmd.dll | FileCheck --check-prefix=DISASM-EC %s20DISASM-EC:      Disassembly of section .text:21DISASM-EC-EMPTY:22DISASM-EC-NEXT: 0000000180001000 <.text>:23DISASM-EC-NEXT: 180001000: 52800040     mov     w0, #0x2                // =224DISASM-EC-NEXT: 180001004: d65f03c0     ret25DISASM-EC-EMPTY:26DISASM-EC-NEXT: Disassembly of section .hexpthk:27DISASM-EC-EMPTY:28DISASM-EC-NEXT: 0000000180002000 <.hexpthk>:29DISASM-EC-NEXT: 180002000: 48 8b c4                     movq    %rsp, %rax30DISASM-EC-NEXT: 180002003: 48 89 58 20                  movq    %rbx, 0x20(%rax)31DISASM-EC-NEXT: 180002007: 55                           pushq   %rbp32DISASM-EC-NEXT: 180002008: 5d                           popq    %rbp33DISASM-EC-NEXT: 180002009: e9 f2 ef ff ff               jmp     0x180001000 <.text>34DISASM-EC-NEXT: 18000200e: cc                           int335DISASM-EC-NEXT: 18000200f: cc                           int336 37RUN: llvm-readobj --headers --coff-exports out-cmd.dll | FileCheck --check-prefix=EXPORTS-EC %s38EXPORTS-EC:      ExportTableRVA: 0x039EXPORTS-EC-NEXT: ExportTableSize: 0x040EXPORTS-EC-NOT:  Name: func41EXPORTS-EC:      HybridObject {42EXPORTS-EC:        ExportTableRVA: 0x3{{.*}}43EXPORTS-EC-NEXT:   ExportTableSize: 0x4{{.*}}44EXPORTS-EC:        Export {45EXPORTS-EC-NEXT:     Ordinal: 146EXPORTS-EC-NEXT:     Name: func47EXPORTS-EC-NEXT:     RVA: 0x200048EXPORTS-EC-NEXT:   }49EXPORTS-EC-NEXT: }50 51RUN: llvm-readobj out-cmd.lib | FileCheck --check-prefixes=IMPLIB-HEADER,IMPLIB-EC %s52IMPLIB-HEADER:      File: out-{{.*}}.lib(out{{.*}}.dll)53IMPLIB-HEADER-NEXT: Format: COFF-ARM6454IMPLIB-HEADER-NEXT: Arch: aarch6455IMPLIB-HEADER-NEXT: AddressSize: 64bit56IMPLIB-HEADER-EMPTY:57IMPLIB-HEADER-NEXT: File: out-{{.*}}.lib(out{{.*}}.dll)58IMPLIB-HEADER-NEXT: Format: COFF-ARM6459IMPLIB-HEADER-NEXT: Arch: aarch6460IMPLIB-HEADER-NEXT: AddressSize: 64bit61IMPLIB-HEADER-EMPTY:62IMPLIB-HEADER-NEXT: File: out-{{.*}}.lib(out{{.*}}.dll)63IMPLIB-HEADER-NEXT: Format: COFF-ARM6464IMPLIB-HEADER-NEXT: Arch: aarch6465IMPLIB-HEADER-NEXT: AddressSize: 64bit66IMPLIB-HEADER-EMPTY:67IMPLIB-EC:      File: out{{.*}}.dll68IMPLIB-EC-NEXT: Format: COFF-import-file-ARM64EC69IMPLIB-EC-NEXT: Type: code70IMPLIB-EC-NEXT: Name type: export as71IMPLIB-EC-NEXT: Export name: func72IMPLIB-EC-NEXT: Symbol: __imp_func73IMPLIB-EC-NEXT: Symbol: func74IMPLIB-EC-NEXT: Symbol: __imp_aux_func75IMPLIB-EC-NEXT: Symbol: #func76 77RUN: FileCheck --check-prefix=OUT-DEF %s < out.def78OUT-DEF:      EXPORTS79OUT-DEF-NEXT:     func @180 81 82# Export using the EC .drectve section.83 84RUN: lld-link -machine:arm64x -dll -out:out-drectve-ec.dll arm64ec-func.obj arm64-func.obj \85RUN:          loadconfig-arm64.obj loadconfig-arm64ec.obj arm64ec-drectve.obj -noentry86RUN: llvm-objdump -d out-drectve-ec.dll | FileCheck --check-prefix=DISASM-EC %s87RUN: llvm-readobj --headers --coff-exports out-drectve-ec.dll | FileCheck --check-prefix=EXPORTS-EC %s88RUN: llvm-readobj out-drectve-ec.lib | FileCheck --check-prefixes=IMPLIB-HEADER,IMPLIB-EC %s89 90# A command-line def file applies only to EC exports.91 92RUN: lld-link -machine:arm64x -dll -out:out-def-ec.dll arm64ec-func.obj arm64-func.obj \93RUN:          loadconfig-arm64.obj loadconfig-arm64ec.obj -def:func.def -noentry94RUN: llvm-objdump -d out-def-ec.dll | FileCheck --check-prefix=DISASM-EC %s95RUN: llvm-readobj --headers --coff-exports out-def-ec.dll | FileCheck --check-prefix=EXPORTS-EC %s96RUN: llvm-readobj out-def-ec.lib | FileCheck --check-prefixes=IMPLIB-HEADER,IMPLIB-EC %s97 98# Export using the EC .edata section.99 100RUN: lld-link -machine:arm64x -dll -out:out-edata-ec.dll arm64ec-func.obj arm64-func.obj \101RUN:          loadconfig-arm64.obj loadconfig-arm64ec.obj arm64ec-edata.obj -noentry102 103RUN: llvm-objdump -d out-edata-ec.dll | FileCheck --check-prefix=DISASM-EDATA-EC %s104DISASM-EDATA-EC:      0000000180001000 <.text>:105DISASM-EDATA-EC-NEXT: 180001000: 52800040     mov     w0, #0x2                // =2106DISASM-EDATA-EC-NEXT: 180001004: d65f03c0     ret107 108RUN: llvm-readobj --headers --coff-exports out-edata-ec.dll | FileCheck --check-prefix=EXPORTS-EDATA-EC %s109EXPORTS-EDATA-EC:      ExportTableRVA: 0x0110EXPORTS-EDATA-EC-NEXT: ExportTableSize: 0x0111EXPORTS-EDATA-EC-NOT:  Name: func112EXPORTS-EDATA-EC:      HybridObject {113EXPORTS-EDATA-EC:        ExportTableRVA: 0x2{{.*}}114EXPORTS-EDATA-EC-NEXT:   ExportTableSize: 0x4{{.*}}115EXPORTS-EDATA-EC:        Export {116EXPORTS-EDATA-EC-NEXT:     Ordinal: 1117EXPORTS-EDATA-EC-NEXT:     Name: func118EXPORTS-EDATA-EC-NEXT:     RVA: 0x1000119EXPORTS-EDATA-EC-NEXT:   }120EXPORTS-EDATA-EC-NEXT: }121 122# Export using the native .drectve section.123 124RUN: lld-link -machine:arm64x -dll -out:out-drectve-native.dll arm64ec-func.obj arm64-func.obj \125RUN:          loadconfig-arm64.obj loadconfig-arm64ec.obj arm64-drectve.obj -noentry126 127RUN: llvm-objdump -d out-drectve-native.dll | FileCheck --check-prefix=DISASM-NATIVE %s128DISASM-NATIVE:      Disassembly of section .text:129DISASM-NATIVE-EMPTY:130DISASM-NATIVE-NEXT: 0000000180001000 <func>:131DISASM-NATIVE-NEXT: 180001000: 52800020     mov     w0, #0x1                // =1132DISASM-NATIVE-NEXT: 180001004: d65f03c0     ret133 134RUN: llvm-readobj --headers --coff-exports out-drectve-native.dll | FileCheck --check-prefix=EXPORTS-NATIVE %s135EXPORTS-NATIVE:      ExportTableRVA: 0x2{{.*}}136EXPORTS-NATIVE-NEXT: ExportTableSize: 0x4{{.*}}137EXPORTS-NATIVE:      Export {138EXPORTS-NATIVE-NEXT:   Ordinal: 1139EXPORTS-NATIVE-NEXT:   Name: func140EXPORTS-NATIVE-NEXT:   RVA: 0x1000141EXPORTS-NATIVE-NEXT: }142EXPORTS-NATIVE:      HybridObject {143EXPORTS-NATIVE:        ExportTableRVA: 0x0144EXPORTS-NATIVE-NEXT:   ExportTableSize: 0x0145EXPORTS-NATIVE-NOT:    Name: func146 147RUN: llvm-readobj out-drectve-native.lib | FileCheck --check-prefixes=IMPLIB-HEADER,IMPLIB-NATIVE %s148IMPLIB-NATIVE:      File: out{{.*}}.dll149IMPLIB-NATIVE-NEXT: Format: COFF-import-file-ARM64150IMPLIB-NATIVE-NEXT: Type: code151IMPLIB-NATIVE-NEXT: Name type: name152IMPLIB-NATIVE-NEXT: Export name: func153IMPLIB-NATIVE-NEXT: Symbol: __imp_func154IMPLIB-NATIVE-NEXT: Symbol: func155 156# Export using the native .edata section.157 158RUN: lld-link -machine:arm64x -dll -out:out-edata.dll arm64ec-func.obj arm64-func.obj \159RUN:          loadconfig-arm64.obj loadconfig-arm64ec.obj arm64-edata.obj -noentry160RUN: llvm-objdump -d out-edata.dll | FileCheck --check-prefix=DISASM-NATIVE %s161RUN: llvm-readobj --headers --coff-exports out-edata.dll | FileCheck --check-prefix=EXPORTS-NATIVE %s162 163# Export using both the native and EC .drectve sections.164 165RUN: lld-link -machine:arm64x -dll -out:out-both.dll arm64ec-func.obj arm64-func.obj \166RUN:          loadconfig-arm64.obj loadconfig-arm64ec.obj arm64-drectve.obj arm64ec-drectve.obj -noentry167 168RUN: llvm-objdump -d out-both.dll | FileCheck --check-prefix=DISASM-BOTH %s169DISASM-BOTH:      Disassembly of section .text:170DISASM-BOTH-EMPTY:171DISASM-BOTH-NEXT: 0000000180001000 <func>:172DISASM-BOTH-NEXT: 180001000: 52800020     mov     w0, #0x1                // =1173DISASM-BOTH-NEXT: 180001004: d65f03c0     ret174DISASM-BOTH-NEXT:                 ...175DISASM-BOTH-NEXT: 180002000: 52800040     mov     w0, #0x2                // =2176DISASM-BOTH-NEXT: 180002004: d65f03c0     ret177DISASM-BOTH-EMPTY:178DISASM-BOTH-NEXT: Disassembly of section .hexpthk:179DISASM-BOTH-EMPTY:180DISASM-BOTH-NEXT: 0000000180003000 <.hexpthk>:181DISASM-BOTH-NEXT: 180003000: 48 8b c4                     movq    %rsp, %rax182DISASM-BOTH-NEXT: 180003003: 48 89 58 20                  movq    %rbx, 0x20(%rax)183DISASM-BOTH-NEXT: 180003007: 55                           pushq   %rbp184DISASM-BOTH-NEXT: 180003008: 5d                           popq    %rbp185DISASM-BOTH-NEXT: 180003009: e9 f2 ef ff ff               jmp     0x180002000 <func+0x1000>186DISASM-BOTH-NEXT: 18000300e: cc                           int3187DISASM-BOTH-NEXT: 18000300f: cc                           int3188 189RUN: llvm-readobj --headers --coff-exports out-both.dll | FileCheck --check-prefix=EXPORTS-BOTH %s190EXPORTS-BOTH:      ExportTableRVA: 0x4{{.*}}191EXPORTS-BOTH-NEXT: ExportTableSize: 0x4{{.*}}192EXPORTS-BOTH:      Export {193EXPORTS-BOTH-NEXT:   Ordinal: 1194EXPORTS-BOTH-NEXT:   Name: func195EXPORTS-BOTH-NEXT:   RVA: 0x1000196EXPORTS-BOTH-NEXT: }197EXPORTS-BOTH:      HybridObject {198EXPORTS-BOTH:        ExportTableRVA: 0x4{{.*}}199EXPORTS-BOTH-NEXT:   ExportTableSize: 0x4{{.*}}200EXPORTS-BOTH:        Export {201EXPORTS-BOTH-NEXT:     Ordinal: 1202EXPORTS-BOTH-NEXT:     Name: func203EXPORTS-BOTH-NEXT:     RVA: 0x3000204EXPORTS-BOTH-NEXT:   }205EXPORTS-BOTH-NEXT: }206 207RUN: llvm-readobj out-both.lib | FileCheck --check-prefixes=IMPLIB-HEADER,IMPLIB-EC,IMPLIB-NATIVE %s208 209# Export using both the -def and -defarm64native arguments.210 211RUN: lld-link -machine:arm64x -dll -out:out-def-both.dll arm64ec-func.obj arm64-func.obj \212RUN:          loadconfig-arm64.obj loadconfig-arm64ec.obj -def:func.def -defarm64native:func.def -noentry213RUN: llvm-objdump -d out-def-both.dll | FileCheck --check-prefix=DISASM-BOTH %s214RUN: llvm-readobj --headers --coff-exports out-def-both.dll | FileCheck --check-prefix=EXPORTS-BOTH %s215RUN: llvm-readobj out-def-both.lib | FileCheck --check-prefixes=IMPLIB-HEADER,IMPLIB-EC,IMPLIB-NATIVE %s216 217# -defarm64native is ignored if -def is not specified.218 219RUN: lld-link -machine:arm64x -dll -out:out-def-native.dll arm64ec-func.obj arm64-func.obj \220RUN:          loadconfig-arm64.obj loadconfig-arm64ec.obj -defarm64native:func.def -noentry221RUN: llvm-readobj --headers --coff-exports out-def-native.dll | FileCheck --check-prefix=NO-EXPORT %s222NO-EXPORT:  ExportTableRVA: 0x0223NO-EXPORT:  ExportTableSize: 0x0224NO-EXPORT:  HybridObject {225NO-EXPORT:    ExportTableRVA: 0x0226NO-EXPORT:    ExportTableSize: 0x0227NO-EXPORT:  }228 229# -defarm64native is ignored on ARM64 target.230 231RUN: lld-link -machine:arm64 -dll -out:out-arm64-def.dll arm64-func.obj -defarm64native:invalid.def -def:func.def -noentry 2>&1 | count 0232 233# Export using both the native and EC .edata sections.234 235RUN: lld-link -machine:arm64x -dll -out:out-edata-both.dll arm64ec-func.obj arm64-func.obj \236RUN:          loadconfig-arm64.obj loadconfig-arm64ec.obj arm64-edata.obj arm64ec-edata.obj -noentry237RUN: llvm-readobj --headers --coff-exports out-edata-both.dll | FileCheck --check-prefix=EXPORTS-EDATA-BOTH %s238EXPORTS-EDATA-BOTH:      ExportTableRVA: 0x3{{.*}}239EXPORTS-EDATA-BOTH-NEXT: ExportTableSize: 0x4{{.*}}240EXPORTS-EDATA-BOTH:      Export {241EXPORTS-EDATA-BOTH-NEXT:   Ordinal: 1242EXPORTS-EDATA-BOTH-NEXT:   Name: func243EXPORTS-EDATA-BOTH-NEXT:   RVA: 0x1000244EXPORTS-EDATA-BOTH-NEXT: }245EXPORTS-EDATA-BOTH:      HybridObject {246EXPORTS-EDATA-BOTH:        ExportTableRVA: 0x3{{.*}}247EXPORTS-EDATA-BOTH-NEXT:   ExportTableSize: 0x4{{.*}}248EXPORTS-EDATA-BOTH:        Export {249EXPORTS-EDATA-BOTH-NEXT:     Ordinal: 1250EXPORTS-EDATA-BOTH-NEXT:     Name: func251EXPORTS-EDATA-BOTH-NEXT:     RVA: 0x2000252EXPORTS-EDATA-BOTH-NEXT:   }253EXPORTS-EDATA-BOTH-NEXT: }254 255#--- arm64-func.s256    .section .text,"xr",discard,func257    .globl func258    .p2align 2259func:260    mov w0, #1261    ret262 263#--- arm64ec-func.s264    .section .text,"xr",discard,func265    .globl func266    .p2align 2267func:268    mov w0, #2269    ret270 271#--- func-drectve.s272.section .drectve273    .ascii "-export:func"274 275#--- edata.s276    .section .edata, "dr"277    .align 4278exports:279    .long 0           // ExportFlags280    .long 0           // TimeDateStamp281    .long 0           // MajorVersion + MinorVersion282    .rva name         // NameRVA283    .long 1           // OrdinalBase284    .long 1           // AddressTableEntries285    .long 1           // NumberOfNamePointers286    .rva functions    // ExportAddressTableRVA287    .rva names        // NamePointerRVA288    .rva nameordinals // OrdinalTableRVA289 290names:291    .rva funcname_func292 293nameordinals:294    .short 0295 296functions:297    .rva func298    .long 0299 300funcname_func:301    .asciz "func"302 303name:304    .asciz "out-edata.dll"305 306#--- func.def307LIBRARY out.dll308EXPORTS309        func310