From 569182dbb259b2b5cfb457e798407d8ec2eacc2d Mon Sep 17 00:00:00 2001 From: Michael Dusan Date: Fri, 10 Nov 2023 14:56:46 -0500 Subject: [PATCH] compilation: forbid PIE for dynamic libraries but allow for { .exe, .o, .a }. closes #17928 --- src/Compilation.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Compilation.zig b/src/Compilation.zig index 6db84a7d67..529ba9d33b 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -1288,7 +1288,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { const sysroot = options.sysroot orelse libc_dirs.sysroot; const pie: bool = pie: { - if (options.output_mode != .Exe) { + if (is_dyn_lib) { if (options.want_pie == true) return error.OutputModeForbidsPie; break :pie false; }