[lld] [LLD][COFF] Add support for the -defArm64Native argument (PR #123850)
Martin Storsjö via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 22 01:46:31 PST 2025
================
@@ -162,6 +162,29 @@ EXPORTS-BOTH-NEXT: RVA: 0x3000
EXPORTS-BOTH-NEXT: }
EXPORTS-BOTH-NEXT: }
+# Export using both the -def and -defarm64native arguments.
+
+RUN: lld-link -machine:arm64x -dll -out:out-def-both.dll arm64ec-func.obj arm64-func.obj \
+RUN: loadconfig-arm64.obj loadconfig-arm64ec.obj -def:func.def -defarm64native:func.def -noentry
+RUN: llvm-objdump -d out-def-both.dll | FileCheck --check-prefix=DISASM-BOTH %s
+RUN: llvm-readobj --headers --coff-exports out-def-both.dll | FileCheck --check-prefix=EXPORTS-BOTH %s
+
+# -defarm64native is ignored if -def is not specified.
+
+RUN: lld-link -machine:arm64x -dll -out:out-def-native.dll arm64ec-func.obj arm64-func.obj \
+RUN: loadconfig-arm64.obj loadconfig-arm64ec.obj -defarm64native:func.def -noentry
+RUN: llvm-readobj --headers --coff-exports out-def-native.dll | FileCheck --check-prefix=NO-EXPORT %s
+NO-EXPORT: ExportTableRVA: 0x0
+NO-EXPORT: ExportTableSize: 0x0
+NO-EXPORT: HybridObject {
+NO-EXPORT: ExportTableRVA: 0x0
+NO-EXPORT: ExportTableSize: 0x0
+NO-EXPORT: }
+
+# -defarm64native is ignored on ARM64 target.
+
+RUN: lld-link -machine:arm64 -dll -out:out-arm64-def.dll arm64-func.obj -defarm64native:undef.def -def:func.def -noentry
----------------
mstorsjo wrote:
This test doesn't really verify that it is ignored; it only says that linking does succeed - but it doesn't verify e.g. that we don't print any warning. We can test that, without needing to specify any explicit `-NOT` tests, by doing `2>&1 | count 0` on the run line.
https://github.com/llvm/llvm-project/pull/123850
More information about the llvm-commits
mailing list