From b2b87b590011d8df52874e3f9bd1f88d1b0189d1 Mon Sep 17 00:00:00 2001 From: Robin Voetter Date: Tue, 19 Jan 2021 00:34:44 +0100 Subject: SPIR-V: Linking and codegen setup --- src/main.zig | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/main.zig') diff --git a/src/main.zig b/src/main.zig index 13bea13a5e..a86ec4ccf5 100644 --- a/src/main.zig +++ b/src/main.zig @@ -302,6 +302,7 @@ const usage_build_generic = \\ pe Portable Executable (Windows) \\ coff Common Object File Format (Windows) \\ macho macOS relocatables + \\ spirv Standard, Portable Intermediate Representation V (SPIR-V) \\ hex (planned) Intel IHEX \\ raw (planned) Dump machine code directly \\ -dirafter [dir] Add directory to AFTER include search path @@ -1515,6 +1516,8 @@ fn buildOutputType( break :blk .hex; } else if (mem.eql(u8, ofmt, "raw")) { break :blk .raw; + } else if (mem.eql(u8, ofmt, "spirv")) { + break :blk .spirv; } else { fatal("unsupported object format: {s}", .{ofmt}); } -- cgit v1.2.3 From fc79cbcc80c67dac5c44697ab1b3ec7b548c715c Mon Sep 17 00:00:00 2001 From: Mitchell Kember Date: Fri, 5 Feb 2021 02:45:25 -0500 Subject: Use -isysroot on Catalina too, not just Big Sur This amends #7506 to apply to macOS versions since Catalina (10.15), rather than since Big Sur (11.0). --- src/main.zig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/main.zig') diff --git a/src/main.zig b/src/main.zig index bfe0d6786b..14f63d9911 100644 --- a/src/main.zig +++ b/src/main.zig @@ -1536,8 +1536,9 @@ fn buildOutputType( } const has_sysroot = if (comptime std.Target.current.isDarwin()) outer: { - const at_least_big_sur = target_info.target.os.getVersionRange().semver.min.major >= 11; - if (at_least_big_sur) { + const min = target_info.target.os.getVersionRange().semver.min; + const at_least_catalina = min.major >= 11 or (min.major >= 10 and min.minor >= 15); + if (at_least_catalina) { const sdk_path = try std.zig.system.getSDKPath(arena); try clang_argv.ensureCapacity(clang_argv.items.len + 2); clang_argv.appendAssumeCapacity("-isysroot"); -- cgit v1.2.3 From e197a03124527035f1a92381eb6ef46d6f6d2c39 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sun, 7 Feb 2021 14:51:27 -0700 Subject: zig cc: recognize the `-s` flag to be "strip" --- src/Compilation.zig | 4 +++- src/clang_options_data.zig | 9 ++++++++- src/main.zig | 2 ++ tools/update_clang_options.zig | 4 ++++ 4 files changed, 17 insertions(+), 2 deletions(-) (limited to 'src/main.zig') diff --git a/src/Compilation.zig b/src/Compilation.zig index c7bb260aa7..268c259c02 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -2348,7 +2348,9 @@ pub fn addCCArgs( else => {}, } - if (!comp.bin_file.options.strip) { + if (comp.bin_file.options.strip) { + try argv.append("-s"); + } else { try argv.append("-g"); switch (comp.bin_file.options.object_format) { .coff, .pe => try argv.append("-gcodeview"), diff --git a/src/clang_options_data.zig b/src/clang_options_data.zig index 4d89308545..0293a5327e 100644 --- a/src/clang_options_data.zig +++ b/src/clang_options_data.zig @@ -4305,7 +4305,14 @@ flagpd1("rewrite-macros"), flagpd1("rewrite-objc"), flagpd1("rewrite-test"), sepd1("rpath"), -flagpd1("s"), +.{ + .name = "s", + .syntax = .flag, + .zig_equivalent = .strip, + .pd1 = true, + .pd2 = false, + .psl = false, +}, .{ .name = "save-stats", .syntax = .flag, diff --git a/src/main.zig b/src/main.zig index 14f63d9911..c31252a96a 100644 --- a/src/main.zig +++ b/src/main.zig @@ -1186,6 +1186,7 @@ fn buildOutputType( .framework_dir => try framework_dirs.append(it.only_arg), .framework => try frameworks.append(it.only_arg), .nostdlibinc => want_native_include_dirs = false, + .strip => strip = true, } } // Parse linker args. @@ -3047,6 +3048,7 @@ pub const ClangArgIterator = struct { nostdlibinc, red_zone, no_red_zone, + strip, }; const Args = struct { diff --git a/tools/update_clang_options.zig b/tools/update_clang_options.zig index 2aeee6845b..1cb134a731 100644 --- a/tools/update_clang_options.zig +++ b/tools/update_clang_options.zig @@ -312,6 +312,10 @@ const known_options = [_]KnownOpt{ .name = "framework", .ident = "framework", }, + .{ + .name = "s", + .ident = "strip", + }, }; const blacklisted_options = [_][]const u8{}; -- cgit v1.2.3