mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 04:48:20 +00:00
Merge pull request #22191 from alexrp/wasi-libc-names
`std.zig.target`: Teach `isLibCLibName()` about emulated wasi-libc libraries
This commit is contained in:
commit
7cd2c1ce87
@ -218,13 +218,22 @@ pub fn isLibCLibName(target: std.Target, name: []const u8) bool {
|
||||
return true;
|
||||
if (eqlIgnoreCase(ignore_case, name, "xnet"))
|
||||
return true;
|
||||
|
||||
if (target.os.tag == .wasi) {
|
||||
if (eqlIgnoreCase(ignore_case, name, "wasi-emulated-getpid"))
|
||||
return true;
|
||||
if (eqlIgnoreCase(ignore_case, name, "wasi-emulated-mman"))
|
||||
return true;
|
||||
if (eqlIgnoreCase(ignore_case, name, "wasi-emulated-process-clocks"))
|
||||
return true;
|
||||
if (eqlIgnoreCase(ignore_case, name, "wasi-emulated-signal"))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (target.os.tag.isDarwin()) {
|
||||
if (eqlIgnoreCase(ignore_case, name, "System"))
|
||||
return true;
|
||||
if (eqlIgnoreCase(ignore_case, name, "c"))
|
||||
return true;
|
||||
if (eqlIgnoreCase(ignore_case, name, "dbm"))
|
||||
return true;
|
||||
if (eqlIgnoreCase(ignore_case, name, "dl"))
|
||||
|
||||
16
src/main.zig
16
src/main.zig
@ -3824,6 +3824,15 @@ 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);
|
||||
create_module.opts.link_libc = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (std.zig.target.isLibCLibName(target, lib_name)) {
|
||||
create_module.opts.link_libc = true;
|
||||
continue;
|
||||
@ -3832,6 +3841,7 @@ fn createModule(
|
||||
create_module.opts.link_libcpp = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (target_util.classifyCompilerRtLibName(lib_name)) {
|
||||
.none => {},
|
||||
.only_libunwind, .both => {
|
||||
@ -3857,12 +3867,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