| author | |
| committer | |
| log | 7cd2c1ce8770ccd3bb5a9d9c79baf4d0013ab0c8 |
| tree | 54d5a06f7c71e3e8c2d2564c21d022752467fb63 |
| parent | 589f4e91708366ddff9ee6793d5f88b05a260959 |
| parent | c9e74bb9aa6d17993e3c8e922963601a00b405bc |
| signature |
`std.zig.target`: Teach `isLibCLibName()` about emulated wasi-libc libraries2 files changed, 21 insertions(+), 8 deletions(-)
lib/std/zig/target.zig+11-2| ... | ... | @@ -218,13 +218,22 @@ pub fn isLibCLibName(target: std.Target, name: []const u8) bool { |
| 218 | 218 | return true; |
| 219 | 219 | if (eqlIgnoreCase(ignore_case, name, "xnet")) |
| 220 | 220 | return true; |
| 221 | ||
| 222 | if (target.os.tag == .wasi) { | |
| 223 | if (eqlIgnoreCase(ignore_case, name, "wasi-emulated-getpid")) | |
| 224 | return true; | |
| 225 | if (eqlIgnoreCase(ignore_case, name, "wasi-emulated-mman")) | |
| 226 | return true; | |
| 227 | if (eqlIgnoreCase(ignore_case, name, "wasi-emulated-process-clocks")) | |
| 228 | return true; | |
| 229 | if (eqlIgnoreCase(ignore_case, name, "wasi-emulated-signal")) | |
| 230 | return true; | |
| 231 | } | |
| 221 | 232 | } |
| 222 | 233 | |
| 223 | 234 | if (target.os.tag.isDarwin()) { |
| 224 | 235 | if (eqlIgnoreCase(ignore_case, name, "System")) |
| 225 | 236 | return true; |
| 226 | if (eqlIgnoreCase(ignore_case, name, "c")) | |
| 227 | return true; | |
| 228 | 237 | if (eqlIgnoreCase(ignore_case, name, "dbm")) |
| 229 | 238 | return true; |
| 230 | 239 | if (eqlIgnoreCase(ignore_case, name, "dl")) |
src/main.zig+10-6| ... | ... | @@ -3824,6 +3824,15 @@ fn createModule( |
| 3824 | 3824 | for (create_module.cli_link_inputs.items) |cli_link_input| switch (cli_link_input) { |
| 3825 | 3825 | .name_query => |nq| { |
| 3826 | 3826 | const lib_name = nq.name; |
| 3827 | ||
| 3828 | if (target.os.tag == .wasi) { | |
| 3829 | if (wasi_libc.getEmulatedLibCrtFile(lib_name)) |crt_file| { | |
| 3830 | try create_module.wasi_emulated_libs.append(arena, crt_file); | |
| 3831 | create_module.opts.link_libc = true; | |
| 3832 | continue; | |
| 3833 | } | |
| 3834 | } | |
| 3835 | ||
| 3827 | 3836 | if (std.zig.target.isLibCLibName(target, lib_name)) { |
| 3828 | 3837 | create_module.opts.link_libc = true; |
| 3829 | 3838 | continue; |
| ... | ... | @@ -3832,6 +3841,7 @@ fn createModule( |
| 3832 | 3841 | create_module.opts.link_libcpp = true; |
| 3833 | 3842 | continue; |
| 3834 | 3843 | } |
| 3844 | ||
| 3835 | 3845 | switch (target_util.classifyCompilerRtLibName(lib_name)) { |
| 3836 | 3846 | .none => {}, |
| 3837 | 3847 | .only_libunwind, .both => { |
| ... | ... | @@ -3857,12 +3867,6 @@ fn createModule( |
| 3857 | 3867 | fatal("cannot use absolute path as a system library: {s}", .{lib_name}); |
| 3858 | 3868 | } |
| 3859 | 3869 | |
| 3860 | if (target.os.tag == .wasi) { | |
| 3861 | if (wasi_libc.getEmulatedLibCrtFile(lib_name)) |crt_file| { | |
| 3862 | try create_module.wasi_emulated_libs.append(arena, crt_file); | |
| 3863 | continue; | |
| 3864 | } | |
| 3865 | } | |
| 3866 | 3870 | unresolved_link_inputs.appendAssumeCapacity(cli_link_input); |
| 3867 | 3871 | any_name_queries_remaining = true; |
| 3868 | 3872 | }, |