Index: driver/arm-cc-specs.in =================================================================== --- driver/arm-cc-specs.in (revision 118) +++ driver/arm-cc-specs.in (working copy) @@ -18,7 +18,7 @@ ASFLAGS=-arch arm LD=@prefix@/bin/arm-apple-darwin-ld LDFLAGS=-syslibroot @prefix@/heavenly @prefix@/csu/crt1.o % -lSystem -lgcc_s_v6.1 -lm -L@prefix@/lib -larmfp -LDFLAGS_DYLIB=-syslibroot @prefix@/heavenly -lSystem -lgcc_s_v6.1 -L@prefix@/csu -ldylib1.o -single_module -dylib -dynamic -LDFLAGS_BUNDLE=-syslibroot @prefix@/heavenly -bundle -lSystem -lgcc_s_v6.1 -L@prefix@/csu @prefix@/csu/bundle1.o -dynamic LDFLAGS_FRAMEWORKSDIR=-F@prefix@/heavenly/System/Library/Frameworks - +LIBTOOL=@prefix@/bin/arm-apple-darwin-libtool +LIBTOOL_FLAGS_DYLIB=-syslibroot @prefix@/heavenly -lSystem -lgcc_s_v6.1 -L@prefix@/csu -single_module -dynamic +LIBTOOL_FLAGS_BUNDLE=-syslibroot @prefix@/heavenly -bundle -lSystem -lgcc_s_v6.1 -L@prefix@/csu @prefix@/csu/bundle1.o -dynamic Index: driver/cc.c =================================================================== --- driver/cc.c (revision 118) +++ driver/cc.c (working copy) @@ -332,22 +332,31 @@ char * get_full_path(char *prog_name) { - char *path, *dir, *test_path; + char *envp, *dir, *path, *test_path; if (prog_name[0] == '/' || prog_name[0] == '.') return strdup(prog_name); - path = getenv("PATH"); + envp = getenv("PATH"); + if (!envp) + return NULL; + + /* Don't directly modify the environment */ + path = strdup(envp); if (!path) return NULL; + for (dir = strtok(path, ":"); dir != NULL; dir = strtok(NULL, ":")) { + asprintf(&test_path, "%s/%s", dir, prog_name); if (!access(test_path, X_OK)) { + free(path); return test_path; } free(test_path); } + free(path); return NULL; } @@ -688,9 +697,14 @@ } /* Run the linking step. */ - if (req_todo & TODO_LINK) - execute_step("LD", make_dylib ? "LDFLAGS_DYLIB" : make_bundle ? "LDFLAGS_BUNDLE" : "LDFLAGS", - linker_args, 2, "-o", output_path); + if (req_todo & TODO_LINK) { + if (make_dylib) + execute_step("LIBTOOL", "LIBTOOL_FLAGS_DYLIB", linker_args, 2, "-o", output_path); + else if (make_bundle) + execute_step("LIBTOOL", "LIBTOOL_FLAGS_BUNDLE", linker_args, 2, "-o", output_path); + else + execute_step("LD", "LDFLAGS", linker_args, 2, "-o", output_path); + } } void clean_up_temporary_files()