Commit b9c943b066
Changed files (3)
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 <stdio.h>
@@ -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) {
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,
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);