Skip to content

Commit cb4eb1b

Browse files
cjacekSquallATF
authored andcommitted
[LLD][COFF] Emit locally imported EC symbols for ARM64X (llvm#125527)
1 parent f00ee16 commit cb4eb1b

File tree

2 files changed

+38
-4
lines changed

2 files changed

+38
-4
lines changed

lld/COFF/Writer.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1191,10 +1191,12 @@ void Writer::createMiscChunks() {
11911191
}
11921192

11931193
// Create thunks for locally-dllimported symbols.
1194-
if (!ctx.symtab.localImportChunks.empty()) {
1195-
for (Chunk *c : ctx.symtab.localImportChunks)
1196-
rdataSec->addChunk(c);
1197-
}
1194+
ctx.forEachSymtab([&](SymbolTable &symtab) {
1195+
if (!symtab.localImportChunks.empty()) {
1196+
for (Chunk *c : symtab.localImportChunks)
1197+
rdataSec->addChunk(c);
1198+
}
1199+
});
11981200

11991201
// Create Debug Information Chunks
12001202
debugInfoSec = config->mingw ? buildidSec : rdataSec;
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// REQUIRES: 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+
6+
// RUN: lld-link -machine:arm64x -dll -noentry %t.arm64.obj %t.arm64ec.obj -out:%t.dll 2>&1 | FileCheck --check-prefix=WARN %s
7+
// WARN: lld-link: warning: {{.*}}.arm64.obj: locally defined symbol imported: func
8+
// WARN-NEXT: lld-link: warning: {{.*}}.arm64ec.obj: locally defined symbol imported: func
9+
10+
// RUN: llvm-readobj --hex-dump=.test %t.dll | FileCheck --check-prefix=TEST %s
11+
// TEST: 0x180005000 00300000 08300000
12+
13+
// RUN: llvm-readobj --coff-basereloc %t.dll | FileCheck --check-prefix=RELOCS %s
14+
// RELOCS: Entry {
15+
// RELOCS-NEXT: Type: DIR64
16+
// RELOCS-NEXT: Address: 0x3000
17+
// RELOCS-NEXT: }
18+
// RELOCS-NEXT: Entry {
19+
// RELOCS-NEXT: Type: DIR64
20+
// RELOCS-NEXT: Address: 0x3008
21+
// RELOCS-NEXT: }
22+
23+
// RUN: llvm-readobj --hex-dump=.rdata %t.dll | FileCheck --check-prefix=RDATA %s
24+
// RDATA: 0x180003000 00100080 01000000 00200080 01000000
25+
26+
.text
27+
.globl func
28+
func:
29+
ret
30+
31+
.section .test, "r"
32+
.rva __imp_func

0 commit comments

Comments
 (0)