Quellcode durchsuchen

Add experimental target `orca_wasm32`

gingerBill vor 1 Jahr
Ursprung
Commit
e737122ce8
3 geänderte Dateien mit 30 neuen und 5 gelöschten Zeilen
  1. 13 1
      src/build_settings.cpp
  2. 1 0
      src/checker.cpp
  3. 16 4
      src/linker.cpp

+ 13 - 1
src/build_settings.cpp

@@ -23,6 +23,7 @@ enum TargetOsKind : u16 {
 	
 	TargetOs_wasi,
 	TargetOs_js,
+	TargetOs_orca,
 
 	TargetOs_freestanding,
 
@@ -90,6 +91,7 @@ gb_global String target_os_names[TargetOs_COUNT] = {
 	
 	str_lit("wasi"),
 	str_lit("js"),
+	str_lit("orca"),
 
 	str_lit("freestanding"),
 };
@@ -1067,6 +1069,15 @@ gb_global TargetMetrics target_wasi_wasm32 = {
 };
 
 
+gb_global TargetMetrics target_orca_wasm32 = {
+	TargetOs_orca,
+	TargetArch_wasm32,
+	4, 4, 8, 16,
+	str_lit("wasm32-wasi-js"),
+	// str_lit("e-m:e-p:32:32-i64:64-n32:64-S128"),
+};
+
+
 gb_global TargetMetrics target_freestanding_wasm64p32 = {
 	TargetOs_freestanding,
 	TargetArch_wasm64p32,
@@ -2012,8 +2023,9 @@ gb_internal void init_build_context(TargetMetrics *cross_target, Subtarget subta
 		// if (bc->metrics.arch == TargetArch_wasm64) {
 		// 	link_flags = gb_string_appendc(link_flags, "-mwasm64 ");
 		// }
-		if (bc->no_entry_point) {
+		if (bc->no_entry_point || bc->metrics.os == TargetOs_orca) {
 			link_flags = gb_string_appendc(link_flags, "--no-entry ");
+			bc->no_entry_point = true; // just in case for the "orca" target
 		}
 		
 		bc->link_flags = make_string_c(link_flags);

+ 1 - 0
src/checker.cpp

@@ -1016,6 +1016,7 @@ gb_internal void init_universal(void) {
 			{"NetBSD",       TargetOs_netbsd},
 			{"WASI",         TargetOs_wasi},
 			{"JS",           TargetOs_js},
+			{"Orca",         TargetOs_orca},
 			{"Freestanding", TargetOs_freestanding},
 		};
 

+ 16 - 4
src/linker.cpp

@@ -69,15 +69,27 @@ gb_internal i32 linker_stage(LinkerData *gen) {
 	if (is_arch_wasm()) {
 		timings_start_section(timings, str_lit("wasm-ld"));
 
+		String extra_orca_flags = {};
+
 	#if defined(GB_SYSTEM_WINDOWS)
+		if (build_context.metrics.os == TargetOs_orca) {
+			extra_orca_flags = str_lit(" W:/orca/installation/dev-afb9591/bin/liborca_wasm.a --export-dynamic");
+		}
+
 		result = system_exec_command_line_app("wasm-ld",
-			"\"%.*s\\bin\\wasm-ld\" \"%.*s.o\" -o \"%.*s\" %.*s %.*s",
+			"\"%.*s\\bin\\wasm-ld\" \"%.*s.o\" -o \"%.*s\" %.*s %.*s %.*s",
 			LIT(build_context.ODIN_ROOT),
-			LIT(output_filename), LIT(output_filename), LIT(build_context.link_flags), LIT(build_context.extra_linker_flags));
+			LIT(output_filename), LIT(output_filename), LIT(build_context.link_flags), LIT(build_context.extra_linker_flags),
+			LIT(extra_orca_flags));
 	#else
+		if (build_context.metrics.os == TargetOs_orca) {
+					extra_orca_flags = str_lit(" -L . -lorca --export-dynamic");
+				}
+
 		result = system_exec_command_line_app("wasm-ld",
-			"wasm-ld \"%.*s.o\" -o \"%.*s\" %.*s %.*s",
-			LIT(output_filename), LIT(output_filename), LIT(build_context.link_flags), LIT(build_context.extra_linker_flags));
+			"wasm-ld \"%.*s.o\" -o \"%.*s\" %.*s %.*s %.*s",
+			LIT(output_filename), LIT(output_filename), LIT(build_context.link_flags), LIT(build_context.extra_linker_flags),
+			LIT(extra_orca_flags));
 	#endif
 		return result;
 	}