| ... | @@ -1111,12 +1111,6 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { | ... | @@ -1111,12 +1111,6 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { |
| 1111 | return error.StackProtectorUnavailableWithoutLibC; | 1111 | return error.StackProtectorUnavailableWithoutLibC; |
| 1112 | } | 1112 | } |
| 1113 | | 1113 | |
| 1114 | const valgrind: bool = b: { | | |
| 1115 | if (!target_util.hasValgrindSupport(options.target)) | | |
| 1116 | break :b false; | | |
| 1117 | break :b options.want_valgrind orelse (options.optimize_mode == .Debug); | | |
| 1118 | }; | | |
| 1119 | | | |
| 1120 | const include_compiler_rt = options.want_compiler_rt orelse needs_c_symbols; | 1114 | const include_compiler_rt = options.want_compiler_rt orelse needs_c_symbols; |
| 1121 | | 1115 | |
| 1122 | const must_single_thread = target_util.isSingleThreaded(options.target); | 1116 | const must_single_thread = target_util.isSingleThreaded(options.target); |
| ... | @@ -1159,6 +1153,15 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { | ... | @@ -1159,6 +1153,15 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { |
| 1159 | } | 1153 | } |
| 1160 | | 1154 | |
| 1161 | const strip = options.strip orelse !target_util.hasDebugInfo(options.target); | 1155 | const strip = options.strip orelse !target_util.hasDebugInfo(options.target); |
| | 1156 | const valgrind: bool = b: { |
| | 1157 | if (!target_util.hasValgrindSupport(options.target)) break :b false; |
| | 1158 | if (options.want_valgrind) |explicit| break :b explicit; |
| | 1159 | if (strip) break :b false; |
| | 1160 | break :b options.optimize_mode == .Debug; |
| | 1161 | }; |
| | 1162 | if (!valgrind and options.want_valgrind == true) |
| | 1163 | return error.ValgrindUnsupportedOnTarget; |
| | 1164 | |
| 1162 | const red_zone = options.want_red_zone orelse target_util.hasRedZone(options.target); | 1165 | const red_zone = options.want_red_zone orelse target_util.hasRedZone(options.target); |
| 1163 | const omit_frame_pointer = options.omit_frame_pointer orelse (options.optimize_mode != .Debug); | 1166 | const omit_frame_pointer = options.omit_frame_pointer orelse (options.optimize_mode != .Debug); |
| 1164 | const linker_optimization: u8 = options.linker_optimization orelse switch (options.optimize_mode) { | 1167 | const linker_optimization: u8 = options.linker_optimization orelse switch (options.optimize_mode) { |