Przeglądaj źródła

+ .fini section support

git-svn-id: trunk@8174 -
florian 18 lat temu
rodzic
commit
4151029ee5

+ 2 - 1
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);

+ 6 - 3
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);

+ 2 - 1
compiler/i386/ag386nsm.pas

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

+ 6 - 4
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;

+ 2 - 1
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=(

+ 4 - 2
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];

+ 2 - 0
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

+ 1 - 1
compiler/powerpc/agppcmpw.pas

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

+ 9 - 2
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);

+ 2 - 0
compiler/x86/agx86int.pas

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