Skip to content

Commit 82f4a1f

Browse files
committed
Better ARM64X handling and tests
1 parent ff9f52c commit 82f4a1f

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

lld/COFF/SymbolTable.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ void SymbolTable::addFile(InputFile *file) {
7979
// The ARM64EC target must be explicitly specified and cannot be inferred.
8080
if (mt == ARM64EC &&
8181
(ctx.config.machine == IMAGE_FILE_MACHINE_UNKNOWN ||
82-
(ctx.config.machineInferred && (COFF::isAnyArm64(ctx.config.machine) ||
83-
ctx.config.machine == AMD64)))) {
82+
(ctx.config.machineInferred &&
83+
(ctx.config.machine == ARM64 || ctx.config.machine == AMD64)))) {
8484
error(toString(file) + ": machine type arm64ec is ambiguous and cannot be "
8585
"inferred, use /machine:arm64ec or /machine:arm64x");
8686
return;
@@ -93,7 +93,7 @@ void SymbolTable::addFile(InputFile *file) {
9393
if (ctx.config.machine == IMAGE_FILE_MACHINE_UNKNOWN &&
9494
mt != IMAGE_FILE_MACHINE_UNKNOWN) {
9595
ctx.config.machineInferred = true;
96-
ctx.config.machine = mt == ARM64X ? ARM64 : mt;
96+
ctx.config.machine = mt;
9797
ctx.driver.addWinSysRootLibSearchPaths();
9898
}
9999

lld/test/COFF/arm64ec.test

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ ARM64X-DATA: 03030303 01010101 02020202
3737

3838
RUN: not lld-link -out:test.dll -machine:arm64 arm64-data-sym.obj arm64ec-data-sym.obj \
3939
RUN: -dll -noentry 2>&1 | FileCheck -check-prefix=INCOMPAT1 %s
40-
INCOMPAT1: arm64ec-data-sym.obj: machine type arm64ec conflicts with arm64
40+
INCOMPAT1: lld-link: error: arm64ec-data-sym.obj: machine type arm64ec conflicts with arm64
4141

4242
RUN: not lld-link -out:test.dll -machine:arm64ec arm64ec-data-sym.obj arm64-data-sym.obj \
4343
RUN: -dll -noentry 2>&1 | FileCheck -check-prefix=INCOMPAT2 %s
@@ -55,17 +55,17 @@ INCOMPAT4: lld-link: error: arm64ec-data-sym.obj: machine type arm64ec is ambigu
5555
RUN: not lld-link -out:test.dll x86_64-data-sym.obj arm64ec-data-sym.obj \
5656
RUN: -dll -noentry 2>&1 | FileCheck -check-prefix=INCOMPAT4 %s
5757

58-
RUN: not lld-link -out:test.dll aarch64-data-sym.obj arm64ec-data-sym.obj \
58+
RUN: not lld-link -out:test.dll arm64-data-sym.obj arm64ec-data-sym.obj \
5959
RUN: -dll -noentry 2>&1 | FileCheck -check-prefix=INCOMPAT4 %s
6060

6161
RUN: not lld-link -out:test.dll i686-data-sym.obj arm64ec-data-sym.obj \
6262
RUN: -dll -noentry 2>&1 | FileCheck -check-prefix=INCOMPAT5 %s
63-
INCOMPAT5: arm64ec-data-sym.obj: machine type arm64ec conflicts with x86
63+
INCOMPAT5: lld-link: error: arm64ec-data-sym.obj: machine type arm64ec conflicts with x86
6464

65-
arm64x input implies arm64 target
66-
RUN: lld-link -out:test.dll -machine:arm64 arm64x-resource.obj -dll -noentry
67-
RUN: llvm-readobj --file-headers test.dll | FileCheck -check-prefix=ARM64-HEADER %s
68-
ARM64-HEADER: Machine: IMAGE_FILE_MACHINE_ARM64 (0xAA64)
65+
arm64x can be inferred and when mixed with ARM64, the first one wins
66+
RUN: lld-link -out:test.dll -dll -noentry arm64x-resource.obj arm64-data-sym.obj x86_64-data-sym.obj arm64ec-data-sym.obj
67+
RUN: not lld-link -out:test.dll -dll -noentry arm64-data-sym.obj arm64x-resource.obj x86_64-data-sym.obj 2>&1 | FileCheck -check-prefix=INCOMPAT3 %s
68+
RUN: not lld-link -out:test.dll -dll -noentry arm64-data-sym.obj arm64x-resource.obj arm64ec-data-sym.obj 2>&1 | FileCheck -check-prefix=INCOMPAT4 %s
6969

7070
#--- arm64ec-data-sym.s
7171
.data

0 commit comments

Comments
 (0)