Parcourir la source

* Factored code to create internal link script for debug sections into a separate procedure.

git-svn-id: trunk@21410 -
sergei il y a 13 ans
Parent
commit
6571b4d140
2 fichiers modifiés avec 17 ajouts et 12 suppressions
  1. 15 0
      compiler/link.pas
  2. 2 12
      compiler/systems/t_win.pas

+ 15 - 0
compiler/link.pas

@@ -115,6 +115,7 @@ interface
          property StaticLibraryList:TFPHashObjectList read FStaticLibraryList;
          property ImportLibraryList:TFPHashObjectList read FImportLibraryList;
          procedure DefaultLinkScript;virtual;abstract;
+         procedure ConcatGenericSections(secnames:string);
       public
          IsSharedLibrary : boolean;
          UseStabs : boolean;
@@ -1334,6 +1335,20 @@ Implementation
       end;
 
 
+    procedure TInternalLinker.ConcatGenericSections(secnames:string);
+      var
+        secname:string;
+      begin
+        repeat
+          secname:=gettoken(secnames,',');
+          if secname='' then
+            break;
+          linkscript.Concat('EXESECTION '+secname);
+          linkscript.Concat('  OBJSECTION '+secname+'*');
+          linkscript.Concat('ENDEXESECTION');
+        until false;
+      end;
+
 {*****************************************************************************
                                  Init/Done
 *****************************************************************************}

+ 2 - 12
compiler/systems/t_win.pas

@@ -941,8 +941,6 @@ implementation
     procedure TInternalLinkerWin.DefaultLinkScript;
       var
         s,s2 : TCmdStr;
-        secname,
-        secnames : string;
       begin
         with LinkScript do
           begin
@@ -1081,17 +1079,9 @@ implementation
             Concat('  OBJSECTION .idata$6*');
             Concat('  OBJSECTION .idata$7*');
             Concat('ENDEXESECTION');
-            secnames:='.edata,.rsrc,.reloc,.gnu_debuglink,'+
+            ConcatGenericSections('.edata,.rsrc,.reloc,.gnu_debuglink,'+
                       '.debug_aranges,.debug_pubnames,.debug_info,.debug_abbrev,.debug_line,.debug_frame,.debug_str,.debug_loc,'+
-                      '.debug_macinfo,.debug_weaknames,.debug_funcnames,.debug_typenames,.debug_varnames,.debug_ranges';
-            repeat
-              secname:=gettoken(secnames,',');
-              if secname='' then
-                break;
-              Concat('EXESECTION '+secname);
-              Concat('  OBJSECTION '+secname+'*');
-              Concat('ENDEXESECTION');
-            until false;
+                      '.debug_macinfo,.debug_weaknames,.debug_funcnames,.debug_typenames,.debug_varnames,.debug_ranges');
             { Can't use the generic rules, because that will add also .stabstr to .stab }
             Concat('EXESECTION .stab');
             Concat('  OBJSECTION .stab');