mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 14:23:09 +00:00
Merge pull request #23572 from alexrp/zig-cc-static-dynamic
This commit is contained in:
commit
99a79f98ec
@ -2610,7 +2610,14 @@ flagpd1("dwarf-ext-refs"),
|
|||||||
},
|
},
|
||||||
sepd1("dylib_file"),
|
sepd1("dylib_file"),
|
||||||
flagpd1("dylinker"),
|
flagpd1("dylinker"),
|
||||||
flagpd1("dynamic"),
|
.{
|
||||||
|
.name = "dynamic",
|
||||||
|
.syntax = .flag,
|
||||||
|
.zig_equivalent = .dynamic,
|
||||||
|
.pd1 = true,
|
||||||
|
.pd2 = false,
|
||||||
|
.psl = false,
|
||||||
|
},
|
||||||
.{
|
.{
|
||||||
.name = "dynamiclib",
|
.name = "dynamiclib",
|
||||||
.syntax = .flag,
|
.syntax = .flag,
|
||||||
@ -5698,7 +5705,7 @@ flagpd1("startfiles"),
|
|||||||
.{
|
.{
|
||||||
.name = "static",
|
.name = "static",
|
||||||
.syntax = .flag,
|
.syntax = .flag,
|
||||||
.zig_equivalent = .other,
|
.zig_equivalent = .static,
|
||||||
.pd1 = true,
|
.pd1 = true,
|
||||||
.pd2 = true,
|
.pd2 = true,
|
||||||
.psl = false,
|
.psl = false,
|
||||||
|
|||||||
13
src/main.zig
13
src/main.zig
@ -2348,6 +2348,16 @@ fn buildOutputType(
|
|||||||
fatal("unsupported -rtlib option '{s}'", .{it.only_arg});
|
fatal("unsupported -rtlib option '{s}'", .{it.only_arg});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
.static => {
|
||||||
|
create_module.opts.link_mode = .static;
|
||||||
|
lib_preferred_mode = .static;
|
||||||
|
lib_search_strategy = .no_fallback;
|
||||||
|
},
|
||||||
|
.dynamic => {
|
||||||
|
create_module.opts.link_mode = .dynamic;
|
||||||
|
lib_preferred_mode = .dynamic;
|
||||||
|
lib_search_strategy = .mode_first;
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Parse linker args.
|
// Parse linker args.
|
||||||
@ -4111,7 +4121,6 @@ fn createModule(
|
|||||||
color,
|
color,
|
||||||
) catch |err| fatal("failed to resolve link inputs: {s}", .{@errorName(err)});
|
) catch |err| fatal("failed to resolve link inputs: {s}", .{@errorName(err)});
|
||||||
|
|
||||||
if (create_module.windows_libs.count() != 0) create_module.opts.any_dyn_libs = true;
|
|
||||||
if (!create_module.opts.any_dyn_libs) for (create_module.link_inputs.items) |item| switch (item) {
|
if (!create_module.opts.any_dyn_libs) for (create_module.link_inputs.items) |item| switch (item) {
|
||||||
.dso, .dso_exact => {
|
.dso, .dso_exact => {
|
||||||
create_module.opts.any_dyn_libs = true;
|
create_module.opts.any_dyn_libs = true;
|
||||||
@ -5978,6 +5987,8 @@ pub const ClangArgIterator = struct {
|
|||||||
san_cov,
|
san_cov,
|
||||||
no_san_cov,
|
no_san_cov,
|
||||||
rtlib,
|
rtlib,
|
||||||
|
static,
|
||||||
|
dynamic,
|
||||||
};
|
};
|
||||||
|
|
||||||
const Args = struct {
|
const Args = struct {
|
||||||
|
|||||||
@ -572,6 +572,14 @@ const known_options = [_]KnownOpt{
|
|||||||
.name = "rtlib=",
|
.name = "rtlib=",
|
||||||
.ident = "rtlib",
|
.ident = "rtlib",
|
||||||
},
|
},
|
||||||
|
.{
|
||||||
|
.name = "static",
|
||||||
|
.ident = "static",
|
||||||
|
},
|
||||||
|
.{
|
||||||
|
.name = "dynamic",
|
||||||
|
.ident = "dynamic",
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const blacklisted_options = [_][]const u8{};
|
const blacklisted_options = [_][]const u8{};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user