From 39abcc303c471c0180cdb0f5dce4303bbbe45362 Mon Sep 17 00:00:00 2001 From: Alex Rønne Petersen Date: Fri, 4 Oct 2024 20:25:13 +0200 Subject: Compilation: Pass -fno-PIC to clang if PIC is disabled. Let's not implicitly rely on whatever Clang's default is. --- src/Compilation.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Compilation.zig') diff --git a/src/Compilation.zig b/src/Compilation.zig index 7777aa1371..7c08b74b04 100644 --- a/src/Compilation.zig +++ b/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); -- cgit v1.2.3