mirror of
https://github.com/ziglang/zig.git
synced 2024-11-15 00:26:57 +00:00
CLI: ignore -lgcc_s when it is redundant with compiler-rt
For some projects, they can't help themselves, -lgcc_s ends up on the compiler command line even though it does not belong there. In Zig we know what -lgcc_s does. It's an alternative to compiler-rt. With this commit we emit a warning telling that it is unnecessary to put such thing on the command line, and happily ignore it, since we will fulfill the dependency with compiler-rt.
This commit is contained in:
parent
0d006afb23
commit
d2398cf009
@ -1998,6 +1998,11 @@ fn buildOutputType(
|
||||
_ = system_libs.orderedRemove(lib_name);
|
||||
continue;
|
||||
}
|
||||
if (target_util.is_compiler_rt_lib_name(target_info.target, lib_name)) {
|
||||
std.log.warn("ignoring superfluous library '{s}': this dependency is fulfilled instead by compiler-rt which zig unconditionally provides", .{lib_name});
|
||||
_ = system_libs.orderedRemove(lib_name);
|
||||
continue;
|
||||
}
|
||||
if (std.fs.path.isAbsolute(lib_name)) {
|
||||
fatal("cannot use absolute path as a system library: {s}", .{lib_name});
|
||||
}
|
||||
|
@ -427,6 +427,16 @@ pub fn is_libcpp_lib_name(target: std.Target, name: []const u8) bool {
|
||||
eqlIgnoreCase(ignore_case, name, "c++abi");
|
||||
}
|
||||
|
||||
pub fn is_compiler_rt_lib_name(target: std.Target, name: []const u8) bool {
|
||||
if (target.abi.isGnu() and std.mem.eql(u8, name, "gcc_s")) {
|
||||
return true;
|
||||
}
|
||||
if (std.mem.eql(u8, name, "compiler_rt")) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
pub fn hasDebugInfo(target: std.Target) bool {
|
||||
return !target.cpu.arch.isWasm();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user