Skip to content

Commit 266b2de

Browse files
committed
Remove macos-specific linking hacks
1 parent f5657b5 commit 266b2de

File tree

3 files changed

+2
-20
lines changed

3 files changed

+2
-20
lines changed

CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6707,8 +6707,6 @@ target_link_libraries(zig0 compiler)
67076707

67086708
if(WIN32)
67096709
set(LIBUSERLAND "${CMAKE_BINARY_DIR}/userland.lib")
6710-
elseif(APPLE)
6711-
set(LIBUSERLAND "${CMAKE_BINARY_DIR}/userland.o")
67126710
else()
67136711
set(LIBUSERLAND "${CMAKE_BINARY_DIR}/libuserland.a")
67146712
endif()

build.zig

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -385,17 +385,9 @@ const Context = struct {
385385
};
386386

387387
fn addLibUserlandStep(b: *Builder) void {
388-
// Sadly macOS requires hacks to work around the buggy MACH-O linker code.
389-
const artifact = if (builtin.os == .macosx)
390-
b.addObject("userland", "src-self-hosted/stage1.zig")
391-
else
392-
b.addStaticLibrary("userland", "src-self-hosted/stage1.zig");
388+
const artifact = b.addStaticLibrary("userland", "src-self-hosted/stage1.zig");
393389
artifact.disable_gen_h = true;
394-
if (builtin.os == .macosx) {
395-
artifact.disable_stack_probing = true;
396-
} else {
397-
artifact.bundle_compiler_rt = true;
398-
}
390+
artifact.bundle_compiler_rt = true;
399391
artifact.setTarget(builtin.arch, builtin.os, builtin.abi);
400392
artifact.linkSystemLibrary("c");
401393
const libuserland_step = b.step("libuserland", "Build the userland compiler library for use in stage1");

src/link.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -776,14 +776,6 @@ static const char *get_libc_crt_file(CodeGen *parent, const char *file) {
776776
}
777777

778778
static Buf *build_a_raw(CodeGen *parent_gen, const char *aname, Buf *full_path, OutType child_out_type) {
779-
// The Mach-O LLD code is not well maintained, and trips an assertion
780-
// when we link compiler_rt and libc.zig as libraries rather than objects.
781-
// Here we workaround this by having compiler_rt and libc.zig be objects.
782-
// TODO write our own linker. https://github.com/ziglang/zig/issues/1535
783-
if (parent_gen->zig_target->os == OsMacOSX) {
784-
child_out_type = OutTypeObj;
785-
}
786-
787779
CodeGen *child_gen = create_child_codegen(parent_gen, full_path, child_out_type,
788780
parent_gen->libc);
789781
codegen_set_out_name(child_gen, buf_create_from_str(aname));

0 commit comments

Comments
 (0)