| ... | ... | @@ -1037,13 +1037,24 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { |
| 1037 | 1037 | |
| 1038 | 1038 | const sysroot = options.sysroot orelse libc_dirs.sysroot; |
| 1039 | 1039 | |
| 1040 | | const must_pie = target_util.requiresPIE(options.target); |
| 1041 | | const pie: bool = if (options.want_pie) |explicit| pie: { |
| 1042 | | if (!explicit and must_pie) { |
| 1043 | | return error.TargetRequiresPIE; |
| 1040 | const pie: bool = pie: { |
| 1041 | if (options.output_mode != .Exe) { |
| 1042 | if (options.want_pie == true) return error.OutputModeForbidsPie; |
| 1043 | break :pie false; |
| 1044 | 1044 | } |
| 1045 | | break :pie explicit; |
| 1046 | | } else must_pie or tsan; |
| 1045 | if (target_util.requiresPIE(options.target)) { |
| 1046 | if (options.want_pie == false) return error.TargetRequiresPie; |
| 1047 | break :pie true; |
| 1048 | } |
| 1049 | if (tsan) { |
| 1050 | if (options.want_pie == false) return error.TsanRequiresPie; |
| 1051 | break :pie true; |
| 1052 | } |
| 1053 | if (options.want_pie) |want_pie| { |
| 1054 | break :pie want_pie; |
| 1055 | } |
| 1056 | break :pie false; |
| 1057 | }; |
| 1047 | 1058 | |
| 1048 | 1059 | const must_pic: bool = b: { |
| 1049 | 1060 | if (target_util.requiresPIC(options.target, link_libc)) |
| ... | ... | @@ -6533,7 +6544,7 @@ fn buildOutputFromZig( |
| 6533 | 6544 | .want_tsan = false, |
| 6534 | 6545 | .want_unwind_tables = comp.bin_file.options.eh_frame_hdr, |
| 6535 | 6546 | .want_pic = comp.bin_file.options.pic, |
| 6536 | | .want_pie = comp.bin_file.options.pie, |
| 6547 | .want_pie = null, |
| 6537 | 6548 | .emit_h = null, |
| 6538 | 6549 | .strip = comp.compilerRtStrip(), |
| 6539 | 6550 | .is_native_os = comp.bin_file.options.is_native_os, |
| ... | ... | @@ -6608,7 +6619,7 @@ pub fn build_crt_file( |
| 6608 | 6619 | .want_valgrind = false, |
| 6609 | 6620 | .want_tsan = false, |
| 6610 | 6621 | .want_pic = comp.bin_file.options.pic, |
| 6611 | | .want_pie = comp.bin_file.options.pie, |
| 6622 | .want_pie = null, |
| 6612 | 6623 | .want_lto = switch (output_mode) { |
| 6613 | 6624 | .Lib => comp.bin_file.options.lto, |
| 6614 | 6625 | .Obj, .Exe => false, |