mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-23 11:32:07 +00:00
rgblink -M omits symbol names from .map file
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
bool isDmgMode; /* -d */
|
||||
char *linkerScriptName; /* -l */
|
||||
char const *mapFileName; /* -m */
|
||||
bool noSymInMap; /* -M */
|
||||
char const *symFileName; /* -n */
|
||||
char const *overlayFileName; /* -O */
|
||||
char const *outputFileName; /* -o */
|
||||
@@ -165,7 +166,7 @@ FILE *openFile(char const *fileName, char const *mode)
|
||||
}
|
||||
|
||||
/* Short options */
|
||||
static const char *optstring = "dl:m:n:O:o:p:S:s:tVvWwx";
|
||||
static const char *optstring = "dl:m:Mn:O:o:p:S:s:tVvWwx";
|
||||
|
||||
/*
|
||||
* Equivalent long options
|
||||
@@ -181,6 +182,7 @@ static struct option const longopts[] = {
|
||||
{ "dmg", no_argument, NULL, 'd' },
|
||||
{ "linkerscript", required_argument, NULL, 'l' },
|
||||
{ "map", required_argument, NULL, 'm' },
|
||||
{ "no-sym-in-map", no_argument, NULL, 'M' },
|
||||
{ "sym", required_argument, NULL, 'n' },
|
||||
{ "overlay", required_argument, NULL, 'O' },
|
||||
{ "output", required_argument, NULL, 'o' },
|
||||
@@ -201,7 +203,7 @@ static struct option const longopts[] = {
|
||||
static void printUsage(void)
|
||||
{
|
||||
fputs(
|
||||
"Usage: rgblink [-dtVvwx] [-l script] [-m map_file] [-n sym_file]\n"
|
||||
"Usage: rgblink [-dMtVvwx] [-l script] [-m map_file] [-n sym_file]\n"
|
||||
" [-O overlay_file] [-o out_file] [-p pad_value]\n"
|
||||
" [-S spec] [-s symbol] <file> ...\n"
|
||||
"Useful options:\n"
|
||||
@@ -374,6 +376,9 @@ int main(int argc, char *argv[])
|
||||
case 'l':
|
||||
linkerScriptName = musl_optarg;
|
||||
break;
|
||||
case 'M':
|
||||
noSymInMap = true;
|
||||
break;
|
||||
case 'm':
|
||||
mapFileName = musl_optarg;
|
||||
break;
|
||||
|
||||
@@ -394,16 +394,21 @@ static uint16_t writeMapBank(struct SortedSections const *sectList,
|
||||
fprintf(mapFile, " SECTION: $%04" PRIx16 " (0 bytes) [\"%s\"]\n",
|
||||
sect->org, sect->name);
|
||||
|
||||
uint16_t org = sect->org;
|
||||
if (!noSymInMap) {
|
||||
uint16_t org = sect->org;
|
||||
|
||||
while (sect) {
|
||||
fprintf(mapFile, " ; New %s\n", sect->modifier == SECTION_FRAGMENT ? "fragment": "union");
|
||||
for (size_t i = 0; i < sect->nbSymbols; i++)
|
||||
fprintf(mapFile, " $%04" PRIx32 " = %s\n",
|
||||
sect->symbols[i]->offset + org,
|
||||
sect->symbols[i]->name);
|
||||
while (sect) {
|
||||
if (sect->modifier == SECTION_UNION)
|
||||
fprintf(mapFile, " ; New union\n");
|
||||
else if (sect->modifier == SECTION_FRAGMENT)
|
||||
fprintf(mapFile, " ; New fragment\n");
|
||||
for (size_t i = 0; i < sect->nbSymbols; i++)
|
||||
fprintf(mapFile, " $%04" PRIx32 " = %s\n",
|
||||
sect->symbols[i]->offset + org,
|
||||
sect->symbols[i]->name);
|
||||
|
||||
sect = sect->nextu; // Also print symbols in the following "pieces"
|
||||
sect = sect->nextu; // Also print symbols in the following "pieces"
|
||||
}
|
||||
}
|
||||
|
||||
*pickedSection = (*pickedSection)->next;
|
||||
|
||||
Reference in New Issue
Block a user