Skip to content

Commit 8793ffb

Browse files
cjacekSquallATF
authored andcommitted
[LLD][COFF] Add support for -includeoptional on ARM64X (llvm#126300)
Include symbols from both symbol tables.
1 parent f834d18 commit 8793ffb

File tree

2 files changed

+24
-7
lines changed

2 files changed

+24
-7
lines changed

lld/COFF/Driver.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2557,14 +2557,14 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
25572557
// it.
25582558
if (symtab.findUnderscore("_load_config_used"))
25592559
symtab.addGCRoot(symtab.mangle("_load_config_used"));
2560-
});
25612560

2562-
if (args.hasArg(OPT_include_optional)) {
2563-
// Handle /includeoptional
2564-
for (auto *arg : args.filtered(OPT_include_optional))
2565-
if (isa_and_nonnull<LazyArchive>(ctx.symtab.find(arg->getValue())))
2566-
ctx.symtab.addGCRoot(arg->getValue());
2567-
}
2561+
if (args.hasArg(OPT_include_optional)) {
2562+
// Handle /includeoptional
2563+
for (auto *arg : args.filtered(OPT_include_optional))
2564+
if (isa_and_nonnull<LazyArchive>(symtab.find(arg->getValue())))
2565+
symtab.addGCRoot(arg->getValue());
2566+
}
2567+
});
25682568
} while (run());
25692569
}
25702570

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// REQUIRE: aarch64
2+
3+
// RUN: llvm-mc -filetype=obj -triple=aarch64-windows %s -o %t.arm64.obj
4+
// RUN: llvm-mc -filetype=obj -triple=arm64ec-windows %s -o %t.arm64ec.obj
5+
// RUN: llvm-mc -filetype=obj -triple=arm64ec-windows %S/Inputs/loadconfig-arm64ec.s -o %t-loadconfig-arm64ec.obj
6+
// RUN: llvm-mc -filetype=obj -triple=aarch64-windows %S/Inputs/loadconfig-arm64.s -o %t-loadconfig-arm64.obj
7+
8+
// RUN: llvm-lib -machine:arm64x -out:%t-test.lib %t.arm64.obj %t.arm64ec.obj %t-loadconfig-arm64ec.obj %t-loadconfig-arm64.obj
9+
// RUN: lld-link -machine:arm64x -dll -noentry -out:%t.dll %t-test.lib -includeoptional:sym
10+
11+
// RUN: llvm-readobj --hex-dump=.test %t.dll | FileCheck %s
12+
// CHECK: 0x180004000 01000000 01000000
13+
14+
.globl sym
15+
.section .test,"dr"
16+
sym:
17+
.word 1

0 commit comments

Comments
 (0)