diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2018-11-02 00:07:43 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2018-11-02 00:54:34 -0400 |
| commit | 1554dd9697b77b4fe4a309247982c3e29048f124 (patch) | |
| tree | f1ed649ac17a98dfb49067e04ea0c169cb34a725 /src/link.cpp | |
| parent | 5c97aff627394439089267132a6c86f5e6162f92 (diff) | |
| download | zig-1554dd9697b77b4fe4a309247982c3e29048f124.tar.gz zig-1554dd9697b77b4fe4a309247982c3e29048f124.zip | |
support building static self hosted compiler on macos
* add a --system-linker-hack command line parameter to work around
poor LLD macho code. See #1535
* build.zig correctly handles static as well as dynamic dependencies
when building the self hosted compiler.
- no more unnecessary libxml2 dependency
- a static build on macos produces a completely static self-hosted
compiler for macos (except for libSystem as intended).
Diffstat (limited to 'src/link.cpp')
| -rw-r--r-- | src/link.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/link.cpp b/src/link.cpp index 424b06169e..0e729fa918 100644 --- a/src/link.cpp +++ b/src/link.cpp @@ -778,7 +778,8 @@ static bool darwin_version_lt(DarwinPlatform *platform, int major, int minor) { static void construct_linker_job_macho(LinkJob *lj) { CodeGen *g = lj->codegen; - lj->args.append("-error-limit=0"); + // LLD MACH-O has no error limit option. + //lj->args.append("-error-limit=0"); lj->args.append("-demangle"); if (g->linker_rdynamic) { @@ -1007,7 +1008,17 @@ void codegen_link(CodeGen *g) { Buf diag = BUF_INIT; codegen_add_time_event(g, "LLVM Link"); - if (!zig_lld_link(g->zig_target.oformat, lj.args.items, lj.args.length, &diag)) { + if (g->system_linker_hack && g->zig_target.os == OsMacOSX) { + Termination term; + ZigList<const char *> args = {}; + for (size_t i = 1; i < lj.args.length; i += 1) { + args.append(lj.args.at(i)); + } + os_spawn_process("ld", args, &term); + if (term.how != TerminationIdClean || term.code != 0) { + exit(1); + } + } else if (!zig_lld_link(g->zig_target.oformat, lj.args.items, lj.args.length, &diag)) { fprintf(stderr, "%s\n", buf_ptr(&diag)); exit(1); } |
