Procházet zdrojové kódy

* be able to set an AT_* for datablocks
* set AT_TLS if needed

git-svn-id: trunk@43076 -

florian před 5 roky
rodič
revize
3949be6989
4 změnil soubory, kde provedl 23 přidání a 20 odebrání
  1. 10 10
      compiler/aasmtai.pas
  2. 2 2
      compiler/i8086/n8086util.pas
  3. 9 6
      compiler/ngenutil.pas
  4. 2 2
      compiler/raatt.pas

+ 10 - 10
compiler/aasmtai.pas

@@ -637,9 +637,9 @@ interface
           is_global : boolean;
           is_global : boolean;
           sym       : tasmsymbol;
           sym       : tasmsymbol;
           size      : asizeint;
           size      : asizeint;
-          constructor Create(const _name : string;_size : asizeint; def: tdef);
-          constructor Create_hidden(const _name : string;_size : asizeint; def: tdef);
-          constructor Create_global(const _name : string;_size : asizeint; def: tdef);
+          constructor Create(const _name: string; _size: asizeint; def: tdef; _typ: Tasmsymtype);
+          constructor Create_hidden(const _name: string; _size: asizeint; def: tdef; _typ: Tasmsymtype);
+          constructor Create_global(const _name: string; _size: asizeint; def: tdef; _typ: Tasmsymtype);
           constructor ppuload(t:taitype;ppufile:tcompilerppufile);override;
           constructor ppuload(t:taitype;ppufile:tcompilerppufile);override;
           procedure ppuwrite(ppufile:tcompilerppufile);override;
           procedure ppuwrite(ppufile:tcompilerppufile);override;
           procedure derefimpl;override;
           procedure derefimpl;override;
@@ -1284,12 +1284,12 @@ implementation
                              TAI_DATABLOCK
                              TAI_DATABLOCK
  ****************************************************************************}
  ****************************************************************************}
 
 
-    constructor tai_datablock.Create(const _name : string;_size : asizeint; def: tdef);
+    constructor tai_datablock.Create(const _name : string;_size : asizeint; def: tdef; _typ:Tasmsymtype);
 
 
       begin
       begin
          inherited Create;
          inherited Create;
          typ:=ait_datablock;
          typ:=ait_datablock;
-         sym:=current_asmdata.DefineAsmSymbol(_name,AB_LOCAL,AT_DATA,def);
+         sym:=current_asmdata.DefineAsmSymbol(_name,AB_LOCAL,_typ,def);
          { keep things aligned }
          { keep things aligned }
          if _size<=0 then
          if _size<=0 then
            _size:=sizeof(aint);
            _size:=sizeof(aint);
@@ -1297,13 +1297,13 @@ implementation
          is_global:=false;
          is_global:=false;
       end;
       end;
 
 
-    constructor tai_datablock.Create_hidden(const _name: string; _size: asizeint; def: tdef);
+    constructor tai_datablock.Create_hidden(const _name: string; _size: asizeint; def: tdef; _typ:Tasmsymtype);
       begin
       begin
         if tf_supports_hidden_symbols in target_info.flags then
         if tf_supports_hidden_symbols in target_info.flags then
           begin
           begin
             inherited Create;
             inherited Create;
             typ:=ait_datablock;
             typ:=ait_datablock;
-            sym:=current_asmdata.DefineAsmSymbol(_name,AB_PRIVATE_EXTERN,AT_DATA,def);
+            sym:=current_asmdata.DefineAsmSymbol(_name,AB_PRIVATE_EXTERN,_typ,def);
             { keep things aligned }
             { keep things aligned }
             if _size<=0 then
             if _size<=0 then
               _size:=sizeof(aint);
               _size:=sizeof(aint);
@@ -1311,15 +1311,15 @@ implementation
             is_global:=true;
             is_global:=true;
           end
           end
         else
         else
-          Create(_name,_size,def);
+          Create(_name,_size,def,_typ);
       end;
       end;
 
 
 
 
-    constructor tai_datablock.Create_global(const _name : string;_size : asizeint; def: tdef);
+    constructor tai_datablock.Create_global(const _name : string;_size : asizeint; def: tdef; _typ:Tasmsymtype);
       begin
       begin
          inherited Create;
          inherited Create;
          typ:=ait_datablock;
          typ:=ait_datablock;
-         sym:=current_asmdata.DefineAsmSymbol(_name,AB_GLOBAL,AT_DATA,def);
+         sym:=current_asmdata.DefineAsmSymbol(_name,AB_GLOBAL,_typ,def);
          { keep things aligned }
          { keep things aligned }
          if _size<=0 then
          if _size<=0 then
            _size:=sizeof(aint);
            _size:=sizeof(aint);

+ 2 - 2
compiler/i8086/n8086util.pas

@@ -76,7 +76,7 @@ implementation
       while stacksizeleft>0 do
       while stacksizeleft>0 do
         begin
         begin
           stackblock:=min(stacksizeleft,high(aint));
           stackblock:=min(stacksizeleft,high(aint));
-          current_asmdata.asmlists[al_globals].concat(tai_datablock.Create('___stackblock'+IntToStr(i),stackblock,carraydef.getreusable(u8inttype,stackblock)));
+          current_asmdata.asmlists[al_globals].concat(tai_datablock.Create('___stackblock'+IntToStr(i),stackblock,carraydef.getreusable(u8inttype,stackblock),AT_DATA));
           dec(stacksizeleft,stackblock);
           dec(stacksizeleft,stackblock);
           inc(i);
           inc(i);
         end;
         end;
@@ -101,7 +101,7 @@ implementation
       while heapsizeleft>0 do
       while heapsizeleft>0 do
         begin
         begin
           heapblock:=min(heapsizeleft,high(aint));
           heapblock:=min(heapsizeleft,high(aint));
-          current_asmdata.asmlists[al_globals].concat(tai_datablock.Create('___heapblock'+IntToStr(i),heapblock,carraydef.getreusable(u8inttype,heapblock)));
+          current_asmdata.asmlists[al_globals].concat(tai_datablock.Create('___heapblock'+IntToStr(i),heapblock,carraydef.getreusable(u8inttype,heapblock),AT_DATA));
           dec(heapsizeleft,heapblock);
           dec(heapsizeleft,heapblock);
           inc(i);
           inc(i);
         end;
         end;

+ 9 - 6
compiler/ngenutil.pas

@@ -102,7 +102,7 @@ interface
       class procedure trash_large(var stat: tstatementnode; trashn, sizen: tnode; trashintval: int64); virtual;
       class procedure trash_large(var stat: tstatementnode; trashn, sizen: tnode; trashintval: int64); virtual;
       { insert a single bss sym, called by insert bssdata (factored out
       { insert a single bss sym, called by insert bssdata (factored out
         non-common part for llvm) }
         non-common part for llvm) }
-      class procedure insertbsssym(list: tasmlist; sym: tstaticvarsym; size: asizeint; varalign: shortint); virtual;
+      class procedure insertbsssym(list: tasmlist; sym: tstaticvarsym; size: asizeint; varalign: shortint; _typ: Tasmsymtype); virtual;
 
 
       { initialization of iso styled program parameters }
       { initialization of iso styled program parameters }
       class procedure initialize_textrec(p : TObject; statn : pointer);
       class procedure initialize_textrec(p : TObject; statn : pointer);
@@ -854,7 +854,7 @@ implementation
     end;
     end;
 
 
 
 
-  class procedure tnodeutils.insertbsssym(list: tasmlist; sym: tstaticvarsym; size: asizeint; varalign: shortint);
+  class procedure tnodeutils.insertbsssym(list: tasmlist; sym: tstaticvarsym; size: asizeint; varalign: shortint; _typ:Tasmsymtype);
     begin
     begin
       if sym.globalasmsym then
       if sym.globalasmsym then
         begin
         begin
@@ -870,10 +870,10 @@ implementation
               list.concat(tai_symbol.Create(current_asmdata.DefineAsmSymbol(sym.name,AB_LOCAL,AT_DATA,sym.vardef),0));
               list.concat(tai_symbol.Create(current_asmdata.DefineAsmSymbol(sym.name,AB_LOCAL,AT_DATA,sym.vardef),0));
               list.concat(tai_directive.Create(asd_reference,sym.name));
               list.concat(tai_directive.Create(asd_reference,sym.name));
             end;
             end;
-          list.concat(Tai_datablock.create_global(sym.mangledname,size,sym.vardef));
+          list.concat(Tai_datablock.create_global(sym.mangledname,size,sym.vardef,_typ));
         end
         end
       else
       else
-        list.concat(Tai_datablock.create_hidden(sym.mangledname,size,sym.vardef));
+        list.concat(Tai_datablock.create_hidden(sym.mangledname,size,sym.vardef,_typ));
     end;
     end;
 
 
 
 
@@ -884,6 +884,7 @@ implementation
       storefilepos : tfileposinfo;
       storefilepos : tfileposinfo;
       list : TAsmList;
       list : TAsmList;
       sectype : TAsmSectiontype;
       sectype : TAsmSectiontype;
+      asmtype: TAsmsymtype;
     begin
     begin
       storefilepos:=current_filepos;
       storefilepos:=current_filepos;
       current_filepos:=sym.fileinfo;
       current_filepos:=sym.fileinfo;
@@ -893,12 +894,14 @@ implementation
         varalign:=var_align_size(l)
         varalign:=var_align_size(l)
       else
       else
         varalign:=var_align(varalign);
         varalign:=var_align(varalign);
+      asmtype:=AT_DATA;
       if tf_section_threadvars in target_info.flags then
       if tf_section_threadvars in target_info.flags then
         begin
         begin
           if (vo_is_thread_var in sym.varoptions) then
           if (vo_is_thread_var in sym.varoptions) then
             begin
             begin
               list:=current_asmdata.asmlists[al_threadvars];
               list:=current_asmdata.asmlists[al_threadvars];
               sectype:=sec_threadvar;
               sectype:=sec_threadvar;
+              asmtype:=AT_TLS;
             end
             end
           else
           else
             begin
             begin
@@ -924,7 +927,7 @@ implementation
         new_section(list,sec_user,sym.section,varalign)
         new_section(list,sec_user,sym.section,varalign)
       else
       else
         new_section(list,sectype,lower(sym.mangledname),varalign);
         new_section(list,sectype,lower(sym.mangledname),varalign);
-      insertbsssym(list,sym,l,varalign);
+      insertbsssym(list,sym,l,varalign,asmtype);
       current_filepos:=storefilepos;
       current_filepos:=storefilepos;
     end;
     end;
 
 
@@ -1536,7 +1539,7 @@ implementation
             is separate in the builder }
             is separate in the builder }
           maybe_new_object_file(current_asmdata.asmlists[al_globals]);
           maybe_new_object_file(current_asmdata.asmlists[al_globals]);
           new_section(current_asmdata.asmlists[al_globals],sec_bss,'__fpc_initialheap',current_settings.alignment.varalignmax);
           new_section(current_asmdata.asmlists[al_globals],sec_bss,'__fpc_initialheap',current_settings.alignment.varalignmax);
-          current_asmdata.asmlists[al_globals].concat(tai_datablock.Create_global('__fpc_initialheap',heapsize,carraydef.getreusable(u8inttype,heapsize)));
+          current_asmdata.asmlists[al_globals].concat(tai_datablock.Create_global('__fpc_initialheap',heapsize,carraydef.getreusable(u8inttype,heapsize),AT_DATA));
         end;
         end;
 
 
       { Valgrind usage }
       { Valgrind usage }

+ 2 - 2
compiler/raatt.pas

@@ -1254,7 +1254,7 @@ unit raatt;
                Consume(AS_ID);
                Consume(AS_ID);
                Consume(AS_COMMA);
                Consume(AS_COMMA);
                symofs:=BuildConstExpression(false,false);
                symofs:=BuildConstExpression(false,false);
-               curList.concat(Tai_datablock.Create(commname,symofs,carraydef.getreusable(u8inttype,symofs)));
+               curList.concat(Tai_datablock.Create(commname,symofs,carraydef.getreusable(u8inttype,symofs),AT_DATA));
                if actasmtoken<>AS_SEPARATOR then
                if actasmtoken<>AS_SEPARATOR then
                 Consume(AS_SEPARATOR);
                 Consume(AS_SEPARATOR);
              end;
              end;
@@ -1266,7 +1266,7 @@ unit raatt;
                Consume(AS_ID);
                Consume(AS_ID);
                Consume(AS_COMMA);
                Consume(AS_COMMA);
                symofs:=BuildConstExpression(false,false);
                symofs:=BuildConstExpression(false,false);
-               curList.concat(Tai_datablock.Create_global(commname,symofs,carraydef.getreusable(u8inttype,symofs)));
+               curList.concat(Tai_datablock.Create_global(commname,symofs,carraydef.getreusable(u8inttype,symofs),AT_DATA));
                if actasmtoken<>AS_SEPARATOR then
                if actasmtoken<>AS_SEPARATOR then
                 Consume(AS_SEPARATOR);
                 Consume(AS_SEPARATOR);
              end;
              end;