mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
rgblink -M omits symbol names from .map file
This commit is contained in:
@@ -14,6 +14,7 @@ _rgblink_completions() {
|
|||||||
[w]="wramx:normal"
|
[w]="wramx:normal"
|
||||||
[x]="nopad:normal"
|
[x]="nopad:normal"
|
||||||
[l]="linkerscript:glob-*"
|
[l]="linkerscript:glob-*"
|
||||||
|
[M]="no-sym-in-map:normal"
|
||||||
[m]="map:glob-*.map"
|
[m]="map:glob-*.map"
|
||||||
[n]="sym:glob-*.sym"
|
[n]="sym:glob-*.sym"
|
||||||
[O]="overlay:glob-*.gb *.gbc *.sgb"
|
[O]="overlay:glob-*.gb *.gbc *.sgb"
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ local args=(
|
|||||||
'(-x --nopad)'{-x,--nopad}'[Disable padding the end of the final file]'
|
'(-x --nopad)'{-x,--nopad}'[Disable padding the end of the final file]'
|
||||||
|
|
||||||
'(-l --linkerscript)'{-l,--linkerscript}"+[Use a linker script]:linker script:_files -g '*.link'"
|
'(-l --linkerscript)'{-l,--linkerscript}"+[Use a linker script]:linker script:_files -g '*.link'"
|
||||||
|
'(-M --no-sym-in-map)'{-M,--no-sym-in-map}'[Do not output symbol names in map file]'
|
||||||
'(-m --map)'{-m,--map}"+[Produce a map file]:map file:_files -g '*.map'"
|
'(-m --map)'{-m,--map}"+[Produce a map file]:map file:_files -g '*.map'"
|
||||||
'(-n --sym)'(-n,--sym)"+[Produce a symbol file]:sym file:_files -g '*.sym'"
|
'(-n --sym)'(-n,--sym)"+[Produce a symbol file]:sym file:_files -g '*.sym'"
|
||||||
'(-O --overlay)'{-O,--overlay}'+[Overlay sections over on top of bin file]:base overlay:_files'
|
'(-O --overlay)'{-O,--overlay}'+[Overlay sections over on top of bin file]:base overlay:_files'
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
extern bool isDmgMode;
|
extern bool isDmgMode;
|
||||||
extern char *linkerScriptName;
|
extern char *linkerScriptName;
|
||||||
extern char const *mapFileName;
|
extern char const *mapFileName;
|
||||||
|
extern bool noSymInMap;
|
||||||
extern char const *symFileName;
|
extern char const *symFileName;
|
||||||
extern char const *overlayFileName;
|
extern char const *overlayFileName;
|
||||||
extern char const *outputFileName;
|
extern char const *outputFileName;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
.Nd Game Boy linker
|
.Nd Game Boy linker
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Nm
|
.Nm
|
||||||
.Op Fl dtVvwx
|
.Op Fl dMtVvwx
|
||||||
.Op Fl l Ar linker_script
|
.Op Fl l Ar linker_script
|
||||||
.Op Fl m Ar map_file
|
.Op Fl m Ar map_file
|
||||||
.Op Fl n Ar sym_file
|
.Op Fl n Ar sym_file
|
||||||
@@ -73,6 +73,8 @@ The attributes assigned in the linker script must be consistent with any assigne
|
|||||||
See
|
See
|
||||||
.Xr rgblink 5
|
.Xr rgblink 5
|
||||||
for more information about the linker script format.
|
for more information about the linker script format.
|
||||||
|
.It Fl M , Fl Fl no-sym-in-map
|
||||||
|
If specified, the map file will not list symbols, only sections.
|
||||||
.It Fl m Ar map_file , Fl Fl map Ar map_file
|
.It Fl m Ar map_file , Fl Fl map Ar map_file
|
||||||
Write a map file to the given filename, listing how sections and symbols were assigned.
|
Write a map file to the given filename, listing how sections and symbols were assigned.
|
||||||
.It Fl n Ar sym_file , Fl Fl sym Ar sym_file
|
.It Fl n Ar sym_file , Fl Fl sym Ar sym_file
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
bool isDmgMode; /* -d */
|
bool isDmgMode; /* -d */
|
||||||
char *linkerScriptName; /* -l */
|
char *linkerScriptName; /* -l */
|
||||||
char const *mapFileName; /* -m */
|
char const *mapFileName; /* -m */
|
||||||
|
bool noSymInMap; /* -M */
|
||||||
char const *symFileName; /* -n */
|
char const *symFileName; /* -n */
|
||||||
char const *overlayFileName; /* -O */
|
char const *overlayFileName; /* -O */
|
||||||
char const *outputFileName; /* -o */
|
char const *outputFileName; /* -o */
|
||||||
@@ -165,7 +166,7 @@ FILE *openFile(char const *fileName, char const *mode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Short options */
|
/* 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
|
* Equivalent long options
|
||||||
@@ -181,6 +182,7 @@ static struct option const longopts[] = {
|
|||||||
{ "dmg", no_argument, NULL, 'd' },
|
{ "dmg", no_argument, NULL, 'd' },
|
||||||
{ "linkerscript", required_argument, NULL, 'l' },
|
{ "linkerscript", required_argument, NULL, 'l' },
|
||||||
{ "map", required_argument, NULL, 'm' },
|
{ "map", required_argument, NULL, 'm' },
|
||||||
|
{ "no-sym-in-map", no_argument, NULL, 'M' },
|
||||||
{ "sym", required_argument, NULL, 'n' },
|
{ "sym", required_argument, NULL, 'n' },
|
||||||
{ "overlay", required_argument, NULL, 'O' },
|
{ "overlay", required_argument, NULL, 'O' },
|
||||||
{ "output", required_argument, NULL, 'o' },
|
{ "output", required_argument, NULL, 'o' },
|
||||||
@@ -201,7 +203,7 @@ static struct option const longopts[] = {
|
|||||||
static void printUsage(void)
|
static void printUsage(void)
|
||||||
{
|
{
|
||||||
fputs(
|
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"
|
" [-O overlay_file] [-o out_file] [-p pad_value]\n"
|
||||||
" [-S spec] [-s symbol] <file> ...\n"
|
" [-S spec] [-s symbol] <file> ...\n"
|
||||||
"Useful options:\n"
|
"Useful options:\n"
|
||||||
@@ -374,6 +376,9 @@ int main(int argc, char *argv[])
|
|||||||
case 'l':
|
case 'l':
|
||||||
linkerScriptName = musl_optarg;
|
linkerScriptName = musl_optarg;
|
||||||
break;
|
break;
|
||||||
|
case 'M':
|
||||||
|
noSymInMap = true;
|
||||||
|
break;
|
||||||
case 'm':
|
case 'm':
|
||||||
mapFileName = musl_optarg;
|
mapFileName = musl_optarg;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -394,16 +394,21 @@ static uint16_t writeMapBank(struct SortedSections const *sectList,
|
|||||||
fprintf(mapFile, " SECTION: $%04" PRIx16 " (0 bytes) [\"%s\"]\n",
|
fprintf(mapFile, " SECTION: $%04" PRIx16 " (0 bytes) [\"%s\"]\n",
|
||||||
sect->org, sect->name);
|
sect->org, sect->name);
|
||||||
|
|
||||||
uint16_t org = sect->org;
|
if (!noSymInMap) {
|
||||||
|
uint16_t org = sect->org;
|
||||||
|
|
||||||
while (sect) {
|
while (sect) {
|
||||||
fprintf(mapFile, " ; New %s\n", sect->modifier == SECTION_FRAGMENT ? "fragment": "union");
|
if (sect->modifier == SECTION_UNION)
|
||||||
for (size_t i = 0; i < sect->nbSymbols; i++)
|
fprintf(mapFile, " ; New union\n");
|
||||||
fprintf(mapFile, " $%04" PRIx32 " = %s\n",
|
else if (sect->modifier == SECTION_FRAGMENT)
|
||||||
sect->symbols[i]->offset + org,
|
fprintf(mapFile, " ; New fragment\n");
|
||||||
sect->symbols[i]->name);
|
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;
|
*pickedSection = (*pickedSection)->next;
|
||||||
|
|||||||
Reference in New Issue
Block a user