diff --git a/compiler/aasmbase.pas b/compiler/aasmbase.pas index 902d074dd8..db40633ab3 100644 --- a/compiler/aasmbase.pas +++ b/compiler/aasmbase.pas @@ -87,7 +87,8 @@ interface sec_fpc, { Table of contents section } sec_toc, - sec_init + sec_init, + sec_fini ); TAsmSectionOrder = (secorder_begin,secorder_default,secorder_end); diff --git a/compiler/aggas.pas b/compiler/aggas.pas index 694963dedb..08247d623f 100644 --- a/compiler/aggas.pas +++ b/compiler/aggas.pas @@ -265,7 +265,8 @@ implementation '.debug_frame','.debug_info','.debug_line','.debug_abbrev', '.fpc', '.toc', - '.init' + '.init', + '.fini' ); secnames_pic : array[TAsmSectiontype] of string[17] = ('', '.text', @@ -282,7 +283,8 @@ implementation '.debug_frame','.debug_info','.debug_line','.debug_abbrev', '.fpc', '.toc', - '.init' + '.init', + '.fini' ); var sep : string[3]; @@ -1161,7 +1163,8 @@ implementation sec_code (* sec_fpc *), { Table of contents section } sec_code (* sec_toc *), - sec_code (* sec_init *) + sec_code (* sec_init *), + sec_code (* sec_fini *) ); begin Result := inherited SectionName (SecXTable [AType], AName, AOrder); diff --git a/compiler/i386/ag386nsm.pas b/compiler/i386/ag386nsm.pas index cc232c5282..27b4a0135a 100644 --- a/compiler/i386/ag386nsm.pas +++ b/compiler/i386/ag386nsm.pas @@ -470,7 +470,8 @@ interface '.debug_frame','.debug_info','.debug_line','.debug_abbrev', '.fpc', '', - '.init' + '.init', + '.fini' ); begin AsmLn; diff --git a/compiler/ogbase.pas b/compiler/ogbase.pas index 5cdb159421..9d687c2390 100644 --- a/compiler/ogbase.pas +++ b/compiler/ogbase.pas @@ -810,7 +810,8 @@ implementation 'debug_frame','debug_info','debug_line','debug_abbrev', 'fpc', 'toc', - 'init' + 'init', + 'fini' ); var sep : string[3]; @@ -858,7 +859,8 @@ implementation {debug_abbrev} [oso_Data,oso_noload,oso_debug], {fpc} [oso_Data,oso_load,oso_write,oso_keep], {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 result:=secoptions[atype]; @@ -1637,8 +1639,8 @@ implementation procedure TExeOutput.Order_ObjSectionList(ObjSectionList : TFPObjectList); begin end; - - + + procedure TExeOutput.Order_Symbol(const aname:string); var ObjSection : TObjSection; diff --git a/compiler/ogcoff.pas b/compiler/ogcoff.pas index d745f52961..912aee0a84 100644 --- a/compiler/ogcoff.pas +++ b/compiler/ogcoff.pas @@ -486,7 +486,8 @@ implementation '.debug_frame','.debug_info','.debug_line','.debug_abbrev', '.fpc', '', - '.init' + '.init', + '.fini' ); const go32v2stub : array[0..2047] of byte=( diff --git a/compiler/ogelf.pas b/compiler/ogelf.pas index 1d565debfb..febbc6e17e 100644 --- a/compiler/ogelf.pas +++ b/compiler/ogelf.pas @@ -583,7 +583,8 @@ implementation '.debug_frame','.debug_info','.debug_line','.debug_abbrev', '.fpc', '.toc', - '.init' + '.init', + '.fini' ); secnames_pic : array[TAsmSectiontype] of string[17] = ('', '.text', @@ -600,7 +601,8 @@ implementation '.debug_frame','.debug_info','.debug_line','.debug_abbrev', '.fpc', '.toc', - '.init' + '.init', + '.fini' ); var sep : string[3]; diff --git a/compiler/pmodules.pas b/compiler/pmodules.pas index 1e5bb4ace6..551ffc8637 100644 --- a/compiler/pmodules.pas +++ b/compiler/pmodules.pas @@ -774,6 +774,7 @@ implementation begin 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('PASCALFINALIZE'); end; else internalerror(200304253); @@ -1354,6 +1355,7 @@ implementation { Parse the finalize } 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('PASCALFINALIZE'); finalize_procinfo.parse_body; end else diff --git a/compiler/powerpc/agppcmpw.pas b/compiler/powerpc/agppcmpw.pas index 31017f4717..a1d1ef4043 100644 --- a/compiler/powerpc/agppcmpw.pas +++ b/compiler/powerpc/agppcmpw.pas @@ -74,7 +74,7 @@ interface 'csect', {read only data} 'csect', {bss} 'csect', '', 'csect','csect','csect','csect', - '','','','','','','','','','','','','' + '','','','','','','','','','','','','','' ); type diff --git a/compiler/raatt.pas b/compiler/raatt.pas index ae0e654c0e..496d77dd67 100644 --- a/compiler/raatt.pas +++ b/compiler/raatt.pas @@ -52,7 +52,7 @@ unit raatt; AS_DB,AS_DW,AS_DD,AS_DQ,AS_GLOBAL, AS_ALIGN,AS_BALIGN,AS_P2ALIGN,AS_ASCII, 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 --------------------} 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); @@ -74,7 +74,7 @@ unit raatt; '.byte','.word','.long','.quad','.globl', '.align','.balign','.p2align','.ascii', '.asciz','.lcomm','.comm','.single','.double','.tfloat', - '.data','.text','.init','END', + '.data','.text','.init','.fini','END', 'TYPE','SIZEOF','VMTOFFSET','%','<<','>>','!','&','|','^','~','@','lo','hi'); type @@ -987,6 +987,13 @@ unit raatt; Consume(AS_INIT); end; + AS_FINI: + Begin + new_section(curList,sec_fini,lower(current_procinfo.procdef.mangledname),0); + lasTSec:=sec_fini; + Consume(AS_FINI); + end; + AS_DB: Begin Consume(AS_DB); diff --git a/compiler/x86/agx86int.pas b/compiler/x86/agx86int.pas index abbefa2131..d9005aa1ae 100644 --- a/compiler/x86/agx86int.pas +++ b/compiler/x86/agx86int.pas @@ -67,6 +67,7 @@ implementation '','','','', '', '', + '', '' ); @@ -78,6 +79,7 @@ implementation '','','','', '', '', + '', '' );