mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-11-04 10:39:40 +01:00 
			
		
		
		
	+ tcalo_apply_constalign option to specify that the alignment should be
modified by applying user alignment settings (so it can be only done for
    user-defined data, not not for internally generated data)
   o set this option for user-defined data
git-svn-id: trunk@34633 -
			
			
This commit is contained in:
		
							parent
							
								
									4c9903455e
								
							
						
					
					
						commit
						9727f289b1
					
				@ -132,7 +132,9 @@ type
 | 
			
		||||
     { symbol should be registered with the unit's public assembler symbols }
 | 
			
		||||
     tcalo_is_public_asm,
 | 
			
		||||
     { symbol should be declared with AT_DATA_FORCEINDIRECT }
 | 
			
		||||
     tcalo_data_force_indirect
 | 
			
		||||
     tcalo_data_force_indirect,
 | 
			
		||||
     { apply const_align() to the alignment, for user-defined data }
 | 
			
		||||
     tcalo_apply_constalign
 | 
			
		||||
   );
 | 
			
		||||
   ttcasmlistoptions = set of ttcasmlistoption;
 | 
			
		||||
 | 
			
		||||
@ -911,6 +913,8 @@ implementation
 | 
			
		||||
     var
 | 
			
		||||
       prelist: tasmlist;
 | 
			
		||||
     begin
 | 
			
		||||
       if tcalo_apply_constalign in options then
 | 
			
		||||
         alignment:=const_align(alignment);
 | 
			
		||||
       { have we finished all aggregates? }
 | 
			
		||||
       if (getcurragginfo<>nil) and
 | 
			
		||||
          { in case of syntax errors, the aggregate may not have been finished }
 | 
			
		||||
@ -937,12 +941,12 @@ implementation
 | 
			
		||||
           { we always need a new section here, since if we started a new
 | 
			
		||||
             object file then we have to say what the section is, and otherwise
 | 
			
		||||
             we need a new section because that's how the dead stripping works }
 | 
			
		||||
           new_section(prelist,section,secname,const_align(alignment));
 | 
			
		||||
           new_section(prelist,section,secname,alignment);
 | 
			
		||||
         end
 | 
			
		||||
       else if tcalo_new_section in options then
 | 
			
		||||
         new_section(prelist,section,secname,const_align(alignment))
 | 
			
		||||
         new_section(prelist,section,secname,alignment)
 | 
			
		||||
       else
 | 
			
		||||
         prelist.concat(cai_align.Create(const_align(alignment)));
 | 
			
		||||
         prelist.concat(cai_align.Create(alignment));
 | 
			
		||||
 | 
			
		||||
       { On Darwin, use .reference to ensure the data doesn't get dead stripped.
 | 
			
		||||
         On other platforms, the data must be in the .fpc section (which is
 | 
			
		||||
 | 
			
		||||
@ -297,7 +297,7 @@ implementation
 | 
			
		||||
              { :-(, we must generate a new entry }
 | 
			
		||||
              if not assigned(entry^.Data) then
 | 
			
		||||
                begin
 | 
			
		||||
                  datatcb:=ctai_typedconstbuilder.create([tcalo_is_lab,tcalo_make_dead_strippable]);
 | 
			
		||||
                  datatcb:=ctai_typedconstbuilder.create([tcalo_is_lab,tcalo_make_dead_strippable,tcalo_apply_constalign]);
 | 
			
		||||
                   case cst_type of
 | 
			
		||||
                      cst_ansistring:
 | 
			
		||||
                        begin
 | 
			
		||||
@ -426,7 +426,7 @@ implementation
 | 
			
		||||
        current_asmdata.getglobaldatalabel(lab);
 | 
			
		||||
        result:=lab;
 | 
			
		||||
        lab_set:=lab;
 | 
			
		||||
        tcb:=ctai_typedconstbuilder.create([tcalo_is_lab,tcalo_make_dead_strippable]);
 | 
			
		||||
        tcb:=ctai_typedconstbuilder.create([tcalo_is_lab,tcalo_make_dead_strippable,tcalo_apply_constalign]);
 | 
			
		||||
        tcb.maybe_begin_aggregate(resultdef);
 | 
			
		||||
        if (source_info.endian=target_info.endian) then
 | 
			
		||||
          for i:=0 to resultdef.size-1 do
 | 
			
		||||
@ -534,7 +534,7 @@ implementation
 | 
			
		||||
             if not assigned(entry^.Data) then
 | 
			
		||||
               begin
 | 
			
		||||
                 current_asmdata.getglobaldatalabel(lastlabel);
 | 
			
		||||
                 datatcb:=ctai_typedconstbuilder.create([tcalo_is_lab,tcalo_make_dead_strippable]);
 | 
			
		||||
                 datatcb:=ctai_typedconstbuilder.create([tcalo_is_lab,tcalo_make_dead_strippable,tcalo_apply_constalign]);
 | 
			
		||||
                 datatcb.emit_guid_const(value);
 | 
			
		||||
                 current_asmdata.asmlists[al_typedconsts].concatList(
 | 
			
		||||
                   datatcb.get_final_asmlist(lastlabel,rec_tguid,sec_rodata_norel,lastlabel.name,const_align(16)));
 | 
			
		||||
 | 
			
		||||
@ -439,7 +439,7 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
 | 
			
		||||
      begin
 | 
			
		||||
        inherited;
 | 
			
		||||
        fsym:=sym;
 | 
			
		||||
        ftcb:=ctai_typedconstbuilder.create([tcalo_make_dead_strippable]);
 | 
			
		||||
        ftcb:=ctai_typedconstbuilder.create([tcalo_make_dead_strippable,tcalo_apply_constalign]);
 | 
			
		||||
        fdatalist:=tasmlist.create;
 | 
			
		||||
        curoffset:=0;
 | 
			
		||||
      end;
 | 
			
		||||
@ -873,7 +873,7 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
 | 
			
		||||
                     { create a tcb for the string data (it's placed in a separate
 | 
			
		||||
                       asmlist) }
 | 
			
		||||
                     ftcb.start_internal_data_builder(fdatalist,sec_rodata,'',datatcb,ll);
 | 
			
		||||
                     datatcb:=ctai_typedconstbuilder.create([tcalo_is_lab,tcalo_make_dead_strippable]);
 | 
			
		||||
                     datatcb:=ctai_typedconstbuilder.create([tcalo_is_lab,tcalo_make_dead_strippable,tcalo_apply_constalign]);
 | 
			
		||||
                     pw:=pcompilerwidestring(tstringconstnode(node).value_str);
 | 
			
		||||
                     { include terminating #0 }
 | 
			
		||||
                     datadef:=carraydef.getreusable(cwidechartype,tstringconstnode(node).len+1);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user