diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2019-03-06 13:22:36 -0500 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2019-03-06 13:22:36 -0500 |
| commit | ccdef8c0fb0a80d38ce4f4ac0c57aa2b66bfcfc2 (patch) | |
| tree | 1efb54cff3019d9b7221991b77031a5a0c625cba /src/codegen.cpp | |
| parent | 697b1233f0c458b8ad8c374f6f7cce451142ca71 (diff) | |
| download | zig-ccdef8c0fb0a80d38ce4f4ac0c57aa2b66bfcfc2.tar.gz zig-ccdef8c0fb0a80d38ce4f4ac0c57aa2b66bfcfc2.zip | |
cross compile glibc startup files
Diffstat (limited to 'src/codegen.cpp')
| -rw-r--r-- | src/codegen.cpp | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp index 175aca5346..d106c7dab6 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -190,6 +190,9 @@ CodeGen *codegen_create(Buf *main_pkg_path, Buf *root_src_path, const ZigTarget g->link_libs_list.append(g->libc_link_lib); } + get_target_triple(&g->triple_str, g->zig_target); + g->pointer_size_bytes = target_arch_pointer_bit_width(g->zig_target->arch) / 8; + return g; } @@ -7786,16 +7789,6 @@ static void init(CodeGen *g) { if (g->module) return; - if (g->llvm_argv_len > 0) { - const char **args = allocate_nonzero<const char *>(g->llvm_argv_len + 2); - args[0] = "zig (LLVM option parsing)"; - for (size_t i = 0; i < g->llvm_argv_len; i += 1) { - args[i + 1] = g->llvm_argv[i]; - } - args[g->llvm_argv_len + 1] = nullptr; - ZigLLVMParseCommandLineOptions(g->llvm_argv_len + 1, args); - } - if (g->is_test_build) { g->subsystem = TargetSubsystemConsole; } @@ -7803,8 +7796,6 @@ static void init(CodeGen *g) { assert(g->root_out_name); g->module = LLVMModuleCreateWithName(buf_ptr(g->root_out_name)); - get_target_triple(&g->triple_str, g->zig_target); - LLVMSetTarget(g->module, buf_ptr(&g->triple_str)); if (target_object_format(g->zig_target) == ZigLLVM_COFF) { @@ -7860,7 +7851,7 @@ static void init(CodeGen *g) { LLVMSetDataLayout(g->module, layout_str); - g->pointer_size_bytes = LLVMPointerSize(g->target_data_ref); + assert(g->pointer_size_bytes == LLVMPointerSize(g->target_data_ref)); g->is_big_endian = (LLVMByteOrder(g->target_data_ref) == LLVMBigEndian); g->builder = LLVMCreateBuilder(); |
