[lld] [llvm] [LLD][COFF] Add support for ARM64EC entry thunks. (PR #88132)

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 17 02:48:49 PDT 2024


================
@@ -0,0 +1,113 @@
+REQUIRES: aarch64
+RUN: split-file %s %t.dir && cd %t.dir
+
+#--- text-func.s
+    .text
+    .globl func
+    .p2align 2, 0x0
+func:
+    mov w0, #1
+    ret
+
+    .section .wowthk$aa,"xr",discard,thunk
+    .globl thunk
+    .p2align 2
+thunk:
+    ret
+
+    .section .hybmp$x,"yi"
+    .symidx func
+    .symidx thunk
+    .word 1
+
+// RUN: llvm-mc -filetype=obj -triple=arm64ec-windows text-func.s -o text-func.obj
+// RUN: not lld-link -machine:arm64ec -dll -noentry -out:test.dll text-func.obj 2>&1 | FileCheck -check-prefix=FUNC-NON-COMDAT %s
+// FUNC-NON-COMDAT: error: non COMDAT symbol 'func' in hybrid map
+
+#--- offset-func.s
+    .section .text,"xr",discard,func
+    mov w0, #2
+    .globl func
+    .p2align 2, 0x0
+func:
+    mov w0, #1
----------------
mstorsjo wrote:

It took me a while to spot what was wrong here - that the function label isn't at the start of the section. It could be good to have a comment above this test saying what it tests (even if "offset" kinda gives it away, but it's not very obvious).

It could also be good to spell out a comment in the source, that we also check that the symbol points directly at the start of the section chunk.

https://github.com/llvm/llvm-project/pull/88132


More information about the llvm-commits mailing list