diff --git a/compiler/systems/t_embed.pas b/compiler/systems/t_embed.pas index 5cd545fb1c..2ea812cc1c 100644 --- a/compiler/systems/t_embed.pas +++ b/compiler/systems/t_embed.pas @@ -74,7 +74,7 @@ const begin with Info do begin - ExeCmd[1]:='ld -g '+platform_select+' $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP -L. -o $EXE -T $RES'; + ExeCmd[1]:='ld -g '+platform_select+' $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP $MAP -L. -o $EXE -T $RES'; end; end; @@ -1254,7 +1254,8 @@ end; function TlinkerEmbedded.MakeExecutable:boolean; var binstr, - cmdstr : TCmdStr; + cmdstr, + mapstr: TCmdStr; success : boolean; StaticStr, GCSectionsStr, @@ -1264,6 +1265,7 @@ begin { for future use } StaticStr:=''; StripStr:=''; + mapstr:=''; DynLinkStr:=''; GCSectionsStr:='--gc-sections'; @@ -1271,6 +1273,9 @@ begin if not(cs_link_nolink in current_settings.globalswitches) then Message1(exec_i_linking,current_module.exefilename); + if (cs_link_map in current_settings.globalswitches) then + mapstr:='-Map '+maybequoted(ChangeFileExt(current_module.exefilename,'.map')); + { Write used files and libraries } WriteResponseFile(); @@ -1283,6 +1288,7 @@ begin Replace(cmdstr,'$RES',(maybequoted(ScriptFixFileName(outputexedir+Info.ResName)))); Replace(cmdstr,'$STATIC',StaticStr); Replace(cmdstr,'$STRIP',StripStr); + Replace(cmdstr,'$MAP',mapstr); Replace(cmdstr,'$GCSECTIONS',GCSectionsStr); Replace(cmdstr,'$DYNLINK',DynLinkStr); end @@ -1292,6 +1298,7 @@ begin Replace(cmdstr,'$RES',maybequoted(ScriptFixFileName(outputexedir+Info.ResName))); Replace(cmdstr,'$STATIC',StaticStr); Replace(cmdstr,'$STRIP',StripStr); + Replace(cmdstr,'$MAP',mapstr); Replace(cmdstr,'$GCSECTIONS',GCSectionsStr); Replace(cmdstr,'$DYNLINK',DynLinkStr); end;