mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 23:28:48 +00:00
Merge branch 'packages' of github.com:odin-lang/Odin into packages
This commit is contained in:
+18
-15
@@ -33,6 +33,11 @@ String target_arch_names[TargetArch_COUNT] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
String const ODIN_VERSION = str_lit("0.9.0");
|
||||||
|
String cross_compile_target = str_lit("");
|
||||||
|
String cross_compile_lib_dir = str_lit("");
|
||||||
|
|
||||||
|
|
||||||
// This stores the information for the specify architecture of this build
|
// This stores the information for the specify architecture of this build
|
||||||
struct BuildContext {
|
struct BuildContext {
|
||||||
// Constants
|
// Constants
|
||||||
@@ -417,9 +422,6 @@ String get_fullpath_core(gbAllocator a, String path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
String const ODIN_VERSION = str_lit("0.9.0");
|
|
||||||
String cross_compile_target = str_lit("");
|
|
||||||
String cross_compile_lib_dir = str_lit("");
|
|
||||||
|
|
||||||
void init_build_context(void) {
|
void init_build_context(void) {
|
||||||
BuildContext *bc = &build_context;
|
BuildContext *bc = &build_context;
|
||||||
@@ -490,12 +492,18 @@ void init_build_context(void) {
|
|||||||
#define LINK_FLAG_X86 "-arch x86"
|
#define LINK_FLAG_X86 "-arch x86"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
gbString llc_flags = gb_string_make_reserve(heap_allocator(), 64);
|
||||||
|
gbString link_flags = gb_string_make_reserve(heap_allocator(), 64);
|
||||||
|
if (bc->ODIN_DEBUG) {
|
||||||
|
llc_flags = gb_string_appendc(llc_flags, "-debug-compile ");
|
||||||
|
}
|
||||||
|
|
||||||
if (bc->ODIN_ARCH == "amd64") {
|
if (bc->ODIN_ARCH == "amd64") {
|
||||||
bc->word_size = 8;
|
bc->word_size = 8;
|
||||||
bc->max_align = 16;
|
bc->max_align = 16;
|
||||||
|
|
||||||
bc->llc_flags = str_lit("-march=x86-64 ");
|
llc_flags = gb_string_appendc(llc_flags, "-march=x86-64 ");
|
||||||
|
|
||||||
if (str_eq_ignore_case(cross_compile_target, str_lit("Essence"))) {
|
if (str_eq_ignore_case(cross_compile_target, str_lit("Essence"))) {
|
||||||
bc->link_flags = str_lit(" ");
|
bc->link_flags = str_lit(" ");
|
||||||
} else {
|
} else {
|
||||||
@@ -504,27 +512,22 @@ void init_build_context(void) {
|
|||||||
} else if (bc->ODIN_ARCH == "x86") {
|
} else if (bc->ODIN_ARCH == "x86") {
|
||||||
bc->word_size = 4;
|
bc->word_size = 4;
|
||||||
bc->max_align = 8;
|
bc->max_align = 8;
|
||||||
bc->llc_flags = str_lit("-march=x86 ");
|
llc_flags = gb_string_appendc(llc_flags, "-march=x86 ");
|
||||||
bc->link_flags = str_lit(LINK_FLAG_X86 " ");
|
bc->link_flags = str_lit(LINK_FLAG_X86 " ");
|
||||||
} else {
|
} else {
|
||||||
gb_printf_err("This current architecture is not supported");
|
gb_printf_err("This current architecture is not supported");
|
||||||
gb_exit(1);
|
gb_exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bc->llc_flags = make_string_c(llc_flags);
|
||||||
|
|
||||||
isize opt_max = 1023;
|
|
||||||
char *opt_flags_string = gb_alloc_array(heap_allocator(), char, opt_max+1);
|
|
||||||
isize opt_len = 0;
|
|
||||||
bc->optimization_level = gb_clamp(bc->optimization_level, 0, 3);
|
bc->optimization_level = gb_clamp(bc->optimization_level, 0, 3);
|
||||||
|
|
||||||
|
gbString opt_flags = gb_string_make_reserve(heap_allocator(), 16);
|
||||||
if (bc->optimization_level != 0) {
|
if (bc->optimization_level != 0) {
|
||||||
opt_len = gb_snprintf(opt_flags_string, opt_max, "-O%d", bc->optimization_level);
|
opt_flags = gb_string_append_fmt(opt_flags, "-O%d", bc->optimization_level);
|
||||||
} else {
|
|
||||||
opt_len = gb_snprintf(opt_flags_string, opt_max, "");
|
|
||||||
}
|
}
|
||||||
if (opt_len > 0) {
|
bc->opt_flags = make_string_c(opt_flags);
|
||||||
opt_len--;
|
|
||||||
}
|
|
||||||
bc->opt_flags = make_string(cast(u8 *)opt_flags_string, opt_len);
|
|
||||||
|
|
||||||
|
|
||||||
#undef LINK_FLAG_X64
|
#undef LINK_FLAG_X64
|
||||||
|
|||||||
@@ -683,7 +683,6 @@ i32 exec_llvm_llc(String output_base) {
|
|||||||
"\"%.*sbin/llc\" \"%.*s.bc\" -filetype=obj -O%d "
|
"\"%.*sbin/llc\" \"%.*s.bc\" -filetype=obj -O%d "
|
||||||
"-o \"%.*s.obj\" "
|
"-o \"%.*s.obj\" "
|
||||||
"%.*s "
|
"%.*s "
|
||||||
// "-debug-pass=Arguments "
|
|
||||||
"",
|
"",
|
||||||
LIT(build_context.ODIN_ROOT),
|
LIT(build_context.ODIN_ROOT),
|
||||||
LIT(output_base),
|
LIT(output_base),
|
||||||
@@ -696,7 +695,6 @@ i32 exec_llvm_llc(String output_base) {
|
|||||||
return system_exec_command_line_app("llc", false,
|
return system_exec_command_line_app("llc", false,
|
||||||
"llc \"%.*s.bc\" -filetype=obj -relocation-model=pic -O%d "
|
"llc \"%.*s.bc\" -filetype=obj -relocation-model=pic -O%d "
|
||||||
"%.*s "
|
"%.*s "
|
||||||
// "-debug-pass=Arguments "
|
|
||||||
"%s"
|
"%s"
|
||||||
"",
|
"",
|
||||||
LIT(output_base),
|
LIT(output_base),
|
||||||
|
|||||||
Reference in New Issue
Block a user