Explorar o código

* rename al_debug to al_typestabs
* first write al_typestabs before other sections

git-svn-id: trunk@1054 -

peter %!s(int64=20) %!d(string=hai) anos
pai
achega
375a5add80
Modificáronse 6 ficheiros con 62 adicións e 39 borrados
  1. 37 14
      compiler/aasmtai.pas
  2. 1 1
      compiler/assemble.pas
  3. 1 1
      compiler/parser.pas
  4. 4 4
      compiler/pdecl.pas
  5. 17 17
      compiler/pmodules.pas
  6. 2 2
      compiler/symtable.pas

+ 37 - 14
compiler/aasmtai.pas

@@ -575,21 +575,44 @@ interface
           procedure InsertAfter(Item,Loc : TLinkedListItem);override;
        end;
 
-       Tasmlist=({ default lists }
-                 al_code,al_bss,al_data,al_rodata,
-                 al_typedconsts,al_rotypedconsts,
-                 al_debug,al_threadvars,al_withdebug,al_imports,al_exports,
-                 al_resources,al_rtti,al_dwarf,
-                 { data used by pic code }
-                 al_picdata,al_resourcestrings);
+       { Type of asmlists. The order is important for the layout of the
+         information in the .o file. The stabs for the types must be defined
+         before they can be referenced and therefor they need to be written
+         first (PFV) }
+       Tasmlist=(al_typestabs,
+                 al_code,
+                 al_bss,
+                 al_data,
+                 al_rodata,
+                 al_typedconsts,
+                 al_rotypedconsts,
+                 al_threadvars,
+                 al_withdebug,
+                 al_imports,
+                 al_exports,
+                 al_resources,
+                 al_rtti,
+                 al_dwarf,
+                 al_picdata,
+                 al_resourcestrings);
     const
-       TasmlistStr : array[tasmlist] of string[24] =({ default lists }
-           'al_code','al_bss','al_data','al_rodata',
-           'al_typedconsts','al_rotypedconsts',
-           'al_debug','al_threadvars','al_withdebug','al_imports','al_exports',
-           'al_resources','al_rtti','al_dwarf',
-           { data used by pic code }
-           'al_picdata','al_resourcestrings');
+       TasmlistStr : array[tasmlist] of string[24] =(
+           'al_typestabs',
+           'al_code',
+           'al_bss',
+           'al_data',
+           'al_rodata',
+           'al_typedconsts',
+           'al_rotypedconsts',
+           'al_threadvars',
+           'al_withdebug',
+           'al_imports',
+           'al_exports',
+           'al_resources',
+           'al_rtti',
+           'al_dwarf',
+           'al_picdata',
+           'al_resourcestrings');
 
     var
       { array with all class types for tais }

+ 1 - 1
compiler/assemble.pas

@@ -1601,7 +1601,7 @@ Implementation
       begin
         to_do:=[low(Tasmlist)..high(Tasmlist)];
         if not(cs_debuginfo in aktmoduleswitches) then
-          exclude(to_do,al_debug);
+          exclude(to_do,al_typestabs);
         if usedeffileforexports then
           exclude(to_do,al_exports);
         {$warning TODO internal writer support for dwarf}

+ 1 - 1
compiler/parser.pas

@@ -251,7 +251,7 @@ implementation
       begin
          exprasmlist:=taasmoutput.create;
          { Create assembler output lists for CG }
-         to_create:=[al_code,al_bss,al_debug,al_data,al_rodata,
+         to_create:=[al_code,al_bss,al_typestabs,al_data,al_rodata,
                      al_threadvars,al_withdebug,al_typedconsts,al_rotypedconsts,al_rtti,al_picdata];
          for i:=low(Tasmlist) to high(Tasmlist) do
            if i in to_create then

+ 4 - 4
compiler/pdecl.pas

@@ -333,21 +333,21 @@ implementation
                        { avoid wrong unused warnings web bug 801 PM }
                        inc(ttypesym(srsym).refs);
 {$ifdef GDB_UNUSED}
-                       if (cs_debuginfo in aktmoduleswitches) and assigned(al_debug) and
+                       if (cs_debuginfo in aktmoduleswitches) and assigned(al_typestabs) and
                           (tsym(p).owner.symtabletype in [globalsymtable,staticsymtable]) then
                         begin
                           ttypesym(p).isusedinstab:=true;
-{                          ttypesym(p).concatstabto(al_debug);}
+{                          ttypesym(p).concatstabto(al_typestabs);}
                           {not stabs for forward defs }
                           if not Ttypesym(p).isstabwritten then
                             begin
                               if Ttypesym(p).restype.def.typesym=p then
-                                Tstoreddef(Ttypesym(p).restype.def).concatstabto(al_debug)
+                                Tstoreddef(Ttypesym(p).restype.def).concatstabto(al_typestabs)
                               else
                                 begin
                                   stab_str:=Ttypesym(p).stabstring;
                                   if assigned(stab_str) then
-                                    al_debug.concat(Tai_stabs.create(stab_str));
+                                    al_typestabs.concat(Tai_stabs.create(stab_str));
                                   Ttypesym(p).isstabwritten:=true;
                                 end;
                             end;

+ 17 - 17
compiler/pmodules.pas

@@ -181,13 +181,13 @@ implementation
         if assigned(asmlist[aasmtai.al_resourcestrings]) then
           fixseg(asmlist[aasmtai.al_resourcestrings],sec_data,'____seg_resstrings');
 {$ifdef GDB}
-        if assigned(asmlist[al_debug]) then
+        if assigned(asmlist[al_typestabs]) then
           begin
             oldaktfilepos:=aktfilepos;
             aktfilepos.line:=0;
-            asmlist[al_debug].insert(Tai_symbol.Createname('gcc2_compiled',AT_DATA,0));
-            asmlist[al_debug].insert(Tai_symbol.Createname('fpc_compiled',AT_DATA,0));
-            fixseg(asmlist[al_debug],sec_code,'____seg_debug');
+            asmlist[al_typestabs].insert(Tai_symbol.Createname('gcc2_compiled',AT_DATA,0));
+            asmlist[al_typestabs].insert(Tai_symbol.Createname('fpc_compiled',AT_DATA,0));
+            fixseg(asmlist[al_typestabs],sec_code,'____seg_debug');
             aktfilepos:=oldaktfilepos;
           end;
 {$endif GDB}
@@ -707,14 +707,14 @@ implementation
                    dependent stabs }
                  write_used_unit_type_info(pu.u);
                  if assigned(pu.u.globalsymtable) then
-                   tglobalsymtable(pu.u.globalsymtable).concattypestabto(asmlist[al_debug]);
+                   tglobalsymtable(pu.u.globalsymtable).concattypestabto(asmlist[al_typestabs]);
                end;
              pu:=tused_unit(pu.next);
            end;
        end;
 
       var
-        varal_debug : taasmoutput;
+        varal_typestabs : taasmoutput;
         storefilepos : tfileposinfo;
       begin
         if not (cs_debuginfo in aktmoduleswitches) then
@@ -726,37 +726,37 @@ implementation
         if current_module.is_unit then
           begin
             current_module.flags:=current_module.flags or uf_has_debuginfo;
-            asmlist[al_debug].concat(tai_symbol.Createname_global(make_mangledname('DEBUGINFO',current_module.globalsymtable,''),AT_DATA,0));
+            asmlist[al_typestabs].concat(tai_symbol.Createname_global(make_mangledname('DEBUGINFO',current_module.globalsymtable,''),AT_DATA,0));
           end
         else
-          asmlist[al_debug].concat(tai_symbol.Createname_global(make_mangledname('DEBUGINFO',current_module.localsymtable,''),AT_DATA,0));
+          asmlist[al_typestabs].concat(tai_symbol.Createname_global(make_mangledname('DEBUGINFO',current_module.localsymtable,''),AT_DATA,0));
         { first write all global/local symbols again to a temp list. This will flag
           all required tdefs. After that the temp list can be removed since the debuginfo is already
           written to the stabs when the variables/consts were written }
 {$warning Hack to get all needed types}
-        varal_debug:=taasmoutput.create;
-        new_section(varal_debug,sec_data,'',0);
+        varal_typestabs:=taasmoutput.create;
+        new_section(varal_typestabs,sec_data,'',0);
         if assigned(current_module.globalsymtable) then
-          tglobalsymtable(current_module.globalsymtable).concatstabto(varal_debug);
+          tglobalsymtable(current_module.globalsymtable).concatstabto(varal_typestabs);
         if assigned(current_module.localsymtable) then
-          tstaticsymtable(current_module.localsymtable).concatstabto(varal_debug);
-        varal_debug.free;
+          tstaticsymtable(current_module.localsymtable).concatstabto(varal_typestabs);
+        varal_typestabs.free;
         { reset unit type info flag }
         reset_unit_type_info;
         { write used types from the used units }
         write_used_unit_type_info(current_module);
         { last write the types from this unit }
         if assigned(current_module.globalsymtable) then
-          tglobalsymtable(current_module.globalsymtable).concattypestabto(asmlist[al_debug]);
+          tglobalsymtable(current_module.globalsymtable).concattypestabto(asmlist[al_typestabs]);
         if assigned(current_module.localsymtable) then
-          tstaticsymtable(current_module.localsymtable).concattypestabto(asmlist[al_debug]);
+          tstaticsymtable(current_module.localsymtable).concattypestabto(asmlist[al_typestabs]);
         { include files }
         if (cs_gdb_dbx in aktglobalswitches) then
           begin
-            asmlist[al_debug].concat(tai_comment.Create(strpnew('EINCL of global '+
+            asmlist[al_typestabs].concat(tai_comment.Create(strpnew('EINCL of global '+
               tglobalsymtable(current_module.globalsymtable).name^+' has index '+
               tostr(tglobalsymtable(current_module.globalsymtable).moduleid))));
-            asmlist[al_debug].concat(Tai_stabs.Create(strpnew('"'+
+            asmlist[al_typestabs].concat(Tai_stabs.Create(strpnew('"'+
               tglobalsymtable(current_module.globalsymtable).name^+'",'+
               tostr(N_EINCL)+',0,0,0')));
             tglobalsymtable(current_module.globalsymtable).dbx_count_ok:={true}false;

+ 2 - 2
compiler/symtable.pas

@@ -1533,8 +1533,8 @@ implementation
              unittypecount:=1;
              pglobaltypecount := @unittypecount;
              {moduleid:=current_module.unitcount;}
-             {al_debug.concat(tai_comment.Create(strpnew('Global '+name^+' has index '+tostr(moduleid))));
-             al_debug.concat(Tai_stabs.Create(strpnew('"'+name^+'",'+tostr(N_BINCL)+',0,0,0')));}
+             {al_typestabs.concat(tai_comment.Create(strpnew('Global '+name^+' has index '+tostr(moduleid))));
+             al_typestabs.concat(Tai_stabs.Create(strpnew('"'+name^+'",'+tostr(N_BINCL)+',0,0,0')));}
              {inc(current_module.unitcount);}
              { we can't use dbx_vcount, because we don't know
                if the object file will be loaded before or afeter PM }