瀏覽代碼

* use ".set" for aliasing global symbols on Darwin, instead of declaring
symbols after each other
o removed the .reference hack that was used previously

git-svn-id: trunk@41885 -

Jonas Maebe 6 年之前
父節點
當前提交
b9ddddf9b1
共有 1 個文件被更改,包括 10 次插入15 次删除
  1. 10 15
      compiler/hlcgobj.pas

+ 10 - 15
compiler/hlcgobj.pas

@@ -4475,24 +4475,23 @@ implementation
 
   procedure thlcgobj.gen_proc_symbol(list: TAsmList);
     var
-      item,
-      previtem : TCmdStrListItem;
+      firstitem,
+      item: TCmdStrListItem;
     begin
-      previtem:=nil;
-      item := TCmdStrListItem(current_procinfo.procdef.aliasnames.first);
+      item:=TCmdStrListItem(current_procinfo.procdef.aliasnames.first);
+      firstitem:=item;
       while assigned(item) do
         begin
 {$ifdef arm}
           if GenerateThumbCode or GenerateThumb2Code then
             list.concat(tai_directive.create(asd_thumb_func,''));
 {$endif arm}
-          { "double link" all procedure entry symbols via .reference }
-          { directives on darwin, because otherwise the linker       }
-          { sometimes strips the procedure if only on of the symbols }
-          { is referenced                                            }
-          if assigned(previtem) and
+          { alias procedure entry symbols via ".set" on Darwin, otherwise
+            they can be interpreted as all different starting symbols of
+            subsections and be reordered }
+          if (item<>firstitem) and
              (target_info.system in systems_darwin) then
-            list.concat(tai_directive.create(asd_reference,item.str));
+            list.concat(tai_symbolpair.create(spk_set,item.str,firstitem.str));
           if (cs_profile in current_settings.moduleswitches) or
              { smart linking using a library requires to promote
                all non-nested procedures to AB_GLOBAL
@@ -4503,13 +4502,9 @@ implementation
             list.concat(Tai_symbol.createname_global(item.str,AT_FUNCTION,0,current_procinfo.procdef))
           else
             list.concat(Tai_symbol.createname(item.str,AT_FUNCTION,0,current_procinfo.procdef));
-          if assigned(previtem) and
-             (target_info.system in systems_darwin) then
-            list.concat(tai_directive.create(asd_reference,previtem.str));
           if not(af_stabs_use_function_absolute_addresses in target_asm.flags) then
             list.concat(Tai_function_name.create(item.str));
-          previtem:=item;
-          item := TCmdStrListItem(item.next);
+          item:=TCmdStrListItem(item.next);
         end;
       current_procinfo.procdef.procstarttai:=tai(list.last);
     end;