* 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 -
This commit is contained in:
Jonas Maebe 2019-04-16 16:11:54 +00:00
parent e008785152
commit b9ddddf9b1

View File

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