diff --git a/compiler/ncgutil.pas b/compiler/ncgutil.pas index b41343b37d..3ec0a5621e 100644 --- a/compiler/ncgutil.pas +++ b/compiler/ncgutil.pas @@ -1655,7 +1655,6 @@ implementation procedure alloc_proc_symbol(pd: tprocdef); var - sym: tai_symbol; item: tstringlistitem; begin item := tstringlistitem(pd.aliasnames.first); @@ -1663,10 +1662,9 @@ implementation begin if (cs_profile in aktmoduleswitches) or (po_global in current_procinfo.procdef.procoptions) then - sym := Tai_symbol.createname_global(item.str,AT_FUNCTION,0) + objectlibrary.newasmsymbol(item.str,AB_GLOBAL,AT_FUNCTION) else - sym := Tai_symbol.createname(item.str,AT_FUNCTION,0); - sym.free; + objectlibrary.newasmsymbol(item.str,AB_GLOBAL,AT_FUNCTION); item := tstringlistitem(item.next); end; end; diff --git a/compiler/psub.pas b/compiler/psub.pas index bd0e198b9e..437a580465 100644 --- a/compiler/psub.pas +++ b/compiler/psub.pas @@ -1337,6 +1337,13 @@ implementation { Restore old state } constsymtable:=oldconstsymtable; + { make sure that references to forward-declared functions are not } + { treated as references to external symbols, needed for darwin } + if (po_global in pd.procoptions) then + objectlibrary.newasmsymbol(pd.mangledname,AB_GLOBAL,AT_FUNCTION) + else + objectlibrary.newasmsymbol(pd.mangledname,AB_LOCAL,AT_FUNCTION); + current_procinfo:=old_current_procinfo; end;