mirror of
https://github.com/Ed94/Odin.git
synced 2026-06-22 13:44:59 -07:00
Change ODIN_OS string for osx from "osx" to "darwin" to allow for other platforms
This commit is contained in:
@@ -2,7 +2,7 @@ enum TargetOsKind {
|
||||
TargetOs_Invalid,
|
||||
|
||||
TargetOs_windows,
|
||||
TargetOs_osx,
|
||||
TargetOs_darwin,
|
||||
TargetOs_linux,
|
||||
TargetOs_essence,
|
||||
|
||||
@@ -30,7 +30,7 @@ enum TargetEndianKind {
|
||||
String target_os_names[TargetOs_COUNT] = {
|
||||
str_lit(""),
|
||||
str_lit("windows"),
|
||||
str_lit("osx"),
|
||||
str_lit("darwin"),
|
||||
str_lit("linux"),
|
||||
str_lit("essence"),
|
||||
};
|
||||
@@ -166,8 +166,8 @@ gb_global TargetMetrics target_linux_amd64 = {
|
||||
str_lit("x86_64-pc-linux-gnu"),
|
||||
};
|
||||
|
||||
gb_global TargetMetrics target_osx_amd64 = {
|
||||
TargetOs_osx,
|
||||
gb_global TargetMetrics target_darwin_amd64 = {
|
||||
TargetOs_darwin,
|
||||
TargetArch_amd64,
|
||||
8,
|
||||
16,
|
||||
@@ -189,7 +189,7 @@ struct NamedTargetMetrics {
|
||||
|
||||
gb_global NamedTargetMetrics named_targets[] = {
|
||||
{ str_lit("essence_amd64"), &target_essence_amd64 },
|
||||
{ str_lit("macos_amd64"), &target_osx_amd64 },
|
||||
{ str_lit("darwin_amd64"), &target_darwin_amd64 },
|
||||
{ str_lit("linux_386"), &target_linux_386 },
|
||||
{ str_lit("linux_amd64"), &target_linux_amd64 },
|
||||
{ str_lit("windows_386"), &target_windows_386 },
|
||||
@@ -566,7 +566,7 @@ void init_build_context(TargetMetrics *cross_target) {
|
||||
#if defined(GB_SYSTEM_WINDOWS)
|
||||
metrics = target_windows_amd64;
|
||||
#elif defined(GB_SYSTEM_OSX)
|
||||
metrics = target_osx_amd64;
|
||||
metrics = target_darwin_amd64;
|
||||
#else
|
||||
metrics = target_linux_amd64;
|
||||
#endif
|
||||
@@ -618,7 +618,7 @@ void init_build_context(TargetMetrics *cross_target) {
|
||||
case TargetOs_windows:
|
||||
bc->link_flags = str_lit("/machine:x64 ");
|
||||
break;
|
||||
case TargetOs_osx:
|
||||
case TargetOs_darwin:
|
||||
break;
|
||||
case TargetOs_linux:
|
||||
bc->link_flags = str_lit("-arch x86-64 ");
|
||||
@@ -631,7 +631,7 @@ void init_build_context(TargetMetrics *cross_target) {
|
||||
case TargetOs_windows:
|
||||
bc->link_flags = str_lit("/machine:x86 ");
|
||||
break;
|
||||
case TargetOs_osx:
|
||||
case TargetOs_darwin:
|
||||
gb_printf_err("Unsupported architecture\n");
|
||||
gb_exit(1);
|
||||
break;
|
||||
|
||||
+1
-1
@@ -1915,7 +1915,7 @@ Type *type_to_abi_compat_param_type(gbAllocator a, Type *original_type, ProcCall
|
||||
}
|
||||
}
|
||||
} else if (build_context.ODIN_OS == "linux" ||
|
||||
build_context.ODIN_OS == "osx") {
|
||||
build_context.ODIN_OS == "darwin") {
|
||||
Type *bt = core_type(original_type);
|
||||
switch (bt->kind) {
|
||||
// Okay to pass by value (usually)
|
||||
|
||||
+9
-5
@@ -1165,7 +1165,8 @@ void ir_print_calling_convention(irFileBuffer *f, irModule *m, ProcCallingConven
|
||||
switch (cc) {
|
||||
case ProcCC_Odin: ir_write_str_lit(f, ""); break;
|
||||
case ProcCC_Contextless: ir_write_str_lit(f, ""); break;
|
||||
case ProcCC_CDecl: ir_write_str_lit(f, "ccc "); break;
|
||||
// case ProcCC_CDecl: ir_write_str_lit(f, "ccc "); break;
|
||||
case ProcCC_CDecl: ir_write_str_lit(f, ""); break;
|
||||
case ProcCC_StdCall: ir_write_str_lit(f, "cc 64 "); break;
|
||||
case ProcCC_FastCall: ir_write_str_lit(f, "cc 65 "); break;
|
||||
case ProcCC_None: ir_write_str_lit(f, ""); break;
|
||||
@@ -1175,8 +1176,8 @@ void ir_print_calling_convention(irFileBuffer *f, irModule *m, ProcCallingConven
|
||||
|
||||
void ir_print_context_parameter_prefix(irFileBuffer *f, irModule *m) {
|
||||
ir_print_type(f, m, t_context_ptr);
|
||||
ir_write_str_lit(f, " noalias nonnull nocapture inreg ");
|
||||
// ir_write_str_lit(f, " noalias nonnull nocapture ");
|
||||
// ir_write_str_lit(f, " noalias nonnull nocapture inreg ");
|
||||
ir_write_str_lit(f, " noalias nonnull nocapture ");
|
||||
}
|
||||
|
||||
void ir_print_instr(irFileBuffer *f, irModule *m, irValue *value) {
|
||||
@@ -1227,6 +1228,7 @@ void ir_print_instr(irFileBuffer *f, irModule *m, irValue *value) {
|
||||
ir_write_str_lit(f, ", ");
|
||||
ir_print_type(f, m, type);
|
||||
ir_fprintf(f, "* %%%d, align 1", instr->ZeroInit.address->index);
|
||||
// ir_fprintf(f, "* %%%d", instr->ZeroInit.address->index);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2244,9 +2246,11 @@ void print_llvm_ir(irGen *ir) {
|
||||
defer (ir_file_buffer_destroy(f));
|
||||
|
||||
i32 word_bits = cast(i32)(8*build_context.word_size);
|
||||
if (build_context.ODIN_OS == "osx" || build_context.ODIN_OS == "macos") {
|
||||
if (build_context.ODIN_OS == "darwin") {
|
||||
GB_ASSERT(word_bits == 64);
|
||||
ir_write_str_lit(f, "target triple = \"x86_64-apple-macosx10.8\"\n\n");
|
||||
ir_write_str_lit(f, "target datalayout = \"e-m:o-i64:64-f80:128-n8:16:32:64-S128\"\n");
|
||||
ir_write_str_lit(f, "target triple = \"x86_64-apple-macosx10.8\"\n");
|
||||
ir_write_str_lit(f, "\n");
|
||||
} else if (build_context.ODIN_OS == "windows") {
|
||||
ir_fprintf(f, "target triple = \"x86%s-pc-windows-msvc\"\n\n", word_bits == 64 ? "_64" : "");
|
||||
if (word_bits == 64 && build_context.metrics.arch == TargetArch_amd64) {
|
||||
|
||||
Reference in New Issue
Block a user