Skip to content

Commit f283dd5

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

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
@@ -2563,14 +2563,14 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
25632563
// it.
25642564
if (symtab.findUnderscore("_load_config_used"))
25652565
symtab.addGCRoot(symtab.mangle("_load_config_used"));
2566-
});
25672566

2568-
if (args.hasArg(OPT_include_optional)) {
2569-
// Handle /includeoptional
2570-
for (auto *arg : args.filtered(OPT_include_optional))
2571-
if (isa_and_nonnull<LazyArchive>(ctx.symtab.find(arg->getValue())))
2572-
ctx.symtab.addGCRoot(arg->getValue());
2573-
}
2567+
if (args.hasArg(OPT_include_optional)) {
2568+
// Handle /includeoptional
2569+
for (auto *arg : args.filtered(OPT_include_optional))
2570+
if (isa_and_nonnull<LazyArchive>(symtab.find(arg->getValue())))
2571+
symtab.addGCRoot(arg->getValue());
2572+
}
2573+
});
25742574
} while (run());
25752575
}
25762576

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)