diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2016-02-08 22:11:09 -0700 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2016-02-08 22:11:09 -0700 |
| commit | e18170ee0bf32996635397e8e919a14a21c88b56 (patch) | |
| tree | 25bf619190be8e936e44a5f5051828b60d066a9a /src/codegen.cpp | |
| parent | 62a689f7f534beb237c634683cee50da86c439f0 (diff) | |
| download | zig-e18170ee0bf32996635397e8e919a14a21c88b56.tar.gz zig-e18170ee0bf32996635397e8e919a14a21c88b56.zip | |
support overriding the dynamic linker argument to ld
Diffstat (limited to 'src/codegen.cpp')
| -rw-r--r-- | src/codegen.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp index 97c528bc81..d1a57a82bc 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -33,6 +33,9 @@ CodeGen *codegen_create(Buf *root_source_dir) { g->is_test_build = false; g->root_source_dir = root_source_dir; g->error_value_count = 1; + if (ZIG_DYNAMIC_LINKER) { + g->dynamic_linker = buf_create_from_str(ZIG_DYNAMIC_LINKER); + } g->libc_lib_dir = buf_create_from_str(ZIG_LIBC_LIB_DIR); g->libc_static_lib_dir = buf_create_from_str(ZIG_LIBC_STATIC_LIB_DIR); @@ -90,6 +93,10 @@ void codegen_set_libc_include_dir(CodeGen *g, Buf *libc_include_dir) { g->libc_include_dir = libc_include_dir; } +void codegen_set_dynamic_linker(CodeGen *g, Buf *dynamic_linker) { + g->dynamic_linker = dynamic_linker; +} + void codegen_add_lib_dir(CodeGen *g, const char *dir) { g->lib_dirs.append(dir); } @@ -4157,13 +4164,12 @@ void codegen_link(CodeGen *g, const char *out_file) { args.append(buf_ptr(g->libc_static_lib_dir)); } - // TODO don't pass this parameter unless linking with libc - if (ZIG_DYNAMIC_LINKER[0] == 0) { + if (g->dynamic_linker) { args.append("-dynamic-linker"); - args.append(buf_ptr(get_dynamic_linker(g->target_machine))); + args.append(buf_ptr(g->dynamic_linker)); } else { args.append("-dynamic-linker"); - args.append(ZIG_DYNAMIC_LINKER); + args.append(buf_ptr(get_dynamic_linker(g->target_machine))); } if (g->out_type == OutTypeLib) { |
