zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 1e095024a7974f323032f517aeff595e64963301 (tree)
parent 92117d9bef9f21f0d4840748606717574fd4f44a
Author: Alex Rønne Petersen <alex@alexrp.com>
Date:   Sun,  8 Dec 2024 20:20:28 +0100

compiler: Check for wasi-libc emulated libraries before libc libraries.

This will become useful when we update wasi-libc and get the emulated libdl.

Diffstat:
Msrc/main.zig | 15+++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/main.zig b/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; },