aboutsummaryrefslogtreecommitdiff
path: root/src/Compilation.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-01-05 17:26:32 -0700
committerGitHub <noreply@github.com>2023-01-05 17:26:32 -0700
commitc28c38d1e5648a45e8b3b2edbd1c732edb8d2642 (patch)
tree9e151a988b4196a57fe51cd34515cbe1090cc6a2 /src/Compilation.zig
parent301a89849b1f80afb01bebf1288afd767aea7122 (diff)
parent25e6187d28813c0f5227095b927374d901c6004b (diff)
downloadzig-c28c38d1e5648a45e8b3b2edbd1c732edb8d2642.tar.gz
zig-c28c38d1e5648a45e8b3b2edbd1c732edb8d2642.zip
Merge pull request #13514 from kcbanner/windows_build_fixes
Windows: Support building stage3, and bootstrapping via MSVC
Diffstat (limited to 'src/Compilation.zig')
-rw-r--r--src/Compilation.zig19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig
index e365d1dab2..f90b8f28d1 100644
--- a/src/Compilation.zig
+++ b/src/Compilation.zig
@@ -984,6 +984,7 @@ pub const InitOptions = struct {
linker_dynamicbase: bool = false,
linker_optimization: ?u8 = null,
linker_compress_debug_sections: ?link.CompressDebugSections = null,
+ linker_module_definition_file: ?[]const u8 = null,
major_subsystem_version: ?u32 = null,
minor_subsystem_version: ?u32 = null,
clang_passthrough_mode: bool = false,
@@ -1041,6 +1042,11 @@ pub const InitOptions = struct {
/// (Darwin) remove dylibs that are unreachable by the entry point or exported symbols
dead_strip_dylibs: bool = false,
libcxx_abi_version: libcxx.AbiVersion = libcxx.AbiVersion.default,
+ /// (Windows) PDB source path prefix to instruct the linker how to resolve relative
+ /// paths when consolidating CodeView streams into a single PDB file.
+ pdb_source_path: ?[]const u8 = null,
+ /// (Windows) PDB output path
+ pdb_out_path: ?[]const u8 = null,
};
fn addPackageTableToCacheHash(
@@ -1815,6 +1821,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
.allow_shlib_undefined = options.linker_allow_shlib_undefined,
.bind_global_refs_locally = options.linker_bind_global_refs_locally orelse false,
.compress_debug_sections = options.linker_compress_debug_sections orelse .none,
+ .module_definition_file = options.linker_module_definition_file,
.import_memory = options.linker_import_memory orelse false,
.import_symbols = options.linker_import_symbols,
.import_table = options.linker_import_table,
@@ -1890,6 +1897,8 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
.headerpad_max_install_names = options.headerpad_max_install_names,
.dead_strip_dylibs = options.dead_strip_dylibs,
.force_undefined_symbols = .{},
+ .pdb_source_path = options.pdb_source_path,
+ .pdb_out_path = options.pdb_out_path,
});
errdefer bin_file.destroy();
comp.* = .{
@@ -3297,8 +3306,8 @@ fn processOneJob(comp: *Compilation, job: Job) !void {
// TODO Surface more error details.
comp.lockAndSetMiscFailure(
.windows_import_lib,
- "unable to generate DLL import .lib file: {s}",
- .{@errorName(err)},
+ "unable to generate DLL import .lib file for {s}: {s}",
+ .{ link_lib, @errorName(err) },
);
};
},
@@ -4379,7 +4388,7 @@ pub fn addCCArgs(
try argv.append("-fno-unwind-tables");
}
},
- .shared_library, .ll, .bc, .unknown, .static_library, .object, .zig => {},
+ .shared_library, .ll, .bc, .unknown, .static_library, .object, .def, .zig => {},
.assembly => {
// The Clang assembler does not accept the list of CPU features like the
// compiler frontend does. Therefore we must hard-code the -m flags for
@@ -4524,6 +4533,7 @@ pub const FileExt = enum {
object,
static_library,
zig,
+ def,
unknown,
pub fn clangSupportsDepFile(ext: FileExt) bool {
@@ -4537,6 +4547,7 @@ pub const FileExt = enum {
.object,
.static_library,
.zig,
+ .def,
.unknown,
=> false,
};
@@ -4629,6 +4640,8 @@ pub fn classifyFileExt(filename: []const u8) FileExt {
return .object;
} else if (mem.endsWith(u8, filename, ".cu")) {
return .cu;
+ } else if (mem.endsWith(u8, filename, ".def")) {
+ return .def;
} else {
return .unknown;
}