diff --git a/compiler/ncgutil.pas b/compiler/ncgutil.pas index fba6355281..12cedcda21 100644 --- a/compiler/ncgutil.pas +++ b/compiler/ncgutil.pas @@ -76,6 +76,7 @@ interface function has_alias_name(pd:tprocdef;const s:string):boolean; procedure alloc_proc_symbol(pd: tprocdef); + procedure release_proc_symbol(pd:tprocdef); procedure gen_proc_entry_code(list:TAsmList); procedure gen_proc_exit_code(list:TAsmList); procedure gen_stack_check_size_para(list:TAsmList); @@ -1363,6 +1364,22 @@ implementation end; + procedure release_proc_symbol(pd:tprocdef); + var + idx : longint; + item : TCmdStrListItem; + begin + item:=TCmdStrListItem(pd.aliasnames.first); + while assigned(item) do + begin + idx:=current_asmdata.AsmSymbolDict.findindexof(item.str); + if idx>=0 then + current_asmdata.AsmSymbolDict.Delete(idx); + item:=TCmdStrListItem(item.next); + end; + end; + + procedure gen_proc_entry_code(list:TAsmList); var hitemp, diff --git a/compiler/ncgvmt.pas b/compiler/ncgvmt.pas index 1104b5ae58..9dff127af3 100644 --- a/compiler/ncgvmt.pas +++ b/compiler/ncgvmt.pas @@ -905,7 +905,7 @@ implementation list.concatlist(tcb.get_final_asmlist( current_asmdata.DefineAsmSymbol(s,AB_GLOBAL,AT_DATA), rec_tguid, - sec_rodata_norel, + sec_rodata, s, const_align(sizeof(pint)))); tcb.free; @@ -916,7 +916,7 @@ implementation list.concatlist(tcb.get_final_asmlist( current_asmdata.DefineAsmSymbol(s,AB_GLOBAL,AT_DATA), def, - sec_rodata_norel, + sec_rodata, s, sizeof(pint))); tcb.free; diff --git a/compiler/pmodules.pas b/compiler/pmodules.pas index db68ed8f13..510d1b912c 100644 --- a/compiler/pmodules.pas +++ b/compiler/pmodules.pas @@ -1164,7 +1164,9 @@ type init_procinfo.code:=cnodeutils.wrap_proc_body(init_procinfo.procdef,init_procinfo.code); init_procinfo.generate_code; current_module.flags:=current_module.flags or uf_init; - end; + end + else + release_proc_symbol(init_procinfo.procdef); init_procinfo.resetprocdef; release_main_proc(init_procinfo); end; @@ -1177,7 +1179,9 @@ type finalize_procinfo.code:=cnodeutils.wrap_proc_body(finalize_procinfo.procdef,finalize_procinfo.code); finalize_procinfo.generate_code; current_module.flags:=current_module.flags or uf_finalize; - end; + end + else + release_proc_symbol(finalize_procinfo.procdef); finalize_procinfo.resetprocdef; release_main_proc(finalize_procinfo); end; diff --git a/compiler/psub.pas b/compiler/psub.pas index 8c80de291d..348ccad6c3 100644 --- a/compiler/psub.pas +++ b/compiler/psub.pas @@ -2202,7 +2202,7 @@ implementation { treated as references to external symbols, needed for darwin. } { make sure we don't change the binding of real external symbols } - if ([po_external,po_weakexternal]*pd.procoptions)=[] then + if (([po_external,po_weakexternal]*pd.procoptions)=[]) and (pocall_internproc<>pd.proccalloption) then begin if (po_global in pd.procoptions) or (cs_profile in current_settings.moduleswitches) then