diff --git a/src/clang_options_data.zig b/src/clang_options_data.zig index f2f3708d4d..ad07b45500 100644 --- a/src/clang_options_data.zig +++ b/src/clang_options_data.zig @@ -1984,7 +1984,7 @@ flagpsl("MT"), .{ .name = "rtlib", .syntax = .separate, - .zig_equivalent = .other, + .zig_equivalent = .rtlib, .pd1 = false, .pd2 = true, .psl = false, @@ -7331,7 +7331,7 @@ jspd1("iquote"), .{ .name = "rtlib=", .syntax = .joined, - .zig_equivalent = .other, + .zig_equivalent = .rtlib, .pd1 = true, .pd2 = true, .psl = false, diff --git a/src/main.zig b/src/main.zig index 1db2be6f25..0e7a801b46 100644 --- a/src/main.zig +++ b/src/main.zig @@ -2180,6 +2180,19 @@ fn buildOutputType( fatal("unsupported -undefined option '{s}'", .{it.only_arg}); } }, + .rtlib => { + // Unlike Clang, we support `none` for explicitly omitting compiler-rt. + if (mem.eql(u8, "none", it.only_arg)) { + want_compiler_rt = false; + } else if (mem.eql(u8, "compiler-rt", it.only_arg) or + mem.eql(u8, "libgcc", it.only_arg)) + { + want_compiler_rt = true; + } else { + // Note that we don't support `platform`. + fatal("unsupported -rtlib option '{s}'", .{it.only_arg}); + } + }, } } // Parse linker args. @@ -5810,6 +5823,7 @@ pub const ClangArgIterator = struct { san_cov_trace_pc_guard, san_cov, no_san_cov, + rtlib, }; const Args = struct { diff --git a/tools/update_clang_options.zig b/tools/update_clang_options.zig index 69f4d58974..f21993fbd6 100644 --- a/tools/update_clang_options.zig +++ b/tools/update_clang_options.zig @@ -548,6 +548,14 @@ const known_options = [_]KnownOpt{ .name = "fno-sanitize-coverage", .ident = "no_san_cov", }, + .{ + .name = "rtlib", + .ident = "rtlib", + }, + .{ + .name = "rtlib=", + .ident = "rtlib", + }, }; const blacklisted_options = [_][]const u8{};