From bc12ab02c04ee18dee2e87d9c30e06ed739b1275 Mon Sep 17 00:00:00 2001 From: Detlef Riekenberg Date: Thu, 28 Jul 2022 17:33:51 +0200 Subject: [PATCH] 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 --- libtcc.c | 4 ++++ tcc.c | 2 +- tcc.h | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/libtcc.c b/libtcc.c index 66baaa82..4327a135 100644 --- a/libtcc.c +++ b/libtcc.c @@ -844,6 +844,7 @@ LIBTCCAPI void tcc_delete(TCCState *s1) tcc_free(s1->elf_entryname); tcc_free(s1->init_symbol); tcc_free(s1->fini_symbol); + tcc_free(s1->mapfile); tcc_free(s1->outfile); tcc_free(s1->deps_outfile); 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)) { copy_linker_arg(&s->init_symbol, p, 0); 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)) { #if defined(TCC_TARGET_PE) if (strstart("pe-", &p)) { diff --git a/tcc.c b/tcc.c index fe530e39..ad9f636a 100644 --- a/tcc.c +++ b/tcc.c @@ -144,7 +144,7 @@ static const char help2[] = " -soname= set DT_SONAME elf tag\n" " -Bsymbolic set DT_SYMBOLIC elf tag\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" " tcc -E -dM - < /dev/null\n" #endif diff --git a/tcc.h b/tcc.h index d30d5dac..9605a9db 100644 --- a/tcc.h +++ b/tcc.h @@ -828,6 +828,7 @@ struct TCCState { char *elf_entryname; /* "_start" unless set */ 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 *mapfile; /* create a mapfile (not used currently) */ /* output type, see TCC_OUTPUT_XXX */ int output_type;