wasi: Build emulated libraries into libc.a
This matches what we do for small helper libraries like this in MinGW-w64. It simplifies the compiler a bit, and also means the build system doesn't have to treat these library names specially. Closes #24325.
This commit is contained in:
@@ -234,7 +234,6 @@ fuzzer_lib: ?CrtFile = null,
|
||||
glibc_so_files: ?glibc.BuiltSharedObjects = null,
|
||||
freebsd_so_files: ?freebsd.BuiltSharedObjects = null,
|
||||
netbsd_so_files: ?netbsd.BuiltSharedObjects = null,
|
||||
wasi_emulated_libs: []const wasi_libc.CrtFile,
|
||||
|
||||
/// For example `Scrt1.o` and `libc_nonshared.a`. These are populated after building libc from source,
|
||||
/// The set of needed CRT (C runtime) files differs depending on the target and compilation settings.
|
||||
@@ -1567,12 +1566,6 @@ pub const CreateOptions = struct {
|
||||
framework_dirs: []const []const u8 = &[0][]const u8{},
|
||||
frameworks: []const Framework = &.{},
|
||||
windows_lib_names: []const []const u8 = &.{},
|
||||
/// These correspond to the WASI libc emulated subcomponents including:
|
||||
/// * process clocks
|
||||
/// * getpid
|
||||
/// * mman
|
||||
/// * signal
|
||||
wasi_emulated_libs: []const wasi_libc.CrtFile = &.{},
|
||||
/// This means that if the output mode is an executable it will be a
|
||||
/// Position Independent Executable. If the output mode is not an
|
||||
/// executable this field is ignored.
|
||||
@@ -2055,7 +2048,6 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil
|
||||
.function_sections = options.function_sections,
|
||||
.data_sections = options.data_sections,
|
||||
.native_system_include_paths = options.native_system_include_paths,
|
||||
.wasi_emulated_libs = options.wasi_emulated_libs,
|
||||
.force_undefined_symbols = options.force_undefined_symbols,
|
||||
.link_eh_frame_hdr = link_eh_frame_hdr,
|
||||
.global_cc_argv = options.global_cc_argv,
|
||||
@@ -2384,11 +2376,6 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil
|
||||
} else if (target.isWasiLibC()) {
|
||||
if (!std.zig.target.canBuildLibC(target)) return error.LibCUnavailable;
|
||||
|
||||
for (comp.wasi_emulated_libs) |crt_file| {
|
||||
comp.queued_jobs.wasi_libc_crt_file[@intFromEnum(crt_file)] = true;
|
||||
}
|
||||
comp.link_task_queue.pending_prelink_tasks += @intCast(comp.wasi_emulated_libs.len);
|
||||
|
||||
comp.queued_jobs.wasi_libc_crt_file[@intFromEnum(wasi_libc.execModelCrtFile(comp.config.wasi_exec_model))] = true;
|
||||
comp.queued_jobs.wasi_libc_crt_file[@intFromEnum(wasi_libc.CrtFile.libc_a)] = true;
|
||||
comp.link_task_queue.pending_prelink_tasks += 2;
|
||||
|
||||
Reference in New Issue
Block a user