[memprof] Remove an unused using directive (#117004)
[llvm-project.git] / lld / test / COFF / arm64ec-patchable-thunks.test
blob5cebe7cc27ad6334c5bb008c6e3f99779a6f62f0
1 REQUIRES: aarch64, x86
2 RUN: split-file %s %t.dir && cd %t.dir
4 RUN: llvm-mc -filetype=obj -triple=arm64ec-windows arm64ec-patchable.s -o arm64ec-patchable.obj
5 RUN: llvm-mc -filetype=obj -triple=arm64ec-windows arm64ec-alias.s -o arm64ec-alias.obj
6 RUN: llvm-mc -filetype=obj -triple=arm64ec-windows test-sec.s -o test-sec.obj
7 RUN: llvm-mc -filetype=obj -triple=arm64ec-windows %S/Inputs/loadconfig-arm64ec.s -o loadconfig-arm64ec.obj
9 RUN: lld-link -out:test.dll -machine:arm64ec arm64ec-patchable.obj test-sec.obj loadconfig-arm64ec.obj -dll -noentry
11 RUN: llvm-objdump -d test.dll | FileCheck -check-prefix=PATCH-DISASM %s
12 PATCH-DISASM:      Disassembly of section .text:
13 PATCH-DISASM-EMPTY:
14 PATCH-DISASM-NEXT: 0000000180001000 <.text>:
15 PATCH-DISASM-NEXT: 180001000: 52800040     mov     w0, #0x2                // =2
16 PATCH-DISASM-NEXT: 180001004: d65f03c0     ret
17 PATCH-DISASM-EMPTY:
18 PATCH-DISASM-NEXT: Disassembly of section .hexpthk:
19 PATCH-DISASM-EMPTY:
20 PATCH-DISASM-NEXT: 0000000180002000
21 PATCH-DISASM-NEXT: 180002000: 48 8b c4                     movq    %rsp, %rax
22 PATCH-DISASM-NEXT: 180002003: 48 89 58 20                  movq    %rbx, 0x20(%rax)
23 PATCH-DISASM-NEXT: 180002007: 55                           pushq   %rbp
24 PATCH-DISASM-NEXT: 180002008: 5d                           popq    %rbp
25 PATCH-DISASM-NEXT: 180002009: e9 f2 ef ff ff               jmp     0x180001000 <.text>
26 PATCH-DISASM-NEXT: 18000200e: cc                           int3
27 PATCH-DISASM-NEXT: 18000200f: cc                           int3
29 RUN: llvm-readobj --hex-dump=.test test.dll | FileCheck -check-prefix=RVA %s
30 RVA: 0x180006000 00200000
32 RUN: llvm-readobj --coff-load-config test.dll | FileCheck -check-prefix=PATCH-CHPE %s
33 PATCH-CHPE:       CodeMap [
34 PATCH-CHPE-NEXT:    0x1000 - 0x1008  ARM64EC
35 PATCH-CHPE-NEXT:    0x2000 - 0x2010  X64
36 PATCH-CHPE-NEXT:  ]
37 PATCH-CHPE-NEXT:  CodeRangesToEntryPoints [
38 PATCH-CHPE-NEXT:    0x2000 - 0x2010 -> 0x2000
39 PATCH-CHPE-NEXT:  ]
40 PATCH-CHPE-NEXT:  RedirectionMetadata [
41 PATCH-CHPE-NEXT:    0x2000 -> 0x1000
42 PATCH-CHPE-NEXT:  ]
45 RUN: lld-link -out:test2.dll -machine:arm64ec arm64ec-alias.obj test-sec.obj loadconfig-arm64ec.obj -dll -noentry
47 RUN: llvm-objdump -d test2.dll | FileCheck -check-prefix=PATCH-DISASM %s
48 RUN: llvm-readobj --hex-dump=.test test2.dll | FileCheck -check-prefix=RVA %s
49 RUN: llvm-readobj --coff-load-config test2.dll | FileCheck -check-prefix=PATCH-CHPE %s
51 RUN: lld-link -out:test3.dll -machine:arm64ec arm64ec-alias.obj test-sec.obj loadconfig-arm64ec.obj -dll -noentry -export:patchable_func
53 RUN: llvm-objdump -d test3.dll | FileCheck -check-prefix=PATCH-DISASM %s
54 RUN: llvm-readobj --hex-dump=.test test3.dll | FileCheck -check-prefix=RVA %s
55 RUN: llvm-readobj --coff-load-config test3.dll | FileCheck -check-prefix=PATCH-CHPE %s
58 RUN: not lld-link -out:test4.dll -machine:arm64ec test-sec.obj loadconfig-arm64ec.obj -dll -noentry 2>&1 | FileCheck --check-prefix=ERR %s
59 ERR: error: undefined symbol: EXP+#patchable_func
62 #--- arm64ec-patchable.s
63     .section ".text", "x", discard, "#patchable_func$hp_target"
64     .globl "#patchable_func$hp_target"
65     .p2align 2, 0x0
66 "#patchable_func$hp_target":
67     mov w0, #2
68     ret
70     .def "EXP+#patchable_func"
71     .scl 2
72     .type 32
73     .endef
75 #--- arm64ec-alias.s
76     .section ".text", "x", discard, "#patchable_func$hp_target"
77     .globl "#patchable_func$hp_target"
78     .p2align 2, 0x0
79 "#patchable_func$hp_target":
80     mov w0, #2
81     ret
83     .def "EXP+#patchable_func"
84     .scl 2
85     .type 32
86     .endef
87     .weak patchable_func
88 patchable_func = "EXP+#patchable_func"
90 #--- test-sec.s
91     .section ".test", "rd"
92     .rva "EXP+#patchable_func"