recognize ar program and pass --gc-sections to ld

See #54
This commit is contained in:
Andrew Kelley
2016-05-11 14:44:10 -07:00
parent 6b7ffd4cbe
commit 26718a619c
10 changed files with 29 additions and 4 deletions

View File

@@ -85,6 +85,7 @@ CodeGen *codegen_create(Buf *root_source_dir, const ZigTarget *target) {
g->libc_static_lib_dir = buf_create_from_str("");
g->libc_include_dir = buf_create_from_str("");
g->linker_path = buf_create_from_str("");
g->ar_path = buf_create_from_str("");
g->darwin_linker_version = buf_create_from_str("");
} else {
// native compilation, we can rely on the configuration stuff
@@ -96,6 +97,7 @@ CodeGen *codegen_create(Buf *root_source_dir, const ZigTarget *target) {
g->libc_static_lib_dir = buf_create_from_str(ZIG_LIBC_STATIC_LIB_DIR);
g->libc_include_dir = buf_create_from_str(ZIG_LIBC_INCLUDE_DIR);
g->linker_path = buf_create_from_str(ZIG_LD_PATH);
g->ar_path = buf_create_from_str(ZIG_AR_PATH);
g->darwin_linker_version = buf_create_from_str(ZIG_HOST_LINK_VERSION);
if (g->zig_target.os == ZigLLVM_Darwin ||
@@ -171,6 +173,10 @@ void codegen_set_linker_path(CodeGen *g, Buf *linker_path) {
g->linker_path = linker_path;
}
void codegen_set_ar_path(CodeGen *g, Buf *ar_path) {
g->ar_path = ar_path;
}
void codegen_add_lib_dir(CodeGen *g, const char *dir) {
g->lib_dirs.append(dir);
}