| author | |
| committer | |
| log | d2398cf009bfc2f4274f1326b0ef7dfbb1ae8d7f |
| tree | b8c3ec300d9107240803c7aca731484b5ecea2b8 |
| parent | 0d006afb23aa5d0308adb56d2578b4340f34231e |
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.2 files changed, 15 insertions(+), 0 deletions(-)
src/main.zig+5| ... | @@ -1998,6 +1998,11 @@ fn buildOutputType( | ... | @@ -1998,6 +1998,11 @@ fn buildOutputType( |
| 1998 | _ = system_libs.orderedRemove(lib_name); | 1998 | _ = system_libs.orderedRemove(lib_name); |
| 1999 | continue; | 1999 | continue; |
| 2000 | } | 2000 | } |
| 2001 | if (target_util.is_compiler_rt_lib_name(target_info.target, lib_name)) { | ||
| 2002 | std.log.warn("ignoring superfluous library '{s}': this dependency is fulfilled instead by compiler-rt which zig unconditionally provides", .{lib_name}); | ||
| 2003 | _ = system_libs.orderedRemove(lib_name); | ||
| 2004 | continue; | ||
| 2005 | } | ||
| 2001 | if (std.fs.path.isAbsolute(lib_name)) { | 2006 | if (std.fs.path.isAbsolute(lib_name)) { |
| 2002 | fatal("cannot use absolute path as a system library: {s}", .{lib_name}); | 2007 | fatal("cannot use absolute path as a system library: {s}", .{lib_name}); |
| 2003 | } | 2008 | } |
src/target.zig+10| ... | @@ -427,6 +427,16 @@ pub fn is_libcpp_lib_name(target: std.Target, name: []const u8) bool { | ... | @@ -427,6 +427,16 @@ pub fn is_libcpp_lib_name(target: std.Target, name: []const u8) bool { |
| 427 | eqlIgnoreCase(ignore_case, name, "c++abi"); | 427 | eqlIgnoreCase(ignore_case, name, "c++abi"); |
| 428 | } | 428 | } |
| 429 | 429 | ||
| 430 | pub fn is_compiler_rt_lib_name(target: std.Target, name: []const u8) bool { | ||
| 431 | if (target.abi.isGnu() and std.mem.eql(u8, name, "gcc_s")) { | ||
| 432 | return true; | ||
| 433 | } | ||
| 434 | if (std.mem.eql(u8, name, "compiler_rt")) { | ||
| 435 | return true; | ||
| 436 | } | ||
| 437 | return false; | ||
| 438 | } | ||
| 439 | |||
| 430 | pub fn hasDebugInfo(target: std.Target) bool { | 440 | pub fn hasDebugInfo(target: std.Target) bool { |
| 431 | return !target.cpu.arch.isWasm(); | 441 | return !target.cpu.arch.isWasm(); |
| 432 | } | 442 | } |