authorgravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2019-05-20 23:09:25+02:00
committergravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2019-05-20 23:09:25+02:00
log266b2de1505ed64f05260c7057b9b563a2161e48
treeeb459bd1658ae80ccd056d4e0a237185dd17285d
parentf5657b5552ea1219706c79f67bd0620767ecc4ec

Remove macos-specific linking hacks


3 files changed, 2 insertions(+), 20 deletions(-)

CMakeLists.txt-2
......@@ -6707,8 +6707,6 @@ target_link_libraries(zig0 compiler)
67076707
67086708if(WIN32)
67096709 set(LIBUSERLAND "${CMAKE_BINARY_DIR}/userland.lib")
6710elseif(APPLE)
6711 set(LIBUSERLAND "${CMAKE_BINARY_DIR}/userland.o")
67126710else()
67136711 set(LIBUSERLAND "${CMAKE_BINARY_DIR}/libuserland.a")
67146712endif()
build.zig+2-10
......@@ -385,17 +385,9 @@ const Context = struct {
385385};
386386
387387fn 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-8
......@@ -776,14 +776,6 @@ static const char *get_libc_crt_file(CodeGen *parent, const char *file) {
776776}
777777
778778static 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));