Allow .asm, .s, and .S as valid assembly file extensions

This commit is contained in:
gingerBill
2021-11-26 22:25:07 +00:00
parent 33dc12a61a
commit 27106dd9ae
3 changed files with 15 additions and 4 deletions
+12
View File
@@ -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
View File
@@ -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
View File
@@ -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);