| ... | @@ -318,14 +318,6 @@ pub fn resolve(options: Options) ResolveError!Config { | ... | @@ -318,14 +318,6 @@ pub fn resolve(options: Options) ResolveError!Config { |
| 318 | break :b false; | 318 | break :b false; |
| 319 | }; | 319 | }; |
| 320 | | 320 | |
| 321 | var link_libunwind = b: { | | |
| 322 | if (link_libcpp and target_util.libCxxNeedsLibUnwind(target)) { | | |
| 323 | if (options.link_libunwind == false) return error.LibCppRequiresLibUnwind; | | |
| 324 | break :b true; | | |
| 325 | } | | |
| 326 | break :b options.link_libunwind orelse false; | | |
| 327 | }; | | |
| 328 | | | |
| 329 | const link_libc = b: { | 321 | const link_libc = b: { |
| 330 | if (target_util.osRequiresLibC(target)) { | 322 | if (target_util.osRequiresLibC(target)) { |
| 331 | if (options.link_libc == false) return error.OsRequiresLibC; | 323 | if (options.link_libc == false) return error.OsRequiresLibC; |
| ... | @@ -335,7 +327,7 @@ pub fn resolve(options: Options) ResolveError!Config { | ... | @@ -335,7 +327,7 @@ pub fn resolve(options: Options) ResolveError!Config { |
| 335 | if (options.link_libc == false) return error.LibCppRequiresLibC; | 327 | if (options.link_libc == false) return error.LibCppRequiresLibC; |
| 336 | break :b true; | 328 | break :b true; |
| 337 | } | 329 | } |
| 338 | if (link_libunwind) { | 330 | if (options.link_libunwind == true) { |
| 339 | if (options.link_libc == false) return error.LibUnwindRequiresLibC; | 331 | if (options.link_libc == false) return error.LibUnwindRequiresLibC; |
| 340 | break :b true; | 332 | break :b true; |
| 341 | } | 333 | } |
| ... | @@ -406,12 +398,17 @@ pub fn resolve(options: Options) ResolveError!Config { | ... | @@ -406,12 +398,17 @@ pub fn resolve(options: Options) ResolveError!Config { |
| 406 | break :b .static; | 398 | break :b .static; |
| 407 | }; | 399 | }; |
| 408 | | 400 | |
| 409 | // This is done here to avoid excessive duplicated logic due to the complex dependencies between these options. | 401 | const link_libunwind = b: { |
| 410 | if (options.output_mode == .Exe and link_libc and target_util.libCNeedsLibUnwind(target, link_mode)) { | 402 | if (options.output_mode == .Exe and link_libc and target_util.libCNeedsLibUnwind(target, link_mode)) { |
| 411 | if (options.link_libunwind == false) return error.LibCRequiresLibUnwind; | 403 | if (options.link_libunwind == false) return error.LibCRequiresLibUnwind; |
| 412 | | 404 | break :b true; |
| 413 | link_libunwind = true; | 405 | } |
| 414 | } | 406 | if (link_libcpp and target_util.libCxxNeedsLibUnwind(target)) { |
| | 407 | if (options.link_libunwind == false) return error.LibCppRequiresLibUnwind; |
| | 408 | break :b true; |
| | 409 | } |
| | 410 | break :b options.link_libunwind orelse false; |
| | 411 | }; |
| 415 | | 412 | |
| 416 | const import_memory = options.import_memory orelse (options.output_mode == .Obj); | 413 | const import_memory = options.import_memory orelse (options.output_mode == .Obj); |
| 417 | const export_memory = b: { | 414 | const export_memory = b: { |