From b9c943b0667ed8253382cb787d4705f6619f7296 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sun, 5 Feb 2017 18:23:54 -0500 Subject: [PATCH] tell LLVM the target sub arch type --- src/target.cpp | 13 ++++++++++--- src/zig_llvm.cpp | 18 ------------------ src/zig_llvm.hpp | 3 --- 3 files changed, 10 insertions(+), 24 deletions(-) diff --git a/src/target.cpp b/src/target.cpp index a2916fdb33..1f43a4f176 100644 --- a/src/target.cpp +++ b/src/target.cpp @@ -5,9 +5,10 @@ * See http://opensource.org/licenses/MIT */ +#include "buffer.hpp" +#include "error.hpp" #include "target.hpp" #include "util.hpp" -#include "error.hpp" #include @@ -282,8 +283,14 @@ void init_all_targets(void) { } void get_target_triple(Buf *triple, const ZigTarget *target) { - ZigLLVMGetTargetTriple(triple, target->arch.arch, target->arch.sub_arch, - target->vendor, target->os, target->env_type, target->oformat); + char arch_name[50]; + get_arch_name(arch_name, &target->arch); + + buf_resize(triple, 0); + buf_appendf(triple, "%s-%s-%s-%s", arch_name, + ZigLLVMGetVendorTypeName(target->vendor), + ZigLLVMGetOSTypeName(target->os), + ZigLLVMGetEnvironmentTypeName(target->env_type)); } static bool is_os_darwin(ZigTarget *target) { diff --git a/src/zig_llvm.cpp b/src/zig_llvm.cpp index c9fba7a9c2..d6c32b01b2 100644 --- a/src/zig_llvm.cpp +++ b/src/zig_llvm.cpp @@ -708,24 +708,6 @@ LLVMValueRef ZigLLVMBuildExactUDiv(LLVMBuilderRef B, LLVMValueRef LHS, #include "buffer.hpp" -void ZigLLVMGetTargetTriple(Buf *out_buf, ZigLLVM_ArchType arch_type, ZigLLVM_SubArchType sub_arch_type, - ZigLLVM_VendorType vendor_type, ZigLLVM_OSType os_type, ZigLLVM_EnvironmentType environ_type, - ZigLLVM_ObjectFormatType oformat) -{ - Triple triple; - - triple.setArch((Triple::ArchType)arch_type); - // TODO how to set the sub arch? - triple.setVendor((Triple::VendorType)vendor_type); - triple.setOS((Triple::OSType)os_type); - triple.setEnvironment((Triple::EnvironmentType)environ_type); - // I guess it's a "triple" because we don't set the object format? - //triple.setObjectFormat((Triple::ObjectFormatType)oformat); - - const std::string &str = triple.str(); - buf_init_from_mem(out_buf, str.c_str(), str.size()); -} - enum FloatAbi { FloatAbiHard, FloatAbiSoft, diff --git a/src/zig_llvm.hpp b/src/zig_llvm.hpp index 84ca275ecd..d6795db68c 100644 --- a/src/zig_llvm.hpp +++ b/src/zig_llvm.hpp @@ -347,9 +347,6 @@ struct Buf; void ZigLLVMGetNativeTarget(ZigLLVM_ArchType *arch_type, ZigLLVM_SubArchType *sub_arch_type, ZigLLVM_VendorType *vendor_type, ZigLLVM_OSType *os_type, ZigLLVM_EnvironmentType *environ_type, ZigLLVM_ObjectFormatType *oformat); -void ZigLLVMGetTargetTriple(Buf *out_buf, ZigLLVM_ArchType arch_type, ZigLLVM_SubArchType sub_arch_type, - ZigLLVM_VendorType vendor_type, ZigLLVM_OSType os_type, ZigLLVM_EnvironmentType environ_type, - ZigLLVM_ObjectFormatType oformat); Buf *get_dynamic_linker(LLVMTargetMachineRef target_machine);