aboutsummaryrefslogtreecommitdiff
path: root/src/target.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-02-09 11:36:30 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-02-09 11:38:33 -0700
commit2836cd5fbdcbb22b1e03c01005e0e09777c5475f (patch)
treee0410656d83b3ed802211e201902e4f0d08f917a /src/target.zig
parentdb56d74a3bc9c6240d24838753a7042ba91501a1 (diff)
downloadzig-2836cd5fbdcbb22b1e03c01005e0e09777c5475f.tar.gz
zig-2836cd5fbdcbb22b1e03c01005e0e09777c5475f.zip
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.
Diffstat (limited to 'src/target.zig')
-rw-r--r--src/target.zig10
1 files changed, 10 insertions, 0 deletions
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();
}