xref: /llvm-project/lld/test/COFF/arm64x-symtab.s (revision 21a6dbd400ffd68abe36161576d81d0646f1122d)
1// REQUIRES: aarch64, x86
2// RUN: split-file %s %t.dir && cd %t.dir
3
4// RUN: llvm-mc -filetype=obj -triple=aarch64-windows sym.s -o sym-aarch64.obj
5// RUN: llvm-mc -filetype=obj -triple=arm64ec-windows sym.s -o sym-arm64ec.obj
6// RUN: llvm-mc -filetype=obj -triple=x86_64-windows sym.s -o sym-x86_64.obj
7// RUN: llvm-mc -filetype=obj -triple=aarch64-windows symref.s -o symref-aarch64.obj
8// RUN: llvm-mc -filetype=obj -triple=arm64ec-windows symref.s -o symref-arm64ec.obj
9// RUN: llvm-mc -filetype=obj -triple=x86_64-windows symref.s -o symref-x86_64.obj
10// RUN: llvm-lib -machine:arm64x -out:sym.lib sym-aarch64.obj sym-arm64ec.obj
11
12// Check that native object files can't reference EC symbols.
13
14// RUN: not lld-link -machine:arm64x -dll -noentry -out:err1.dll symref-aarch64.obj sym-arm64ec.obj \
15// RUN:              2>&1 | FileCheck --check-prefix=UNDEF %s
16// UNDEF:      lld-link: error: undefined symbol: sym
17// UNDEF-NEXT: >>> referenced by symref-aarch64.obj:(.data)
18
19// Check that EC object files can't reference native symbols.
20
21// RUN: not lld-link -machine:arm64x -dll -noentry -out:out.dll symref-arm64ec.obj sym-aarch64.obj \
22// RUN:              2>&1 | FileCheck --check-prefix=UNDEFEC %s
23// UNDEFEC:      lld-link: error: undefined symbol: sym
24// UNDEFEC-NEXT: >>> referenced by symref-arm64ec.obj:(.data)
25
26// RUN: not lld-link -machine:arm64x -dll -noentry -out:out.dll symref-x86_64.obj sym-aarch64.obj \
27// RUN:              2>&1 | FileCheck --check-prefix=UNDEFX86 %s
28// UNDEFX86:      lld-link: error: undefined symbol: sym
29// UNDEFX86-NEXT: >>> referenced by symref-x86_64.obj:(.data)
30
31// RUN: not lld-link -machine:arm64x -dll -noentry -out:err2.dll symref-aarch64.obj sym-x86_64.obj \
32// RUN:              2>&1 | FileCheck --check-prefix=UNDEF %s
33
34// Check that ARM64X target can have the same symbol names in both native and EC namespaces.
35
36// RUN: lld-link -machine:arm64x -dll -noentry -out:out.dll symref-aarch64.obj sym-aarch64.obj \
37// RUN:           symref-arm64ec.obj sym-x86_64.obj
38
39// Check that ARM64X target can reference both native and EC symbols from an archive.
40
41// RUN: lld-link -machine:arm64x -dll -noentry -out:out2.dll symref-aarch64.obj symref-arm64ec.obj sym.lib
42
43#--- symref.s
44    .data
45    .rva sym
46
47#--- sym.s
48     .data
49     .globl sym
50sym:
51     .word 0
52