| ... | @@ -7567,10 +7567,11 @@ fn handleExternLibName( | ... | @@ -7567,10 +7567,11 @@ fn handleExternLibName( |
| 7567 | ) CompileError![:0]u8 { | 7567 | ) CompileError![:0]u8 { |
| 7568 | blk: { | 7568 | blk: { |
| 7569 | const mod = sema.mod; | 7569 | const mod = sema.mod; |
| | 7570 | const comp = mod.comp; |
| 7570 | const target = mod.getTarget(); | 7571 | const target = mod.getTarget(); |
| 7571 | log.debug("extern fn symbol expected in lib '{s}'", .{lib_name}); | 7572 | log.debug("extern fn symbol expected in lib '{s}'", .{lib_name}); |
| 7572 | if (target_util.is_libc_lib_name(target, lib_name)) { | 7573 | if (target_util.is_libc_lib_name(target, lib_name)) { |
| 7573 | if (!mod.comp.bin_file.options.link_libc) { | 7574 | if (!comp.bin_file.options.link_libc and !comp.bin_file.options.parent_compilation_link_libc) { |
| 7574 | return sema.fail( | 7575 | return sema.fail( |
| 7575 | block, | 7576 | block, |
| 7576 | src_loc, | 7577 | src_loc, |
| ... | @@ -7578,11 +7579,11 @@ fn handleExternLibName( | ... | @@ -7578,11 +7579,11 @@ fn handleExternLibName( |
| 7578 | .{}, | 7579 | .{}, |
| 7579 | ); | 7580 | ); |
| 7580 | } | 7581 | } |
| 7581 | mod.comp.bin_file.options.link_libc = true; | 7582 | comp.bin_file.options.link_libc = true; |
| 7582 | break :blk; | 7583 | break :blk; |
| 7583 | } | 7584 | } |
| 7584 | if (target_util.is_libcpp_lib_name(target, lib_name)) { | 7585 | if (target_util.is_libcpp_lib_name(target, lib_name)) { |
| 7585 | if (!mod.comp.bin_file.options.link_libcpp) { | 7586 | if (!comp.bin_file.options.link_libcpp) { |
| 7586 | return sema.fail( | 7587 | return sema.fail( |
| 7587 | block, | 7588 | block, |
| 7588 | src_loc, | 7589 | src_loc, |
| ... | @@ -7590,14 +7591,14 @@ fn handleExternLibName( | ... | @@ -7590,14 +7591,14 @@ fn handleExternLibName( |
| 7590 | .{}, | 7591 | .{}, |
| 7591 | ); | 7592 | ); |
| 7592 | } | 7593 | } |
| 7593 | mod.comp.bin_file.options.link_libcpp = true; | 7594 | comp.bin_file.options.link_libcpp = true; |
| 7594 | break :blk; | 7595 | break :blk; |
| 7595 | } | 7596 | } |
| 7596 | if (mem.eql(u8, lib_name, "unwind")) { | 7597 | if (mem.eql(u8, lib_name, "unwind")) { |
| 7597 | mod.comp.bin_file.options.link_libunwind = true; | 7598 | comp.bin_file.options.link_libunwind = true; |
| 7598 | break :blk; | 7599 | break :blk; |
| 7599 | } | 7600 | } |
| 7600 | if (!target.isWasm() and !mod.comp.bin_file.options.pic) { | 7601 | if (!target.isWasm() and !comp.bin_file.options.pic) { |
| 7601 | return sema.fail( | 7602 | return sema.fail( |
| 7602 | block, | 7603 | block, |
| 7603 | src_loc, | 7604 | src_loc, |
| ... | @@ -7605,7 +7606,7 @@ fn handleExternLibName( | ... | @@ -7605,7 +7606,7 @@ fn handleExternLibName( |
| 7605 | .{ lib_name, lib_name }, | 7606 | .{ lib_name, lib_name }, |
| 7606 | ); | 7607 | ); |
| 7607 | } | 7608 | } |
| 7608 | mod.comp.stage1AddLinkLib(lib_name) catch |err| { | 7609 | comp.stage1AddLinkLib(lib_name) catch |err| { |
| 7609 | return sema.fail(block, src_loc, "unable to add link lib '{s}': {s}", .{ | 7610 | return sema.fail(block, src_loc, "unable to add link lib '{s}': {s}", .{ |
| 7610 | lib_name, @errorName(err), | 7611 | lib_name, @errorName(err), |
| 7611 | }); | 7612 | }); |