Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion cmake/Findlld.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ else()
FIND_AND_ADD_LLD_LIB(lldMinGW)
FIND_AND_ADD_LLD_LIB(lldELF)
FIND_AND_ADD_LLD_LIB(lldCOFF)
FIND_AND_ADD_LLD_LIB(lldMachO)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this deletion is just so beautiful, it brings a tear to my eyes 🥲

FIND_AND_ADD_LLD_LIB(lldWasm)
FIND_AND_ADD_LLD_LIB(lldReaderWriter)
FIND_AND_ADD_LLD_LIB(lldCore)
Expand Down
15 changes: 2 additions & 13 deletions src/Compilation.zig
Original file line number Diff line number Diff line change
Expand Up @@ -880,24 +880,16 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation {
break :blk false;
};

const darwin_can_use_system_linker_and_sdk =
const darwin_can_use_system_sdk =
// comptime conditions
((build_options.have_llvm and comptime std.Target.current.isDarwin()) and
// runtime conditions
(use_lld and std.builtin.os.tag == .macos and options.target.isDarwin()));
Comment thread
ifreund marked this conversation as resolved.

const darwin_system_linker_hack = blk: {
if (darwin_can_use_system_linker_and_sdk) {
break :blk std.os.getenv("ZIG_SYSTEM_LINKER_HACK") != null;
} else {
break :blk false;
}
};

const sysroot = blk: {
if (options.sysroot) |sysroot| {
break :blk sysroot;
} else if (darwin_can_use_system_linker_and_sdk) {
} else if (darwin_can_use_system_sdk) {
// TODO Revisit this targeting versions lower than macOS 11 when LLVM 12 is out.
// See https://github.com/ziglang/zig/issues/6996
const at_least_big_sur = options.target.os.getVersionRange().semver.min.major >= 11;
Expand All @@ -916,8 +908,6 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation {
break :blk false;
} else if (options.c_source_files.len == 0) {
break :blk false;
} else if (darwin_system_linker_hack) {
break :blk false;
} else switch (options.output_mode) {
.Lib, .Obj => break :blk false,
.Exe => switch (options.optimize_mode) {
Expand Down Expand Up @@ -1296,7 +1286,6 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation {
.optimize_mode = options.optimize_mode,
.use_lld = use_lld,
.use_llvm = use_llvm,
.system_linker_hack = darwin_system_linker_hack,
.link_libc = link_libc,
.link_libcpp = link_libcpp,
.link_libunwind = link_libunwind,
Expand Down
2 changes: 0 additions & 2 deletions src/codegen/llvm/bindings.zig
Original file line number Diff line number Diff line change
Expand Up @@ -496,12 +496,10 @@ fn LLVMInitializeAllAsmParsers() callconv(.C) void {

extern fn ZigLLDLinkCOFF(argc: c_int, argv: [*:null]const ?[*:0]const u8, can_exit_early: bool) c_int;
extern fn ZigLLDLinkELF(argc: c_int, argv: [*:null]const ?[*:0]const u8, can_exit_early: bool) c_int;
extern fn ZigLLDLinkMachO(argc: c_int, argv: [*:null]const ?[*:0]const u8, can_exit_early: bool) c_int;
extern fn ZigLLDLinkWasm(argc: c_int, argv: [*:null]const ?[*:0]const u8, can_exit_early: bool) c_int;

pub const LinkCOFF = ZigLLDLinkCOFF;
pub const LinkELF = ZigLLDLinkELF;
pub const LinkMachO = ZigLLDLinkMachO;
pub const LinkWasm = ZigLLDLinkWasm;

pub const ObjectFormatType = enum(c_int) {
Expand Down
3 changes: 0 additions & 3 deletions src/link.zig
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ pub const Options = struct {
/// other objects.
/// Otherwise (depending on `use_lld`) this link code directly outputs and updates the final binary.
use_llvm: bool,
/// Darwin-only. If this is true, `use_llvm` is true, and `is_native_os` is true, this link code will
/// use system linker `ld` instead of the LLD.
system_linker_hack: bool,
link_libc: bool,
link_libcpp: bool,
link_libunwind: bool,
Expand Down
Loading