From 81420e85265843a1958e5fea97636413307ae307 Mon Sep 17 00:00:00 2001 From: Robert Pengelly Date: Thu, 5 Sep 2024 13:52:29 +0100 Subject: [PATCH] Add a character or characters to the start of a symbol name when .model has a language argument --- obj.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/obj.c b/obj.c index 9eda912..e9eae02 100644 --- a/obj.c +++ b/obj.c @@ -233,6 +233,10 @@ void output_obj (FILE *fp) { write_to_byte_array (symbol_entry.n_strx, string_table_pos, 4); string_table_pos += strlen (symbol->name) + 1; + if (state->ext) { + string_table_pos += strlen (state->ext); + } + if (symbol->section == undefined_section) { symbol_entry.n_type = N_UNDF; } else if (symbol->section == text_section) { @@ -279,6 +283,17 @@ void output_obj (FILE *fp) { if (symbol_is_external (symbol) || symbol_is_undefined (symbol)) { + if (state->ext) { + + if (fwrite (state->ext, strlen (state->ext), 1, fp) != 1) { + + report_at (program_name, 0, REPORT_ERROR, "failed to write string table"); + return; + + } + + } + if (fwrite (symbol->name, strlen (symbol->name) + 1, 1, fp) != 1) { report_at (program_name, 0, REPORT_ERROR, "failed to write string table"); -- 2.34.1