mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-15 07:31:26 -07:00
Allow .asm, .s, and .S as valid assembly file extensions
This commit is contained in:
@@ -822,6 +822,18 @@ bool show_error_line(void) {
|
||||
return build_context.show_error_line;
|
||||
}
|
||||
|
||||
bool has_asm_extension(String const &path) {
|
||||
String ext = path_extension(path);
|
||||
if (ext == ".asm") {
|
||||
return true;
|
||||
} else if (ext == ".s") {
|
||||
return true;
|
||||
} else if (ext == ".S") {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void init_build_context(TargetMetrics *cross_target) {
|
||||
BuildContext *bc = &build_context;
|
||||
|
||||
+1
-2
@@ -4121,8 +4121,7 @@ void check_add_foreign_import_decl(CheckerContext *ctx, Ast *decl) {
|
||||
add_entity_use(ctx, nullptr, e);
|
||||
}
|
||||
|
||||
String ext = path_extension(fullpath);
|
||||
if (ext == ".asm") {
|
||||
if (has_asm_extension(fullpath)) {
|
||||
if (build_context.metrics.arch != TargetArch_amd64 ||
|
||||
build_context.metrics.os != TargetOs_windows) {
|
||||
error(decl, "Assembly files are not yet supported on this platform: %.*s_%.*s",
|
||||
|
||||
+2
-2
@@ -225,7 +225,7 @@ i32 linker_stage(lbGenerator *gen) {
|
||||
lbModule *m = gen->modules.entries[j].value;
|
||||
for_array(i, m->foreign_library_paths) {
|
||||
String lib = m->foreign_library_paths[i];
|
||||
if (string_ends_with(lib, str_lit(".asm"))) {
|
||||
if (has_asm_extension(lib)) {
|
||||
string_set_add(&asm_files, lib);
|
||||
} else {
|
||||
string_set_add(&libs, lib);
|
||||
@@ -235,7 +235,7 @@ i32 linker_stage(lbGenerator *gen) {
|
||||
|
||||
for_array(i, gen->default_module.foreign_library_paths) {
|
||||
String lib = gen->default_module.foreign_library_paths[i];
|
||||
if (string_ends_with(lib, str_lit(".asm"))) {
|
||||
if (has_asm_extension(lib)) {
|
||||
string_set_add(&asm_files, lib);
|
||||
} else {
|
||||
string_set_add(&libs, lib);
|
||||
|
||||
Reference in New Issue
Block a user