Przeglądaj źródła

* support for creating smartlinkable files under darwin. Don't turn on
smartlinking (-XX) yet though, it doesn't work because of bugs in the
current darwin linker regarding dealing with multiple symbols referring
to the same address.

git-svn-id: trunk@4613 -

Jonas Maebe 19 lat temu
rodzic
commit
17e61456c6
3 zmienionych plików z 11 dodań i 3 usunięć
  1. 4 0
      compiler/aggas.pas
  2. 2 2
      compiler/systems/i_bsd.pas
  3. 5 1
      compiler/systems/t_bsd.pas

+ 4 - 0
compiler/aggas.pas

@@ -1062,6 +1062,10 @@ implementation
           AsmWriteLn(target_asm.comment+'End asmlist '+AsmlistTypeStr[hal]);
         end;
 
+      if (cs_create_smart in aktmoduleswitches) and
+         (target_info.system in [system_powerpc_darwin,system_i386_darwin]) then
+        AsmWriteLn(#9'.subsections_via_symbols');
+
       AsmLn;
 {$ifdef EXTDEBUG}
       if assigned(current_module.mainsource) then

+ 2 - 2
compiler/systems/i_bsd.pas

@@ -397,7 +397,7 @@ unit i_bsd;
             system       : system_powerpc_darwin;
             name         : 'Darwin for PowerPC';
             shortname    : 'Darwin';
-            flags        : [tf_p_ext_support,tf_files_case_sensitive];
+            flags        : [tf_p_ext_support,tf_files_case_sensitive,tf_smartlink_sections];
             cpu          : cpu_powerpc;
             unit_env     : 'BSDUNITS';
             extradefines : 'UNIX;BSD;HASUNIX';
@@ -458,7 +458,7 @@ unit i_bsd;
             system       : system_i386_darwin;
             name         : 'Darwin for i386';
             shortname    : 'Darwin';
-            flags        : [tf_p_ext_support,tf_files_case_sensitive];
+            flags        : [tf_p_ext_support,tf_files_case_sensitive,tf_smartlink_sections];
             cpu          : cpu_i386;
             unit_env     : 'BSDUNITS';
             extradefines : 'UNIX;BSD;HASUNIX';

+ 5 - 1
compiler/systems/t_bsd.pas

@@ -519,7 +519,11 @@ begin
 
   if (cs_link_smart in aktglobalswitches) and
      (tf_smartlink_sections in target_info.flags) then
-   GCSectionsStr:='--gc-sections';
+    if not(target_info.system in [system_powerpc_darwin,system_i386_darwin]) then
+      GCSectionsStr:='--gc-sections'
+    else
+      // warning: this option only exists for 32 bit under Mac OS X, maybe the default for 64 bit?
+      GCSectionsStr:='-dead_strip';
 
   If (cs_profile in aktmoduleswitches) or
      ((Info.DynamicLinker<>'') and (not SharedLibFiles.Empty)) then