authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-02-02 15:33:38+01:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-02-02 15:33:38+01:00
log380462ffc0366896de42b08d2517b7f6d631c6d4
tree66f0df2a73e7e751c9ef864b44a29459c005c11e
parent5cf918143c7c5857142ac12c3587928ed74b2052

sema: do not pass libc or libc++ to the linker


1 files changed, 11 insertions(+), 5 deletions(-)

src/Sema.zig+11-5
......@@ -5567,11 +5567,6 @@ fn funcCommon(
55675567 if (opt_lib_name) |lib_name| blk: {
55685568 const lib_name_src: LazySrcLoc = .{ .node_offset_lib_name = src_node_offset };
55695569 log.debug("extern fn symbol expected in lib '{s}'", .{lib_name});
5570 mod.comp.stage1AddLinkLib(lib_name) catch |err| {
5571 return sema.fail(block, lib_name_src, "unable to add link lib '{s}': {s}", .{
5572 lib_name, @errorName(err),
5573 });
5574 };
55755570 if (target_util.is_libc_lib_name(target, lib_name)) {
55765571 if (!mod.comp.bin_file.options.link_libc) {
55775572 return sema.fail(
......@@ -5581,6 +5576,7 @@ fn funcCommon(
55815576 .{},
55825577 );
55835578 }
5579 mod.comp.bin_file.options.link_libc = true;
55845580 break :blk;
55855581 }
55865582 if (target_util.is_libcpp_lib_name(target, lib_name)) {
......@@ -5592,6 +5588,11 @@ fn funcCommon(
55925588 .{},
55935589 );
55945590 }
5591 mod.comp.bin_file.options.link_libcpp = true;
5592 break :blk;
5593 }
5594 if (mem.eql(u8, lib_name, "unwind")) {
5595 mod.comp.bin_file.options.link_libunwind = true;
55955596 break :blk;
55965597 }
55975598 if (!target.isWasm() and !mod.comp.bin_file.options.pic) {
......@@ -5602,6 +5603,11 @@ fn funcCommon(
56025603 .{ lib_name, lib_name },
56035604 );
56045605 }
5606 mod.comp.stage1AddLinkLib(lib_name) catch |err| {
5607 return sema.fail(block, lib_name_src, "unable to add link lib '{s}': {s}", .{
5608 lib_name, @errorName(err),
5609 });
5610 };
56055611 }
56065612
56075613 if (is_extern) {