mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 04:48:20 +00:00
compiler: Check for wasi-libc emulated libraries before libc libraries.
This will become useful when we update wasi-libc and get the emulated libdl.
This commit is contained in:
parent
92117d9bef
commit
1e095024a7
15
src/main.zig
15
src/main.zig
@ -3824,6 +3824,14 @@ fn createModule(
|
||||
for (create_module.cli_link_inputs.items) |cli_link_input| switch (cli_link_input) {
|
||||
.name_query => |nq| {
|
||||
const lib_name = nq.name;
|
||||
|
||||
if (target.os.tag == .wasi) {
|
||||
if (wasi_libc.getEmulatedLibCrtFile(lib_name)) |crt_file| {
|
||||
try create_module.wasi_emulated_libs.append(arena, crt_file);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (std.zig.target.isLibCLibName(target, lib_name)) {
|
||||
create_module.opts.link_libc = true;
|
||||
continue;
|
||||
@ -3832,6 +3840,7 @@ fn createModule(
|
||||
create_module.opts.link_libcpp = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (target_util.classifyCompilerRtLibName(lib_name)) {
|
||||
.none => {},
|
||||
.only_libunwind, .both => {
|
||||
@ -3857,12 +3866,6 @@ fn createModule(
|
||||
fatal("cannot use absolute path as a system library: {s}", .{lib_name});
|
||||
}
|
||||
|
||||
if (target.os.tag == .wasi) {
|
||||
if (wasi_libc.getEmulatedLibCrtFile(lib_name)) |crt_file| {
|
||||
try create_module.wasi_emulated_libs.append(arena, crt_file);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
unresolved_link_inputs.appendAssumeCapacity(cli_link_input);
|
||||
any_name_queries_remaining = true;
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user