Accept -Wl,Map=filename.map

The parameter is stored in tccstate, but nothing more.

Used by multiple software packages.
Current tested example is OpenWatcom-v2

--
bye bye ... Detlef
This commit is contained in:
Detlef Riekenberg 2022-07-28 17:33:51 +02:00
parent 2647dc063d
commit bc12ab02c0
3 changed files with 6 additions and 1 deletions

View file

@ -844,6 +844,7 @@ LIBTCCAPI void tcc_delete(TCCState *s1)
tcc_free(s1->elf_entryname); tcc_free(s1->elf_entryname);
tcc_free(s1->init_symbol); tcc_free(s1->init_symbol);
tcc_free(s1->fini_symbol); tcc_free(s1->fini_symbol);
tcc_free(s1->mapfile);
tcc_free(s1->outfile); tcc_free(s1->outfile);
tcc_free(s1->deps_outfile); tcc_free(s1->deps_outfile);
dynarray_reset(&s1->files, &s1->nb_files); dynarray_reset(&s1->files, &s1->nb_files);
@ -1395,6 +1396,9 @@ static int tcc_set_linker(TCCState *s, const char *option)
} else if (link_option(option, "init=", &p)) { } else if (link_option(option, "init=", &p)) {
copy_linker_arg(&s->init_symbol, p, 0); copy_linker_arg(&s->init_symbol, p, 0);
ignoring = 1; ignoring = 1;
} else if (link_option(option, "Map=", &p)) {
copy_linker_arg(&s->mapfile, p, 0);
ignoring = 1;
} else if (link_option(option, "oformat=", &p)) { } else if (link_option(option, "oformat=", &p)) {
#if defined(TCC_TARGET_PE) #if defined(TCC_TARGET_PE)
if (strstart("pe-", &p)) { if (strstart("pe-", &p)) {

2
tcc.c
View file

@ -144,7 +144,7 @@ static const char help2[] =
" -soname= set DT_SONAME elf tag\n" " -soname= set DT_SONAME elf tag\n"
" -Bsymbolic set DT_SYMBOLIC elf tag\n" " -Bsymbolic set DT_SYMBOLIC elf tag\n"
" -oformat=[elf32/64-* binary] set executable output format\n" " -oformat=[elf32/64-* binary] set executable output format\n"
" -init= -fini= -as-needed -O (ignored)\n" " -init= -fini= -Map= -as-needed -O (ignored)\n"
"Predefined macros:\n" "Predefined macros:\n"
" tcc -E -dM - < /dev/null\n" " tcc -E -dM - < /dev/null\n"
#endif #endif

1
tcc.h
View file

@ -828,6 +828,7 @@ struct TCCState {
char *elf_entryname; /* "_start" unless set */ char *elf_entryname; /* "_start" unless set */
char *init_symbol; /* symbols to call at load-time (not used currently) */ char *init_symbol; /* symbols to call at load-time (not used currently) */
char *fini_symbol; /* symbols to call at unload-time (not used currently) */ char *fini_symbol; /* symbols to call at unload-time (not used currently) */
char *mapfile; /* create a mapfile (not used currently) */
/* output type, see TCC_OUTPUT_XXX */ /* output type, see TCC_OUTPUT_XXX */
int output_type; int output_type;