authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-09-08 01:38:44+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-09-09 10:47:35-07:00
log95bb53653d11e62e3bfb9de6b3668ac0c1c466f5
tree68c50f6b254cd780fe76f3e94613dfecce3ddd4e
parentde8cece6e7be570a7e622c54c0cbbc7c99308a08

zig cc: Support `-rtlib=none` for disabling compiler-rt.


3 files changed, 24 insertions(+), 2 deletions(-)

src/clang_options_data.zig+2-2
......@@ -1984,7 +1984,7 @@ flagpsl("MT"),
19841984.{
19851985 .name = "rtlib",
19861986 .syntax = .separate,
1987 .zig_equivalent = .other,
1987 .zig_equivalent = .rtlib,
19881988 .pd1 = false,
19891989 .pd2 = true,
19901990 .psl = false,
......@@ -7331,7 +7331,7 @@ jspd1("iquote"),
73317331.{
73327332 .name = "rtlib=",
73337333 .syntax = .joined,
7334 .zig_equivalent = .other,
7334 .zig_equivalent = .rtlib,
73357335 .pd1 = true,
73367336 .pd2 = true,
73377337 .psl = false,
src/main.zig+14
......@@ -2180,6 +2180,19 @@ fn buildOutputType(
21802180 fatal("unsupported -undefined option '{s}'", .{it.only_arg});
21812181 }
21822182 },
2183 .rtlib => {
2184 // Unlike Clang, we support `none` for explicitly omitting compiler-rt.
2185 if (mem.eql(u8, "none", it.only_arg)) {
2186 want_compiler_rt = false;
2187 } else if (mem.eql(u8, "compiler-rt", it.only_arg) or
2188 mem.eql(u8, "libgcc", it.only_arg))
2189 {
2190 want_compiler_rt = true;
2191 } else {
2192 // Note that we don't support `platform`.
2193 fatal("unsupported -rtlib option '{s}'", .{it.only_arg});
2194 }
2195 },
21832196 }
21842197 }
21852198 // Parse linker args.
......@@ -5810,6 +5823,7 @@ pub const ClangArgIterator = struct {
58105823 san_cov_trace_pc_guard,
58115824 san_cov,
58125825 no_san_cov,
5826 rtlib,
58135827 };
58145828
58155829 const Args = struct {
tools/update_clang_options.zig+8
......@@ -548,6 +548,14 @@ const known_options = [_]KnownOpt{
548548 .name = "fno-sanitize-coverage",
549549 .ident = "no_san_cov",
550550 },
551 .{
552 .name = "rtlib",
553 .ident = "rtlib",
554 },
555 .{
556 .name = "rtlib=",
557 .ident = "rtlib",
558 },
551559};
552560
553561const blacklisted_options = [_][]const u8{};