From 2836cd5fbdcbb22b1e03c01005e0e09777c5475f Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 9 Feb 2022 11:36:30 -0700 Subject: 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. --- src/target.zig | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/target.zig') diff --git a/src/target.zig b/src/target.zig index 2c21fb5c61..63bd1db0b5 100644 --- a/src/target.zig +++ b/src/target.zig @@ -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(); } -- cgit v1.2.3