File tree Expand file tree Collapse file tree 2 files changed +61
-0
lines changed Expand file tree Collapse file tree 2 files changed +61
-0
lines changed Original file line number Diff line number Diff line change @@ -100,6 +100,20 @@ void ArchiveFile::parse() {
100100 // Parse a MemoryBufferRef as an archive file.
101101 file = CHECK (Archive::create (mb), this );
102102
103+ // Try to read symbols from ECSYMBOLS section on ARM64EC.
104+ if (isArm64EC (ctx.config .machine )) {
105+ iterator_range<Archive::symbol_iterator> symbols =
106+ CHECK (file->ec_symbols (), this );
107+ if (!symbols.empty ()) {
108+ for (const Archive::Symbol &sym : symbols)
109+ ctx.symtab .addLazyArchive (this , sym);
110+
111+ // Read both EC and native symbols on ARM64X.
112+ if (ctx.config .machine != ARM64X)
113+ return ;
114+ }
115+ }
116+
103117 // Read the symbol table to construct Lazy objects.
104118 for (const Archive::Symbol &sym : file->symbols ())
105119 ctx.symtab .addLazyArchive (this , sym);
Original file line number Diff line number Diff line change 1+ REQUIRES: aarch64, x86
2+ RUN: split-file %s %t.dir && cd %t.dir
3+
4+ RUN: llvm-mc -filetype=obj -triple=arm64ec-windows symref.s -o symref-arm64ec.obj
5+ RUN: llvm-mc -filetype=obj -triple=arm64ec-windows nsymref.s -o nsymref-arm64ec.obj
6+ RUN: llvm-mc -filetype=obj -triple=aarch64-windows nsymref.s -o nsymref-aarch64.obj
7+ RUN: llvm-mc -filetype=obj -triple=arm64ec-windows sym.s -o sym-arm64ec.obj
8+ RUN: llvm-mc -filetype=obj -triple=x86_64-windows sym.s -o sym-x86_64.obj
9+ RUN: llvm-mc -filetype=obj -triple=aarch64-windows nsym.s -o nsym-aarch64.obj
10+ RUN: llvm-mc -filetype=obj -triple=arm64ec-windows %S/Inputs/loadconfig-arm64ec.s -o loadconfig-arm64ec.obj
11+
12+ RUN: llvm-lib -machine:arm64ec -out:sym-arm64ec.lib sym-arm64ec.obj nsym-aarch64.obj
13+ RUN: llvm-lib -machine:amd64 -out:sym-x86_64.lib sym-x86_64.obj
14+
15+ Verify that a symbol can be referenced from ECSYMBOLS.
16+ RUN: lld-link -machine:arm64ec -dll -noentry -out:test.dll symref-arm64ec.obj sym-arm64ec.lib loadconfig-arm64ec.obj
17+
18+ Verify that a symbol can be referenced from a regular archive map when ECSYMBOLS is absent (using an x86_64 archive).
19+ RUN: lld-link -machine:arm64ec -dll -noentry -out:test2.dll symref-arm64ec.obj sym-x86_64.lib loadconfig-arm64ec.obj
20+
21+ Verify that both native and EC symbols can be referenced in a hybrid target.
22+ RUN: lld-link -machine:arm64x -dll -noentry -out:test3.dll symref-arm64ec.obj nsymref-aarch64.obj sym-arm64ec.lib loadconfig-arm64ec.obj
23+
24+ Ensure that an EC symbol is not resolved using a regular symbol map.
25+ RUN: not lld-link -machine:arm64ec -dll -noentry -out:test-err.dll nsymref-arm64ec.obj sym-arm64ec.lib loadconfig-arm64ec.obj 2>&1 |\
26+ RUN: FileCheck --check-prefix=ERR %s
27+ ERR: error: undefined symbol: nsym
28+
29+ #--- symref.s
30+ .data
31+ .rva sym
32+
33+ #--- nsymref.s
34+ .data
35+ .rva nsym
36+
37+ #--- sym.s
38+ .data
39+ .globl sym
40+ sym:
41+ .word 0
42+
43+ #--- nsym.s
44+ .data
45+ .globl nsym
46+ nsym:
47+ .word 0
You can’t perform that action at this time.
0 commit comments