Commit 569182dbb2

Michael Dusan <michael.dusan@gmail.com>
2023-11-10 20:56:46
compilation: forbid PIE for dynamic libraries
but allow for { .exe, .o, .a }. closes #17928
1 parent 5de0636
Changed files (1)
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;
             }