[lld] 21a6dbd - [LLD][COFF] Report undefined EC symbols on ARM64X (#120311)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 20 10:56:05 PST 2024
Author: Jacek Caban
Date: 2024-12-20T19:56:02+01:00
New Revision: 21a6dbd400ffd68abe36161576d81d0646f1122d
URL: https://github.com/llvm/llvm-project/commit/21a6dbd400ffd68abe36161576d81d0646f1122d
DIFF: https://github.com/llvm/llvm-project/commit/21a6dbd400ffd68abe36161576d81d0646f1122d.diff
LOG: [LLD][COFF] Report undefined EC symbols on ARM64X (#120311)
Added:
Modified:
lld/COFF/Driver.cpp
lld/test/COFF/arm64x-symtab.s
Removed:
################################################################################
diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp
index bef55abb7f856e..a4d6b94812d937 100644
--- a/lld/COFF/Driver.cpp
+++ b/lld/COFF/Driver.cpp
@@ -2727,8 +2727,10 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
createECExportThunks();
// Resolve remaining undefined symbols and warn about imported locals.
- while (ctx.symtab.resolveRemainingUndefines())
- run();
+ ctx.forEachSymtab([&](SymbolTable &symtab) {
+ while (symtab.resolveRemainingUndefines())
+ run();
+ });
if (errorCount())
return;
diff --git a/lld/test/COFF/arm64x-symtab.s b/lld/test/COFF/arm64x-symtab.s
index e7beb0287d7ff9..2b269dde61f613 100644
--- a/lld/test/COFF/arm64x-symtab.s
+++ b/lld/test/COFF/arm64x-symtab.s
@@ -6,6 +6,7 @@
// RUN: llvm-mc -filetype=obj -triple=x86_64-windows sym.s -o sym-x86_64.obj
// RUN: llvm-mc -filetype=obj -triple=aarch64-windows symref.s -o symref-aarch64.obj
// RUN: llvm-mc -filetype=obj -triple=arm64ec-windows symref.s -o symref-arm64ec.obj
+// RUN: llvm-mc -filetype=obj -triple=x86_64-windows symref.s -o symref-x86_64.obj
// RUN: llvm-lib -machine:arm64x -out:sym.lib sym-aarch64.obj sym-arm64ec.obj
// Check that native object files can't reference EC symbols.
@@ -15,6 +16,18 @@
// UNDEF: lld-link: error: undefined symbol: sym
// UNDEF-NEXT: >>> referenced by symref-aarch64.obj:(.data)
+// Check that EC object files can't reference native symbols.
+
+// RUN: not lld-link -machine:arm64x -dll -noentry -out:out.dll symref-arm64ec.obj sym-aarch64.obj \
+// RUN: 2>&1 | FileCheck --check-prefix=UNDEFEC %s
+// UNDEFEC: lld-link: error: undefined symbol: sym
+// UNDEFEC-NEXT: >>> referenced by symref-arm64ec.obj:(.data)
+
+// RUN: not lld-link -machine:arm64x -dll -noentry -out:out.dll symref-x86_64.obj sym-aarch64.obj \
+// RUN: 2>&1 | FileCheck --check-prefix=UNDEFX86 %s
+// UNDEFX86: lld-link: error: undefined symbol: sym
+// UNDEFX86-NEXT: >>> referenced by symref-x86_64.obj:(.data)
+
// RUN: not lld-link -machine:arm64x -dll -noentry -out:err2.dll symref-aarch64.obj sym-x86_64.obj \
// RUN: 2>&1 | FileCheck --check-prefix=UNDEF %s
More information about the llvm-commits
mailing list