@@ -7567,45 +7567,46 @@ fn handleExternLibName(
7567
7567
) CompileError![:0]u8 {
7568
7568
blk: {
7569
7569
const mod = sema.mod;
7570
+ const comp = mod.comp;
7570
7571
const target = mod.getTarget();
7571
7572
log.debug("extern fn symbol expected in lib '{s}'", .{lib_name});
7572
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
7575
return sema.fail(
7575
7576
block,
7576
7577
src_loc,
7577
7578
"dependency on libc must be explicitly specified in the build command",
7578
7579
.{},
7579
7580
);
7580
7581
}
7581
- mod. comp.bin_file.options.link_libc = true;
7582
+ comp.bin_file.options.link_libc = true;
7582
7583
break :blk;
7583
7584
}
7584
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
7587
return sema.fail(
7587
7588
block,
7588
7589
src_loc,
7589
7590
"dependency on libc++ must be explicitly specified in the build command",
7590
7591
.{},
7591
7592
);
7592
7593
}
7593
- mod. comp.bin_file.options.link_libcpp = true;
7594
+ comp.bin_file.options.link_libcpp = true;
7594
7595
break :blk;
7595
7596
}
7596
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
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
7602
return sema.fail(
7602
7603
block,
7603
7604
src_loc,
7604
7605
"dependency on dynamic library '{s}' requires enabling Position Independent Code. Fixed by `-l{s}` or `-fPIC`.",
7605
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
7610
return sema.fail(block, src_loc, "unable to add link lib '{s}': {s}", .{
7610
7611
lib_name, @errorName(err),
7611
7612
});
0 commit comments