* Add support for generating map files for embedded target.

git-svn-id: trunk@43866 -
This commit is contained in:
Jeppe Johansen 2020-01-05 17:00:50 +00:00
parent 76e7833a20
commit 89a961f960

View File

@ -74,7 +74,7 @@ const
begin begin
with Info do with Info do
begin 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;
end; end;
@ -1254,7 +1254,8 @@ end;
function TlinkerEmbedded.MakeExecutable:boolean; function TlinkerEmbedded.MakeExecutable:boolean;
var var
binstr, binstr,
cmdstr : TCmdStr; cmdstr,
mapstr: TCmdStr;
success : boolean; success : boolean;
StaticStr, StaticStr,
GCSectionsStr, GCSectionsStr,
@ -1264,6 +1265,7 @@ begin
{ for future use } { for future use }
StaticStr:=''; StaticStr:='';
StripStr:=''; StripStr:='';
mapstr:='';
DynLinkStr:=''; DynLinkStr:='';
GCSectionsStr:='--gc-sections'; GCSectionsStr:='--gc-sections';
@ -1271,6 +1273,9 @@ begin
if not(cs_link_nolink in current_settings.globalswitches) then if not(cs_link_nolink in current_settings.globalswitches) then
Message1(exec_i_linking,current_module.exefilename); 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 } { Write used files and libraries }
WriteResponseFile(); WriteResponseFile();
@ -1283,6 +1288,7 @@ begin
Replace(cmdstr,'$RES',(maybequoted(ScriptFixFileName(outputexedir+Info.ResName)))); Replace(cmdstr,'$RES',(maybequoted(ScriptFixFileName(outputexedir+Info.ResName))));
Replace(cmdstr,'$STATIC',StaticStr); Replace(cmdstr,'$STATIC',StaticStr);
Replace(cmdstr,'$STRIP',StripStr); Replace(cmdstr,'$STRIP',StripStr);
Replace(cmdstr,'$MAP',mapstr);
Replace(cmdstr,'$GCSECTIONS',GCSectionsStr); Replace(cmdstr,'$GCSECTIONS',GCSectionsStr);
Replace(cmdstr,'$DYNLINK',DynLinkStr); Replace(cmdstr,'$DYNLINK',DynLinkStr);
end end
@ -1292,6 +1298,7 @@ begin
Replace(cmdstr,'$RES',maybequoted(ScriptFixFileName(outputexedir+Info.ResName))); Replace(cmdstr,'$RES',maybequoted(ScriptFixFileName(outputexedir+Info.ResName)));
Replace(cmdstr,'$STATIC',StaticStr); Replace(cmdstr,'$STATIC',StaticStr);
Replace(cmdstr,'$STRIP',StripStr); Replace(cmdstr,'$STRIP',StripStr);
Replace(cmdstr,'$MAP',mapstr);
Replace(cmdstr,'$GCSECTIONS',GCSectionsStr); Replace(cmdstr,'$GCSECTIONS',GCSectionsStr);
Replace(cmdstr,'$DYNLINK',DynLinkStr); Replace(cmdstr,'$DYNLINK',DynLinkStr);
end; end;