From f580c7fa4330a0c181226060d2e778285fa38dc0 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 15 Feb 2016 16:52:37 -0700 Subject: handle libc include path and libc lib path differently --- src/link.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/link.cpp') diff --git a/src/link.cpp b/src/link.cpp index 5fbcdfefb7..14fd7cd040 100644 --- a/src/link.cpp +++ b/src/link.cpp @@ -127,6 +127,11 @@ static const char *getLDMOption(const ZigTarget *t) { static void construct_linker_job_linux(LinkJob *lj) { CodeGen *g = lj->codegen; + if (lj->link_in_crt) { + find_libc_lib_path(g); + } + + lj->args.append("-m"); lj->args.append(getLDMOption(&g->zig_target)); @@ -253,6 +258,10 @@ static bool is_target_cyg_mingw(const ZigTarget *target) { static void construct_linker_job_mingw(LinkJob *lj) { CodeGen *g = lj->codegen; + if (lj->link_in_crt) { + find_libc_lib_path(g); + } + if (g->zig_target.arch.arch == ZigLLVM_x86) { lj->args.append("-m"); lj->args.append("i386pe"); @@ -526,12 +535,6 @@ void codegen_link(CodeGen *g, const char *out_file) { } lj.link_in_crt = (g->link_libc && g->out_type == OutTypeExe); - if (lj.link_in_crt) { - find_libc_path(g); - } - - - // invoke `ld` ensure_we_have_linker_path(g); -- cgit v1.2.3