+ .fini section support

git-svn-id: trunk@8174 -
This commit is contained in:
florian 2007-07-28 08:40:10 +00:00
parent f88fca7d83
commit 4151029ee5
10 changed files with 36 additions and 15 deletions

View File

@ -87,7 +87,8 @@ interface
sec_fpc, sec_fpc,
{ Table of contents section } { Table of contents section }
sec_toc, sec_toc,
sec_init sec_init,
sec_fini
); );
TAsmSectionOrder = (secorder_begin,secorder_default,secorder_end); TAsmSectionOrder = (secorder_begin,secorder_default,secorder_end);

View File

@ -265,7 +265,8 @@ implementation
'.debug_frame','.debug_info','.debug_line','.debug_abbrev', '.debug_frame','.debug_info','.debug_line','.debug_abbrev',
'.fpc', '.fpc',
'.toc', '.toc',
'.init' '.init',
'.fini'
); );
secnames_pic : array[TAsmSectiontype] of string[17] = ('', secnames_pic : array[TAsmSectiontype] of string[17] = ('',
'.text', '.text',
@ -282,7 +283,8 @@ implementation
'.debug_frame','.debug_info','.debug_line','.debug_abbrev', '.debug_frame','.debug_info','.debug_line','.debug_abbrev',
'.fpc', '.fpc',
'.toc', '.toc',
'.init' '.init',
'.fini'
); );
var var
sep : string[3]; sep : string[3];
@ -1161,7 +1163,8 @@ implementation
sec_code (* sec_fpc *), sec_code (* sec_fpc *),
{ Table of contents section } { Table of contents section }
sec_code (* sec_toc *), sec_code (* sec_toc *),
sec_code (* sec_init *) sec_code (* sec_init *),
sec_code (* sec_fini *)
); );
begin begin
Result := inherited SectionName (SecXTable [AType], AName, AOrder); Result := inherited SectionName (SecXTable [AType], AName, AOrder);

View File

@ -470,7 +470,8 @@ interface
'.debug_frame','.debug_info','.debug_line','.debug_abbrev', '.debug_frame','.debug_info','.debug_line','.debug_abbrev',
'.fpc', '.fpc',
'', '',
'.init' '.init',
'.fini'
); );
begin begin
AsmLn; AsmLn;

View File

@ -810,7 +810,8 @@ implementation
'debug_frame','debug_info','debug_line','debug_abbrev', 'debug_frame','debug_info','debug_line','debug_abbrev',
'fpc', 'fpc',
'toc', 'toc',
'init' 'init',
'fini'
); );
var var
sep : string[3]; sep : string[3];
@ -858,7 +859,8 @@ implementation
{debug_abbrev} [oso_Data,oso_noload,oso_debug], {debug_abbrev} [oso_Data,oso_noload,oso_debug],
{fpc} [oso_Data,oso_load,oso_write,oso_keep], {fpc} [oso_Data,oso_load,oso_write,oso_keep],
{toc} [oso_Data,oso_load,oso_readonly], {toc} [oso_Data,oso_load,oso_readonly],
{init} [oso_Data,oso_load,oso_readonly,oso_executable,oso_keep] {init} [oso_Data,oso_load,oso_readonly,oso_executable,oso_keep],
{fini} [oso_Data,oso_load,oso_readonly,oso_executable,oso_keep]
); );
begin begin
result:=secoptions[atype]; result:=secoptions[atype];
@ -1637,8 +1639,8 @@ implementation
procedure TExeOutput.Order_ObjSectionList(ObjSectionList : TFPObjectList); procedure TExeOutput.Order_ObjSectionList(ObjSectionList : TFPObjectList);
begin begin
end; end;
procedure TExeOutput.Order_Symbol(const aname:string); procedure TExeOutput.Order_Symbol(const aname:string);
var var
ObjSection : TObjSection; ObjSection : TObjSection;

View File

@ -486,7 +486,8 @@ implementation
'.debug_frame','.debug_info','.debug_line','.debug_abbrev', '.debug_frame','.debug_info','.debug_line','.debug_abbrev',
'.fpc', '.fpc',
'', '',
'.init' '.init',
'.fini'
); );
const go32v2stub : array[0..2047] of byte=( const go32v2stub : array[0..2047] of byte=(

View File

@ -583,7 +583,8 @@ implementation
'.debug_frame','.debug_info','.debug_line','.debug_abbrev', '.debug_frame','.debug_info','.debug_line','.debug_abbrev',
'.fpc', '.fpc',
'.toc', '.toc',
'.init' '.init',
'.fini'
); );
secnames_pic : array[TAsmSectiontype] of string[17] = ('', secnames_pic : array[TAsmSectiontype] of string[17] = ('',
'.text', '.text',
@ -600,7 +601,8 @@ implementation
'.debug_frame','.debug_info','.debug_line','.debug_abbrev', '.debug_frame','.debug_info','.debug_line','.debug_abbrev',
'.fpc', '.fpc',
'.toc', '.toc',
'.init' '.init',
'.fini'
); );
var var
sep : string[3]; sep : string[3];

View File

@ -774,6 +774,7 @@ implementation
begin begin
result:=create_main_proc(make_mangledname('',current_module.localsymtable,'finalize_implicit'),potype_unitfinalize,st); result:=create_main_proc(make_mangledname('',current_module.localsymtable,'finalize_implicit'),potype_unitfinalize,st);
result.procdef.aliasnames.insert(make_mangledname('FINALIZE$',current_module.localsymtable,'')); result.procdef.aliasnames.insert(make_mangledname('FINALIZE$',current_module.localsymtable,''));
result.procdef.aliasnames.insert('PASCALFINALIZE');
end; end;
else else
internalerror(200304253); internalerror(200304253);
@ -1354,6 +1355,7 @@ implementation
{ Parse the finalize } { Parse the finalize }
finalize_procinfo:=create_main_proc(make_mangledname('',current_module.localsymtable,'finalize'),potype_unitfinalize,current_module.localsymtable); finalize_procinfo:=create_main_proc(make_mangledname('',current_module.localsymtable,'finalize'),potype_unitfinalize,current_module.localsymtable);
finalize_procinfo.procdef.aliasnames.insert(make_mangledname('FINALIZE$',current_module.localsymtable,'')); finalize_procinfo.procdef.aliasnames.insert(make_mangledname('FINALIZE$',current_module.localsymtable,''));
finalize_procinfo.procdef.aliasnames.insert('PASCALFINALIZE');
finalize_procinfo.parse_body; finalize_procinfo.parse_body;
end end
else else

View File

@ -74,7 +74,7 @@ interface
'csect', {read only data} 'csect', {read only data}
'csect', {bss} 'csect', '', 'csect', {bss} 'csect', '',
'csect','csect','csect','csect', 'csect','csect','csect','csect',
'','','','','','','','','','','','','' '','','','','','','','','','','','','',''
); );
type type

View File

@ -52,7 +52,7 @@ unit raatt;
AS_DB,AS_DW,AS_DD,AS_DQ,AS_GLOBAL, AS_DB,AS_DW,AS_DD,AS_DQ,AS_GLOBAL,
AS_ALIGN,AS_BALIGN,AS_P2ALIGN,AS_ASCII, AS_ALIGN,AS_BALIGN,AS_P2ALIGN,AS_ASCII,
AS_ASCIIZ,AS_LCOMM,AS_COMM,AS_SINGLE,AS_DOUBLE,AS_EXTENDED, AS_ASCIIZ,AS_LCOMM,AS_COMM,AS_SINGLE,AS_DOUBLE,AS_EXTENDED,
AS_DATA,AS_TEXT,AS_INIT,AS_END, AS_DATA,AS_TEXT,AS_INIT,AS_FINI,AS_END,
{------------------ Assembler Operators --------------------} {------------------ Assembler Operators --------------------}
AS_TYPE,AS_SIZEOF,AS_VMTOFFSET,AS_MOD,AS_SHL,AS_SHR,AS_NOT,AS_AND,AS_OR,AS_XOR,AS_NOR,AS_AT, AS_TYPE,AS_SIZEOF,AS_VMTOFFSET,AS_MOD,AS_SHL,AS_SHR,AS_NOT,AS_AND,AS_OR,AS_XOR,AS_NOR,AS_AT,
AS_LO,AS_HI); AS_LO,AS_HI);
@ -74,7 +74,7 @@ unit raatt;
'.byte','.word','.long','.quad','.globl', '.byte','.word','.long','.quad','.globl',
'.align','.balign','.p2align','.ascii', '.align','.balign','.p2align','.ascii',
'.asciz','.lcomm','.comm','.single','.double','.tfloat', '.asciz','.lcomm','.comm','.single','.double','.tfloat',
'.data','.text','.init','END', '.data','.text','.init','.fini','END',
'TYPE','SIZEOF','VMTOFFSET','%','<<','>>','!','&','|','^','~','@','lo','hi'); 'TYPE','SIZEOF','VMTOFFSET','%','<<','>>','!','&','|','^','~','@','lo','hi');
type type
@ -987,6 +987,13 @@ unit raatt;
Consume(AS_INIT); Consume(AS_INIT);
end; end;
AS_FINI:
Begin
new_section(curList,sec_fini,lower(current_procinfo.procdef.mangledname),0);
lasTSec:=sec_fini;
Consume(AS_FINI);
end;
AS_DB: AS_DB:
Begin Begin
Consume(AS_DB); Consume(AS_DB);

View File

@ -67,6 +67,7 @@ implementation
'','','','', '','','','',
'', '',
'', '',
'',
'' ''
); );
@ -78,6 +79,7 @@ implementation
'','','','', '','','','',
'', '',
'', '',
'',
'' ''
); );