1 # REQUIRES: aarch64, x86
2 # RUN: split-file %s %t.dir && cd %t.dir
4 # Test that metadata is generated when a custom export thunk is supplied.
6 # RUN: llvm-mc -filetype=obj -triple=arm64ec-windows func.s -o func.obj
7 # RUN: llvm-mc -filetype=obj -triple=arm64ec-windows hp-func.s -o hp-func.obj
8 # RUN: llvm-mc -filetype=obj -triple=x86_64-windows thunk.s -o thunk.obj
9 # RUN: llvm-mc -filetype=obj -triple=arm64ec-windows %S/Inputs/loadconfig-arm64ec.s -o loadconfig-arm64ec.obj
11 # RUN: lld-link -out:out.dll -machine:arm64ec func.obj thunk.obj loadconfig-arm64ec.obj -dll -noentry "-export:#func,EXPORTAS,func"
13 # RUN: llvm-objdump -d out.dll | FileCheck --check-prefixes=DISASM,DISASM-EXP %s
14 # DISASM: Disassembly of section .text:
16 # DISASM-NEXT: 0000000180001000 <.text>:
17 # DISASM-NEXT: 180001000: 52800040 mov w0, #0x2 // =2
18 # DISASM-NEXT: 180001004: d65f03c0 ret
21 # DISASM-EXP-NEXT: 0000000180002000 <func>:
22 # DISASM-NEXT: 180002000: b8 03 00 00 00 movl $0x3, %eax
23 # DISASM-NEXT: 180002005: c3 retq
25 # RUN: llvm-objdump -p out.dll | FileCheck --check-prefix=EXPORT %s
26 # EXPORT: Ordinal RVA Name
27 # EXPORT-NEXT: 1 0x2000 func
29 # RUN: llvm-readobj --coff-load-config out.dll | FileCheck --check-prefix=CHPE %s
31 # CHPE-NEXT: 0x1000 - 0x1008 ARM64EC
32 # CHPE-NEXT: 0x2000 - 0x2006 X64
34 # CHPE-NEXT: CodeRangesToEntryPoints [
35 # CHPE-NEXT: 0x2000 - 0x2006 -> 0x2000
37 # CHPE-NEXT: RedirectionMetadata [
38 # CHPE-NEXT: 0x2000 -> 0x1000
41 # RUN: lld-link -out:out2.dll -machine:arm64ec hp-func.obj thunk.obj loadconfig-arm64ec.obj -dll -noentry
42 # RUN: llvm-objdump -d out2.dll | FileCheck --check-prefix=DISASM %s
43 # RUN: llvm-readobj --coff-load-config out2.dll | FileCheck --check-prefix=CHPE %s
53 .section .text,"xr",discard,"#func$hp_target"
54 .globl "#func$hp_target"
65 .set func, "EXP+#func"
67 .set "#func", "#func$hp_target"
77 .section .wowthk$aa,"xr",discard,"EXP+#func"