ref: a6d3df7ac9ec97bd53816c6f61e8b006542e9cf8
parent: 365484ef1898a392d7a201de313a0f93e74ff5bf
author: daid <daid303@gmail.com>
date: Wed Mar 3 05:59:51 EST 2021
Put all local symbols in object/sym/map files (#774) * Store all the local symbols in object files, not only the ones that need linker patches. This generates better map/sym files, and thus allows for better debugging as well. * Add comments explaining the ->src and the (void)arg;
--- a/src/asm/output.c
+++ b/src/asm/output.c
@@ -469,10 +469,12 @@
}
}
-static void registerExportedSymbol(struct Symbol *symbol, void *arg)
+static void registerUnregisteredSymbol(struct Symbol *symbol, void *arg)
{
- (void)arg;
- if (sym_IsExported(symbol) && symbol->ID == -1) {
+ (void)arg; // sym_ForEach requires a void* parameter, but we are not using it.
+
+ // Check for symbol->src, to skip any auto generated symbol from rgbasm
+ if (symbol->src && symbol->ID == -1) {
registerSymbol(symbol);
}
}
@@ -491,8 +493,8 @@
if (!f)
err(1, "Couldn't write file '%s'", tzObjectname);
- /* Also write exported symbols that weren't written above */
- sym_ForEach(registerExportedSymbol, NULL);
+ /* Also write symbols that weren't written above */
+ sym_ForEach(registerUnregisteredSymbol, NULL);
fprintf(f, RGBDS_OBJECT_VERSION_STRING, RGBDS_OBJECT_VERSION_NUMBER);
putlong(RGBDS_OBJECT_REV, f);