Browse Source

+ PS1: allow creating a linker map file with the -Xm option

Nikolay Nikolov 10 months ago
parent
commit
0c7aa1805d
1 changed files with 7 additions and 2 deletions
  1. 7 2
      compiler/systems/t_ps1.pas

+ 7 - 2
compiler/systems/t_ps1.pas

@@ -60,7 +60,7 @@ end;
 
 procedure TLinkerPS1.SetDefaultInfo;
 begin
-  info.ExeCmd[1]:= 'ld $OPT $RES';
+  info.ExeCmd[1]:= 'ld $OPT $MAP $RES';
 end;
 
 
@@ -348,9 +348,13 @@ end;
 
 function TLinkerPS1.MakeExecutable: boolean;
 var
-    binstr, cmdstr : TCmdStr;
+    binstr, cmdstr, mapstr : TCmdStr;
     success : boolean;
 begin
+    if (cs_link_map in current_settings.globalswitches) then
+      mapstr:='-Map '+maybequoted(ChangeFileExt(current_module.exefilename,'.map'))
+    else
+      mapstr:='';
 
     WriteScriptFile;
 
@@ -364,6 +368,7 @@ begin
 
     Replace(cmdstr, '$OPT', Info.ExtraOptions);
     Replace(cmdstr, '$RES', '-T ' + (maybequoted(ScriptFixFileName(outputexedir + Info.ResName))));
+    Replace(cmdstr, '$MAP', mapstr);
 
     if cs_link_smart in current_settings.globalswitches then cmdstr:= cmdstr + ' --gc-sections';