| ... | @@ -417,12 +417,14 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation { | ... | @@ -417,12 +417,14 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation { |
| 417 | return error.MachineCodeModelNotSupported; | 417 | return error.MachineCodeModelNotSupported; |
| 418 | } | 418 | } |
| 419 | | 419 | |
| | 420 | const link_libc = options.link_libc or target_util.osRequiresLibC(options.target); |
| | 421 | |
| 420 | const must_dynamic_link = dl: { | 422 | const must_dynamic_link = dl: { |
| 421 | if (target_util.cannotDynamicLink(options.target)) | 423 | if (target_util.cannotDynamicLink(options.target)) |
| 422 | break :dl false; | 424 | break :dl false; |
| 423 | if (target_util.osRequiresLibC(options.target)) | 425 | if (target_util.osRequiresLibC(options.target)) |
| 424 | break :dl true; | 426 | break :dl true; |
| 425 | if (is_exe_or_dyn_lib and options.link_libc and options.target.isGnuLibC()) | 427 | if (is_exe_or_dyn_lib and link_libc and options.target.isGnuLibC()) |
| 426 | break :dl true; | 428 | break :dl true; |
| 427 | if (options.system_libs.len != 0) | 429 | if (options.system_libs.len != 0) |
| 428 | break :dl true; | 430 | break :dl true; |
| ... | @@ -444,12 +446,12 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation { | ... | @@ -444,12 +446,12 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation { |
| 444 | options.zig_lib_directory.path.?, | 446 | options.zig_lib_directory.path.?, |
| 445 | options.target, | 447 | options.target, |
| 446 | options.is_native_os, | 448 | options.is_native_os, |
| 447 | options.link_libc, | 449 | link_libc, |
| 448 | options.libc_installation, | 450 | options.libc_installation, |
| 449 | ); | 451 | ); |
| 450 | | 452 | |
| 451 | const must_pic: bool = b: { | 453 | const must_pic: bool = b: { |
| 452 | if (target_util.requiresPIC(options.target, options.link_libc)) | 454 | if (target_util.requiresPIC(options.target, link_libc)) |
| 453 | break :b true; | 455 | break :b true; |
| 454 | break :b link_mode == .Dynamic; | 456 | break :b link_mode == .Dynamic; |
| 455 | }; | 457 | }; |
| ... | @@ -545,7 +547,7 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation { | ... | @@ -545,7 +547,7 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation { |
| 545 | cache.hash.add(link_mode); | 547 | cache.hash.add(link_mode); |
| 546 | cache.hash.add(function_sections); | 548 | cache.hash.add(function_sections); |
| 547 | cache.hash.add(options.strip); | 549 | cache.hash.add(options.strip); |
| 548 | cache.hash.add(options.link_libc); | 550 | cache.hash.add(link_libc); |
| 549 | cache.hash.add(options.link_libcpp); | 551 | cache.hash.add(options.link_libcpp); |
| 550 | cache.hash.add(options.output_mode); | 552 | cache.hash.add(options.output_mode); |
| 551 | cache.hash.add(options.machine_code_model); | 553 | cache.hash.add(options.machine_code_model); |
| ... | @@ -676,7 +678,7 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation { | ... | @@ -676,7 +678,7 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation { |
| 676 | .optimize_mode = options.optimize_mode, | 678 | .optimize_mode = options.optimize_mode, |
| 677 | .use_lld = use_lld, | 679 | .use_lld = use_lld, |
| 678 | .use_llvm = use_llvm, | 680 | .use_llvm = use_llvm, |
| 679 | .link_libc = options.link_libc, | 681 | .link_libc = link_libc, |
| 680 | .link_libcpp = options.link_libcpp, | 682 | .link_libcpp = options.link_libcpp, |
| 681 | .objects = options.link_objects, | 683 | .objects = options.link_objects, |
| 682 | .frameworks = options.frameworks, | 684 | .frameworks = options.frameworks, |