Browse Source

* Made removal of unused ExeSymbols a separate procedure, call it earlier and regardless of presence of the 'SYMBOLS' directive in the linker script.

git-svn-id: trunk@21727 -
sergei 13 years ago
parent
commit
80bbd388f9
2 changed files with 18 additions and 11 deletions
  1. 1 0
      compiler/link.pas
  2. 17 11
      compiler/ogbase.pas

+ 1 - 0
compiler/link.pas

@@ -1270,6 +1270,7 @@ Implementation
         { Calc positions in mem }
         ParseScript_MemPos;
         exeoutput.FixupRelocations;
+        exeoutput.RemoveUnusedExeSymbols;
         exeoutput.PrintMemoryMap;
         if ErrorCount>0 then
           goto myexit;

+ 17 - 11
compiler/ogbase.pas

@@ -486,6 +486,7 @@ interface
         procedure PrintMemoryMap;
         procedure FixupSymbols;
         procedure FixupRelocations;
+        procedure RemoveUnusedExeSymbols;
         procedure MergeStabs;
         procedure RemoveUnreferencedSections;
         procedure RemoveEmptySections;
@@ -2016,18 +2017,7 @@ implementation
 
 
     procedure TExeOutput.DataPos_Symbols;
-      var
-        i : longint;
-        sym : TExeSymbol;
       begin
-        { Removing unused symbols }
-        for i:=0 to ExeSymbolList.Count-1 do
-          begin
-            sym:=TExeSymbol(ExeSymbolList[i]);
-            if not sym.ObjSymbol.objsection.Used then
-              ExeSymbolList[i]:=nil;
-          end;
-        ExeSymbolList.Pack;
       end;
 
 
@@ -2857,6 +2847,22 @@ implementation
       end;
 
 
+    procedure TExeOutput.RemoveUnusedExeSymbols;
+      var
+        i : longint;
+        sym : TExeSymbol;
+      begin
+        { Removing unused symbols }
+        for i:=0 to ExeSymbolList.Count-1 do
+          begin
+            sym:=TExeSymbol(ExeSymbolList[i]);
+            if not sym.ObjSymbol.objsection.Used then
+              ExeSymbolList[i]:=nil;
+          end;
+        ExeSymbolList.Pack;
+      end;
+
+
     procedure TExeOutput.SetCurrMemPos(const AValue: qword);
       begin
         if AValue>MaxMemPos then