Commit 39abcc303c

Alex Rønne Petersen <alex@alexrp.com>
2024-10-04 20:25:13
Compilation: Pass -fno-PIC to clang if PIC is disabled.
Let's not implicitly rely on whatever Clang's default is.
1 parent c9e67e7
Changed files (1)
src/Compilation.zig
@@ -5628,8 +5628,8 @@ pub fn addCCArgs(
         try argv.append("-mthumb");
     }
 
-    if (target_util.supports_fpic(target) and mod.pic) {
-        try argv.append("-fPIC");
+    if (target_util.supports_fpic(target)) {
+        try argv.append(if (mod.pic) "-fPIC" else "-fno-PIC");
     }
 
     try argv.ensureUnusedCapacity(2);