Commit ade570f0d5

Alex Rønne Petersen <alex@alexrp.com>
2025-08-25 02:44:57
zig cc: don't pass -mcmodel for assembly files
It does nothing but generate a warning for these.
1 parent 91040b5
Changed files (1)
src/Compilation.zig
@@ -6838,10 +6838,6 @@ pub fn addCCArgs(
         try argv.append("-municode");
     }
 
-    if (mod.code_model != .default) {
-        try argv.append(try std.fmt.allocPrint(arena, "-mcmodel={s}", .{@tagName(mod.code_model)}));
-    }
-
     try argv.ensureUnusedCapacity(2);
     switch (comp.config.debug_format) {
         .strip => {},
@@ -7136,6 +7132,10 @@ pub fn addCCArgs(
         .ll,
         .bc,
         => {
+            if (mod.code_model != .default) {
+                try argv.append(try std.fmt.allocPrint(arena, "-mcmodel={s}", .{@tagName(mod.code_model)}));
+            }
+
             if (target_util.clangSupportsTargetCpuArg(target)) {
                 if (target.cpu.model.llvm_name) |llvm_name| {
                     try argv.appendSlice(&[_][]const u8{