Explorar o código

* use new_section() instead of tai_section.create() everywhere
- sort of reverted r14134, which is no longer required after the above
change (new_section() inserts the alignment itself)
* made the tai_section.create() constructor private so it cannot be
called directly anymore

git-svn-id: trunk@15482 -

Jonas Maebe %!s(int64=15) %!d(string=hai) anos
pai
achega
356026f849

+ 1 - 1
compiler/aasmdata.pas

@@ -334,7 +334,7 @@ implementation
         WideInits :=TLinkedList.create;
         WideInits :=TLinkedList.create;
         { PIC data }
         { PIC data }
         if (target_info.system in [system_powerpc_darwin,system_powerpc64_darwin,system_i386_darwin,system_arm_darwin]) then
         if (target_info.system in [system_powerpc_darwin,system_powerpc64_darwin,system_i386_darwin,system_arm_darwin]) then
-          AsmLists[al_picdata].concat(tai_section.create(sec_data_nonlazy,'',sizeof(pint)));
+          new_section(AsmLists[al_picdata],sec_data_nonlazy,'',sizeof(pint));
         { CFI }
         { CFI }
         FAsmCFI:=CAsmCFI.Create;
         FAsmCFI:=CAsmCFI.Create;
       end;
       end;

+ 4 - 3
compiler/aasmtai.pas

@@ -385,10 +385,12 @@ interface
           secalign : byte;
           secalign : byte;
           name     : pshortstring;
           name     : pshortstring;
           sec      : TObjSection; { used in binary writer }
           sec      : TObjSection; { used in binary writer }
-          constructor Create(Asectype:TAsmSectiontype;Aname:string;Aalign:byte;Asecorder:TasmSectionorder=secorder_default);
           destructor Destroy;override;
           destructor Destroy;override;
           constructor ppuload(t:taitype;ppufile:tcompilerppufile);override;
           constructor ppuload(t:taitype;ppufile:tcompilerppufile);override;
           procedure ppuwrite(ppufile:tcompilerppufile);override;
           procedure ppuwrite(ppufile:tcompilerppufile);override;
+         private
+          { sections should be created via new_section() }
+          constructor Create(Asectype:TAsmSectiontype;Aname:string;Aalign:byte;Asecorder:TasmSectionorder=secorder_default);
        end;
        end;
 
 
 
 
@@ -690,8 +692,7 @@ implementation
                                    Aglobal:boolean;Asectype:TAsmSectiontype;Aalign:byte);
                                    Aglobal:boolean;Asectype:TAsmSectiontype;Aalign:byte);
       begin
       begin
         maybe_new_object_file(list);
         maybe_new_object_file(list);
-        list.concat(tai_section.create(Asectype,Aname,Aalign));
-        list.concat(cai_align.create(Aalign));
+        new_section(list,Asectype,Aname,Aalign);
         if Aglobal or
         if Aglobal or
            create_smartlink then
            create_smartlink then
           list.concat(tai_symbol.createname_global(Aname,Asymtyp,0))
           list.concat(tai_symbol.createname_global(Aname,Asymtyp,0))

+ 0 - 1
compiler/aggas.pas

@@ -705,7 +705,6 @@ implementation
                    AsmWriteln(' sec_none');
                    AsmWriteln(' sec_none');
 {$endif EXTDEBUG}
 {$endif EXTDEBUG}
                 end;
                 end;
-               doalign(tai_section(hp).secalign,false,0,last_align);
              end;
              end;
 
 
            ait_datablock :
            ait_datablock :

+ 2 - 3
compiler/arm/cgcpu.pas

@@ -2533,8 +2533,7 @@ unit cgcpu;
         if current_asmdata.asmlists[al_imports]=nil then
         if current_asmdata.asmlists[al_imports]=nil then
           current_asmdata.asmlists[al_imports]:=TAsmList.create;
           current_asmdata.asmlists[al_imports]:=TAsmList.create;
 
 
-        current_asmdata.asmlists[al_imports].concat(Tai_section.create(sec_stub,'',0));
-        current_asmdata.asmlists[al_imports].concat(Tai_align.Create(4));
+        new_section(current_asmdata.asmlists[al_imports],sec_stub,'',4);
         result := current_asmdata.RefAsmSymbol(stubname);
         result := current_asmdata.RefAsmSymbol(stubname);
         current_asmdata.asmlists[al_imports].concat(Tai_symbol.Create(result,0));
         current_asmdata.asmlists[al_imports].concat(Tai_symbol.Create(result,0));
         { register as a weak symbol if necessary }
         { register as a weak symbol if necessary }
@@ -2557,7 +2556,7 @@ unit cgcpu;
         else
         else
           internalerror(2008100401);
           internalerror(2008100401);
 
 
-        current_asmdata.asmlists[al_imports].concat(tai_section.create(sec_data_lazy,'',sizeof(pint)));
+        new_section(current_asmdata.asmlists[al_imports],sec_data_lazy,'',sizeof(pint));
         current_asmdata.asmlists[al_imports].concat(Tai_symbol.Create(l1,0));
         current_asmdata.asmlists[al_imports].concat(Tai_symbol.Create(l1,0));
         current_asmdata.asmlists[al_imports].concat(tai_directive.create(asd_indirect_symbol,s));
         current_asmdata.asmlists[al_imports].concat(tai_directive.create(asd_indirect_symbol,s));
         current_asmdata.asmlists[al_imports].concat(tai_const.createname('dyld_stub_binding_helper',0));
         current_asmdata.asmlists[al_imports].concat(tai_const.createname('dyld_stub_binding_helper',0));

+ 2 - 2
compiler/dbgdwarf.pas

@@ -2928,7 +2928,7 @@ implementation
         vardatadef:=trecorddef(search_system_type('TVARDATA').typedef);
         vardatadef:=trecorddef(search_system_type('TVARDATA').typedef);
 
 
         { write start labels }
         { write start labels }
-        current_asmdata.asmlists[al_dwarf_info].concat(tai_section.create(sec_debug_info,'',0));
+        new_section(current_asmdata.asmlists[al_dwarf_info],sec_debug_info,'',0);
         current_asmdata.asmlists[al_dwarf_info].concat(tai_symbol.createname(target_asm.labelprefix+'debug_info0',AT_DATA,0));
         current_asmdata.asmlists[al_dwarf_info].concat(tai_symbol.createname(target_asm.labelprefix+'debug_info0',AT_DATA,0));
 
 
         { start abbrev section }
         { start abbrev section }
@@ -3051,7 +3051,7 @@ implementation
         { to prevent eliminating them by smartlinking                 }
         { to prevent eliminating them by smartlinking                 }
         if (target_info.system in ([system_powerpc_macos]+systems_darwin)) then
         if (target_info.system in ([system_powerpc_macos]+systems_darwin)) then
           exit;
           exit;
-        list.concat(Tai_section.create(sec_fpc,'links',0));
+        new_section(list,sec_fpc,'links',0);
 
 
         { include reference to all debuginfo sections of used units }
         { include reference to all debuginfo sections of used units }
         hp:=tmodule(loaded_units.first);
         hp:=tmodule(loaded_units.first);

+ 1 - 1
compiler/dbgstabs.pas

@@ -1678,7 +1678,7 @@ implementation
         { Reference all DEBUGINFO sections from the main .fpc section }
         { Reference all DEBUGINFO sections from the main .fpc section }
         if (target_info.system in ([system_powerpc_macos]+systems_darwin)) then
         if (target_info.system in ([system_powerpc_macos]+systems_darwin)) then
           exit;
           exit;
-        list.concat(Tai_section.create(sec_fpc,'links',0));
+        new_section(list,sec_fpc,'links',0);
         { make sure the debuginfo doesn't get stripped out }
         { make sure the debuginfo doesn't get stripped out }
         if (target_info.system in systems_darwin) then
         if (target_info.system in systems_darwin) then
           begin
           begin

+ 1 - 1
compiler/ncgutil.pas

@@ -2288,7 +2288,7 @@ implementation
            if (target_info.system in (systems_darwin+[system_powerpc_macos])) and
            if (target_info.system in (systems_darwin+[system_powerpc_macos])) and
               not(current_module.islibrary) then
               not(current_module.islibrary) then
              begin
              begin
-              list.concat(tai_section.create(sec_code,'',4));
+              new_section(list,sec_code,'',4);
               list.concat(tai_symbol.createname_global(
               list.concat(tai_symbol.createname_global(
                 target_info.cprefix+mainaliasname,AT_FUNCTION,0));
                 target_info.cprefix+mainaliasname,AT_FUNCTION,0));
               { keep argc, argv and envp properly on the stack }
               { keep argc, argv and envp properly on the stack }

+ 1 - 2
compiler/pmodules.pas

@@ -480,8 +480,7 @@ implementation
       begin
       begin
         maybe_new_object_file(current_asmdata.asmlists[al_globals]);
         maybe_new_object_file(current_asmdata.asmlists[al_globals]);
         { Insert Ident of the compiler in the .fpc.version section }
         { Insert Ident of the compiler in the .fpc.version section }
-        current_asmdata.asmlists[al_globals].concat(Tai_section.create(sec_fpc,'version',0));
-        current_asmdata.asmlists[al_globals].concat(Tai_align.Create(const_align(32)));
+        new_section(current_asmdata.asmlists[al_globals],sec_fpc,'version',const_align(32));
         current_asmdata.asmlists[al_globals].concat(Tai_string.Create('FPC '+full_version_string+
         current_asmdata.asmlists[al_globals].concat(Tai_string.Create('FPC '+full_version_string+
           ' ['+date_string+'] for '+target_cpu_string+' - '+target_info.shortname));
           ' ['+date_string+'] for '+target_cpu_string+' - '+target_info.shortname));
         if not(tf_no_generic_stackcheck in target_info.flags) then
         if not(tf_no_generic_stackcheck in target_info.flags) then

+ 1 - 1
compiler/powerpc64/cgcpu.pas

@@ -2147,7 +2147,7 @@ begin
   l:=current_asmdata.getasmsymbol(symname);
   l:=current_asmdata.getasmsymbol(symname);
   if not(assigned(l)) then begin
   if not(assigned(l)) then begin
     l:=current_asmdata.DefineAsmSymbol(symname,AB_GLOBAL, AT_DATA);
     l:=current_asmdata.DefineAsmSymbol(symname,AB_GLOBAL, AT_DATA);
-    current_asmdata.asmlists[al_picdata].concat(tai_section.create(sec_toc, '.toc', 8));
+    new_section(current_asmdata.asmlists[al_picdata],sec_toc, '.toc', 8);
     current_asmdata.asmlists[al_picdata].concat(tai_symbol.create_global(l,0));
     current_asmdata.asmlists[al_picdata].concat(tai_symbol.create_global(l,0));
     current_asmdata.asmlists[al_picdata].concat(tai_directive.create(asd_toc_entry, symname + '[TC], ' + inttostr(a)));
     current_asmdata.asmlists[al_picdata].concat(tai_directive.create(asd_toc_entry, symname + '[TC], ' + inttostr(a)));
   end;
   end;

+ 2 - 3
compiler/ppcgen/cgppc.pas

@@ -267,12 +267,11 @@ unit cgppc;
         if current_asmdata.asmlists[al_imports]=nil then
         if current_asmdata.asmlists[al_imports]=nil then
           current_asmdata.asmlists[al_imports]:=TAsmList.create;
           current_asmdata.asmlists[al_imports]:=TAsmList.create;
 
 
-        current_asmdata.asmlists[al_imports].concat(Tai_section.create(sec_stub,'',0));
         if (cs_create_pic in current_settings.moduleswitches) then
         if (cs_create_pic in current_settings.moduleswitches) then
           stubalign:=32
           stubalign:=32
         else
         else
           stubalign:=16;
           stubalign:=16;
-        current_asmdata.asmlists[al_imports].concat(Tai_align.Create(stubalign));
+        new_section(current_asmdata.asmlists[al_imports],sec_stub,'',stubalign);
         result := current_asmdata.RefAsmSymbol(stubname);
         result := current_asmdata.RefAsmSymbol(stubname);
         current_asmdata.asmlists[al_imports].concat(Tai_symbol.Create(result,0));
         current_asmdata.asmlists[al_imports].concat(Tai_symbol.Create(result,0));
         { register as a weak symbol if necessary }
         { register as a weak symbol if necessary }
@@ -311,7 +310,7 @@ unit cgppc;
 {$endif cpu64bitaddr}
 {$endif cpu64bitaddr}
         current_asmdata.asmlists[al_imports].concat(taicpu.op_reg(A_MTCTR,NR_R12));
         current_asmdata.asmlists[al_imports].concat(taicpu.op_reg(A_MTCTR,NR_R12));
         current_asmdata.asmlists[al_imports].concat(taicpu.op_none(A_BCTR));
         current_asmdata.asmlists[al_imports].concat(taicpu.op_none(A_BCTR));
-        current_asmdata.asmlists[al_imports].concat(tai_section.create(sec_data_lazy,'',sizeof(pint)));
+        new_section(current_asmdata.asmlists[al_imports],sec_data_lazy,'',sizeof(pint));
         current_asmdata.asmlists[al_imports].concat(Tai_symbol.Create(l1,0));
         current_asmdata.asmlists[al_imports].concat(Tai_symbol.Create(l1,0));
         current_asmdata.asmlists[al_imports].concat(tai_directive.create(asd_indirect_symbol,s));
         current_asmdata.asmlists[al_imports].concat(tai_directive.create(asd_indirect_symbol,s));
         current_asmdata.asmlists[al_imports].concat(tai_const.createname('dyld_stub_binding_helper',0));
         current_asmdata.asmlists[al_imports].concat(tai_const.createname('dyld_stub_binding_helper',0));

+ 2 - 4
compiler/systems/t_bsd.pas

@@ -87,16 +87,14 @@ implementation
 
 
     procedure texportlibdarwin.setinitname(list: TAsmList; const s: string);
     procedure texportlibdarwin.setinitname(list: TAsmList; const s: string);
       begin
       begin
-        list.concat(tai_section.Create(sec_init_func,'',0));
-        list.concat(tai_align.create(sizeof(pint)));
+        new_section(list,sec_init_func,'',sizeof(pint));
         list.concat(Tai_const.Createname(s,0));
         list.concat(Tai_const.Createname(s,0));
       end;
       end;
 
 
 
 
     procedure texportlibdarwin.setfininame(list: TAsmList; const s: string);
     procedure texportlibdarwin.setfininame(list: TAsmList; const s: string);
       begin
       begin
-        list.concat(tai_section.Create(sec_term_func,'',0));
-        list.concat(tai_align.create(sizeof(pint)));
+        new_section(list,sec_term_func,'',sizeof(pint));
         list.concat(Tai_const.Createname(s,0));
         list.concat(Tai_const.Createname(s,0));
       end;
       end;
 
 

+ 1 - 1
compiler/systems/t_linux.pas

@@ -99,7 +99,7 @@ implementation
         { the problem with not having a .fini section is that a finalization
         { the problem with not having a .fini section is that a finalization
           routine in regular code can get "smart" linked away -> reference it
           routine in regular code can get "smart" linked away -> reference it
           just like the debug info }
           just like the debug info }
-        list.concat(Tai_section.create(sec_fpc,'links',0));
+        new_section(list,sec_fpc,'links',0);
         list.concat(Tai_const.Createname(s,0));
         list.concat(Tai_const.Createname(s,0));
         inherited setfininame(list,s);
         inherited setfininame(list,s);
       end;
       end;

+ 2 - 2
compiler/systems/t_sunos.pas

@@ -94,7 +94,7 @@ implementation
       begin
       begin
         inherited setinitname(list,s);
         inherited setinitname(list,s);
 {$ifdef sparc}
 {$ifdef sparc}
-        list.concat(tai_section.create(sec_init,'',4));
+        new_section(list,sec_init,'',4);
         list.concat(tai_symbol.createname_global('_init',AT_FUNCTION,0));
         list.concat(tai_symbol.createname_global('_init',AT_FUNCTION,0));
         list.concat(taicpu.op_reg_const_reg(A_SAVE,NR_STACK_POINTER_REG,-96,NR_STACK_POINTER_REG));
         list.concat(taicpu.op_reg_const_reg(A_SAVE,NR_STACK_POINTER_REG,-96,NR_STACK_POINTER_REG));
 {$endif sparc}
 {$endif sparc}
@@ -105,7 +105,7 @@ implementation
       begin
       begin
         inherited setfininame(list,s);
         inherited setfininame(list,s);
 {$ifdef sparc}
 {$ifdef sparc}
-        list.concat(tai_section.create(sec_fini,'',4));
+        new_section(list,sec_fini,'',4);
         list.concat(tai_symbol.createname_global('_fini',AT_FUNCTION,0));
         list.concat(tai_symbol.createname_global('_fini',AT_FUNCTION,0));
         list.concat(taicpu.op_reg_const_reg(A_SAVE,NR_STACK_POINTER_REG,-96,NR_STACK_POINTER_REG));
         list.concat(taicpu.op_reg_const_reg(A_SAVE,NR_STACK_POINTER_REG,-96,NR_STACK_POINTER_REG));
 {$endif sparc}
 {$endif sparc}

+ 1 - 1
compiler/x86/cgx86.pas

@@ -691,7 +691,7 @@ unit cgx86;
         if current_asmdata.asmlists[al_imports]=nil then
         if current_asmdata.asmlists[al_imports]=nil then
           current_asmdata.asmlists[al_imports]:=TAsmList.create;
           current_asmdata.asmlists[al_imports]:=TAsmList.create;
 
 
-        current_asmdata.asmlists[al_imports].concat(Tai_section.create(sec_stub,'',0));
+        new_section(current_asmdata.asmlists[al_imports],sec_stub,'',0);
         result := current_asmdata.RefAsmSymbol(stubname);
         result := current_asmdata.RefAsmSymbol(stubname);
         current_asmdata.asmlists[al_imports].concat(Tai_symbol.Create(result,0));
         current_asmdata.asmlists[al_imports].concat(Tai_symbol.Create(result,0));
         { register as a weak symbol if necessary }
         { register as a weak symbol if necessary }