2
0
Эх сурвалжийг харах

+ enable linker map file creation for the llvm WebAssembly linker. Note: this requires LLVM 12, which is not yet released.

git-svn-id: branches/wasm@48249 -
nickysn 4 жил өмнө
parent
commit
23e7e9530e

+ 7 - 2
compiler/systems/t_wasi.pas

@@ -74,6 +74,7 @@ type
 implementation
 
 uses
+  SysUtils,
   verbose;
 
 { timportlibwasi }
@@ -91,7 +92,7 @@ end;
 
 procedure tlinkerwasi.SetDefaultInfo;
 begin
-  Info.DllCmd[1] := 'wasm-ld $SONAME $GCSECTIONS -o $EXE';
+  Info.DllCmd[1] := 'wasm-ld $SONAME $GCSECTIONS $MAP -o $EXE';
   //Info.DllCmd[2] := 'wasmtool --exportrename $INPUT $EXE';
 end;
 
@@ -111,6 +112,10 @@ begin
   if not(cs_link_nolink in current_settings.globalswitches) then
     Message1(exec_i_linking,current_module.exefilename);
 
+  { Create some replacements }
+  mapstr:='';
+  if (cs_link_map in current_settings.globalswitches) then
+    mapstr:='-Map '+maybequoted(ChangeFileExt(current_module.exefilename,'.map'));
   if (cs_link_smart in current_settings.globalswitches) and
      create_smartlink_sections then
    GCSectionsStr:='--gc-sections'
@@ -143,7 +148,7 @@ begin
   //Replace(cmdstr,'$INIT',InitStr);
   //Replace(cmdstr,'$FINI',FiniStr);
   Replace(cmdstr,'$SONAME',SoNameStr);
-  //Replace(cmdstr,'$MAP',mapstr);
+  Replace(cmdstr,'$MAP',mapstr);
   //Replace(cmdstr,'$LTO',ltostr);
   Replace(cmdstr,'$GCSECTIONS',GCSectionsStr);
   writeln(utilsprefix+binstr,' ',cmdstr);