Browse Source

Add replacement of $GCSECTIONS for shared libraries

git-svn-id: trunk@39403 -
pierre 7 years ago
parent
commit
6cab9fd7db
1 changed files with 7 additions and 0 deletions
  1. 7 0
      compiler/systems/t_linux.pas

+ 7 - 0
compiler/systems/t_linux.pas

@@ -1435,6 +1435,7 @@ Function TLinkerLinux.MakeSharedLibrary:boolean;
 var
 var
   InitStr,
   InitStr,
   FiniStr,
   FiniStr,
+  GCSectionsStr,
   SoNameStr : string[80];
   SoNameStr : string[80];
   binstr,
   binstr,
   cmdstr  : TCmdStr;
   cmdstr  : TCmdStr;
@@ -1443,6 +1444,11 @@ begin
   MakeSharedLibrary:=false;
   MakeSharedLibrary:=false;
   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.sharedlibfilename);
    Message1(exec_i_linking,current_module.sharedlibfilename);
+  if (cs_link_smart in current_settings.globalswitches) and
+     create_smartlink_sections then
+   GCSectionsStr:='--gc-sections'
+  else
+    GCSectionsStr:='';
 
 
 { Write used files and libraries }
 { Write used files and libraries }
   WriteResponseFile(true);
   WriteResponseFile(true);
@@ -1461,6 +1467,7 @@ begin
   Replace(cmdstr,'$INIT',InitStr);
   Replace(cmdstr,'$INIT',InitStr);
   Replace(cmdstr,'$FINI',FiniStr);
   Replace(cmdstr,'$FINI',FiniStr);
   Replace(cmdstr,'$SONAME',SoNameStr);
   Replace(cmdstr,'$SONAME',SoNameStr);
+  Replace(cmdstr,'$GCSECTIONS',GCSectionsStr);
   success:=DoExec(FindUtil(utilsprefix+binstr),cmdstr,true,false);
   success:=DoExec(FindUtil(utilsprefix+binstr),cmdstr,true,false);
 
 
 { Strip the library ? }
 { Strip the library ? }