Merge branch 'embed-lld'

Zig now depends on LLVM 5.0.0.

For the latest version that supports LLVM 4.0.1, use
2a49c876be.

Unfortunately we had to embed LLD into Zig due to some
MACH-O related LLD bugs. One of them is already upstream
and another is awaiting feedback on the llvm-dev mailing
list.

You can use cmake option -DZIG_FORCE_EXTERNAL_LLD=ON to
still use external LLD if you want to live with the MACH-O
bugs or if your system LLD is patched.

Closes #273
This commit is contained in:
Andrew Kelley
2017-08-28 04:09:09 -04:00
1823 changed files with 128202 additions and 861 deletions

View File

@@ -108,7 +108,6 @@ CodeGen *codegen_create(Buf *root_src_path, const ZigTarget *target, OutType out
g->libc_lib_dir = buf_create_from_str("");
g->libc_static_lib_dir = buf_create_from_str("");
g->libc_include_dir = buf_create_from_str("");
g->darwin_linker_version = buf_create_from_str("");
g->each_lib_rpath = false;
} else {
// native compilation, we can rely on the configuration stuff
@@ -119,7 +118,6 @@ CodeGen *codegen_create(Buf *root_src_path, const ZigTarget *target, OutType out
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);
g->libc_include_dir = buf_create_from_str(ZIG_LIBC_INCLUDE_DIR);
g->darwin_linker_version = buf_create_from_str(ZIG_HOST_LINK_VERSION);
#ifdef ZIG_EACH_LIB_RPATH
g->each_lib_rpath = true;
#endif
@@ -139,6 +137,7 @@ CodeGen *codegen_create(Buf *root_src_path, const ZigTarget *target, OutType out
g->zig_target.os == ZigLLVM_IOS)
{
g->libc_link_lib = create_link_lib(buf_create_from_str("c"));
g->link_libs_list.append(g->libc_link_lib);
}
return g;
@@ -250,10 +249,6 @@ void codegen_set_windows_unicode(CodeGen *g, bool municode) {
g->windows_linker_unicode = municode;
}
void codegen_set_mlinker_version(CodeGen *g, Buf *darwin_linker_version) {
g->darwin_linker_version = darwin_linker_version;
}
void codegen_set_mmacosx_version_min(CodeGen *g, Buf *mmacosx_version_min) {
g->mmacosx_version_min = mmacosx_version_min;
}
@@ -733,8 +728,8 @@ static LLVMValueRef get_panic_msg_ptr_val(CodeGen *g, PanicMsgId msg_id) {
ConstExprValue *array_val = create_const_str_lit(g, buf_msg);
init_const_slice(g, val, array_val, 0, buf_len(buf_msg), true);
render_const_val_global(g, val, "");
render_const_val(g, val);
render_const_val_global(g, val, "");
assert(val->global_refs->llvm_global);
return val->global_refs->llvm_global;
@@ -3651,7 +3646,8 @@ static LLVMValueRef gen_const_val(CodeGen *g, ConstExprValue *const_val) {
fields[type_struct_field->gen_index] = gen_const_val(g, &const_val->data.x_struct.fields[i]);
}
}
return LLVMConstNamedStruct(type_entry->type_ref, fields, type_entry->data.structure.gen_field_count);
return LLVMConstStruct(fields, type_entry->data.structure.gen_field_count,
type_entry->data.structure.layout == ContainerLayoutPacked);
}
case TypeTableEntryIdUnion:
{