From 91a73a177bc20fa0219dbb6c3cf3dda1c2a465db Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 28 Sep 2020 00:06:06 -0700 Subject: stage2: building mingw-w64 and COFF LDD linking still TODO is the task of creating import .lib files for DLLs on the fly both for -lfoo and for e.g. `extern "kernel32"` --- src/link.zig | 55 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 28 insertions(+), 27 deletions(-) (limited to 'src/link.zig') diff --git a/src/link.zig b/src/link.zig index a0372da4a1..9112bd8d1d 100644 --- a/src/link.zig +++ b/src/link.zig @@ -36,7 +36,7 @@ pub const Options = struct { root_name: []const u8, /// Not every Compilation compiles .zig code! For example you could do `zig build-exe foo.o`. module: ?*Module, - dynamic_linker: ?[]const u8 = null, + dynamic_linker: ?[]const u8, /// Used for calculating how much space to reserve for symbols in case the binary file /// does not already have a symbol table. symbol_count_hint: u64 = 32, @@ -44,53 +44,54 @@ pub const Options = struct { /// the binary file does not already have such a section. program_code_size_hint: u64 = 256 * 1024, entry_addr: ?u64 = null, - stack_size_override: ?u64 = null, + stack_size_override: ?u64, /// Set to `true` to omit debug info. - strip: bool = false, + strip: bool, /// If this is true then this link code is responsible for outputting an object /// file and then using LLD to link it together with the link options and other objects. /// Otherwise (depending on `use_llvm`) this link code directly outputs and updates the final binary. - use_lld: bool = false, + use_lld: bool, /// If this is true then this link code is responsible for making an LLVM IR Module, /// outputting it to an object file, and then linking that together with link options and /// other objects. /// Otherwise (depending on `use_lld`) this link code directly outputs and updates the final binary. - use_llvm: bool = false, - link_libc: bool = false, - link_libcpp: bool = false, - function_sections: bool = false, - eh_frame_hdr: bool = false, - rdynamic: bool = false, - z_nodelete: bool = false, - z_defs: bool = false, + use_llvm: bool, + link_libc: bool, + link_libcpp: bool, + function_sections: bool, + eh_frame_hdr: bool, + rdynamic: bool, + z_nodelete: bool, + z_defs: bool, bind_global_refs_locally: bool, is_native_os: bool, pic: bool, valgrind: bool, stack_check: bool, single_threaded: bool, - verbose_link: bool = false, + verbose_link: bool, dll_export_fns: bool, error_return_tracing: bool, is_compiler_rt_or_libc: bool, each_lib_rpath: bool, disable_lld_caching: bool, + is_test: bool, gc_sections: ?bool = null, - allow_shlib_undefined: ?bool = null, - subsystem: ?std.Target.SubSystem = null, - linker_script: ?[]const u8 = null, - version_script: ?[]const u8 = null, - override_soname: ?[]const u8 = null, - llvm_cpu_features: ?[*:0]const u8 = null, + allow_shlib_undefined: ?bool, + subsystem: ?std.Target.SubSystem, + linker_script: ?[]const u8, + version_script: ?[]const u8, + override_soname: ?[]const u8, + llvm_cpu_features: ?[*:0]const u8, /// Extra args passed directly to LLD. Ignored when not linking with LLD. - extra_lld_args: []const []const u8 = &[0][]const u8, - - objects: []const []const u8 = &[0][]const u8{}, - framework_dirs: []const []const u8 = &[0][]const u8{}, - frameworks: []const []const u8 = &[0][]const u8{}, - system_libs: []const []const u8 = &[0][]const u8{}, - lib_dirs: []const []const u8 = &[0][]const u8{}, - rpath_list: []const []const u8 = &[0][]const u8{}, + extra_lld_args: []const []const u8, + + objects: []const []const u8, + framework_dirs: []const []const u8, + frameworks: []const []const u8, + system_libs: std.StringArrayHashMapUnmanaged(void), + lib_dirs: []const []const u8, + rpath_list: []const []const u8, version: ?std.builtin.Version, libc_installation: ?*const LibCInstallation, -- cgit v1.2.3