handle libc include path and libc lib path differently

This commit is contained in:
Andrew Kelley
2016-02-15 16:52:37 -07:00
parent c6bf9c6942
commit f580c7fa43
4 changed files with 20 additions and 13 deletions

View File

@@ -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);