Add a character or characters to the start of a symbol name when .model has a languag...
authorRobert Pengelly <robertapengelly@hotmail.com>
Thu, 5 Sep 2024 12:52:29 +0000 (13:52 +0100)
committerRobert Pengelly <robertapengelly@hotmail.com>
Thu, 5 Sep 2024 12:52:29 +0000 (13:52 +0100)
obj.c

diff --git a/obj.c b/obj.c
index 9eda912fcda991d39b7967d8b1bb707d2c024752..e9eae0251daba45d937ee3ea19d9dc1d2124eeb8 100644 (file)
--- 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");