(Note to self: always include the root of the working copy in the commit when dealing with merges -.-)

Merged revision(s) 28793, 28903, 31951 from branches/svenbarth/packages:
psub.pas, read_proc:
  * don't generate assembler symbols for compiler internal code
........
Ensure that unneeded initialization/finalization procedures don't leave assembler symbols.

ncgutil.pas:
  + new function release_proc_symbol which removes all assembler symbols of a procdef
pmodules.pas, proc_unit:
  * if the initialization or finalization procedure is empty also remove their assembler symbols so they are exported
........
Ensure that readonly sections that need relocations are indeed declared as such.
Thanks to Jonas for this.

ncgvmt.pas, TVMTWriter:
  * writeinterfaceids: use sec_rodata instead of sec_rodata_norel

........

git-svn-id: trunk@32982 -
This commit is contained in:
svenbarth 2016-01-22 16:58:33 +00:00
parent 53d7018482
commit 557f74cdbd
4 changed files with 26 additions and 5 deletions

View File

@ -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,

View File

@ -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;

View File

@ -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;

View File

@ -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