Browse Source

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

git-svn-id: trunk@1054 -

peter 20 years ago
parent
commit
375a5add80
6 changed files with 62 additions and 39 deletions
  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;
           procedure InsertAfter(Item,Loc : TLinkedListItem);override;
        end;
        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
     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
     var
       { array with all class types for tais }
       { array with all class types for tais }

+ 1 - 1
compiler/assemble.pas

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

+ 1 - 1
compiler/parser.pas

@@ -251,7 +251,7 @@ implementation
       begin
       begin
          exprasmlist:=taasmoutput.create;
          exprasmlist:=taasmoutput.create;
          { Create assembler output lists for CG }
          { 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];
                      al_threadvars,al_withdebug,al_typedconsts,al_rotypedconsts,al_rtti,al_picdata];
          for i:=low(Tasmlist) to high(Tasmlist) do
          for i:=low(Tasmlist) to high(Tasmlist) do
            if i in to_create then
            if i in to_create then

+ 4 - 4
compiler/pdecl.pas

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

+ 17 - 17
compiler/pmodules.pas

@@ -181,13 +181,13 @@ implementation
         if assigned(asmlist[aasmtai.al_resourcestrings]) then
         if assigned(asmlist[aasmtai.al_resourcestrings]) then
           fixseg(asmlist[aasmtai.al_resourcestrings],sec_data,'____seg_resstrings');
           fixseg(asmlist[aasmtai.al_resourcestrings],sec_data,'____seg_resstrings');
 {$ifdef GDB}
 {$ifdef GDB}
-        if assigned(asmlist[al_debug]) then
+        if assigned(asmlist[al_typestabs]) then
           begin
           begin
             oldaktfilepos:=aktfilepos;
             oldaktfilepos:=aktfilepos;
             aktfilepos.line:=0;
             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;
             aktfilepos:=oldaktfilepos;
           end;
           end;
 {$endif GDB}
 {$endif GDB}
@@ -707,14 +707,14 @@ implementation
                    dependent stabs }
                    dependent stabs }
                  write_used_unit_type_info(pu.u);
                  write_used_unit_type_info(pu.u);
                  if assigned(pu.u.globalsymtable) then
                  if assigned(pu.u.globalsymtable) then
-                   tglobalsymtable(pu.u.globalsymtable).concattypestabto(asmlist[al_debug]);
+                   tglobalsymtable(pu.u.globalsymtable).concattypestabto(asmlist[al_typestabs]);
                end;
                end;
              pu:=tused_unit(pu.next);
              pu:=tused_unit(pu.next);
            end;
            end;
        end;
        end;
 
 
       var
       var
-        varal_debug : taasmoutput;
+        varal_typestabs : taasmoutput;
         storefilepos : tfileposinfo;
         storefilepos : tfileposinfo;
       begin
       begin
         if not (cs_debuginfo in aktmoduleswitches) then
         if not (cs_debuginfo in aktmoduleswitches) then
@@ -726,37 +726,37 @@ implementation
         if current_module.is_unit then
         if current_module.is_unit then
           begin
           begin
             current_module.flags:=current_module.flags or uf_has_debuginfo;
             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
           end
         else
         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
         { 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
           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 }
           written to the stabs when the variables/consts were written }
 {$warning Hack to get all needed types}
 {$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
         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
         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 flag }
         reset_unit_type_info;
         reset_unit_type_info;
         { write used types from the used units }
         { write used types from the used units }
         write_used_unit_type_info(current_module);
         write_used_unit_type_info(current_module);
         { last write the types from this unit }
         { last write the types from this unit }
         if assigned(current_module.globalsymtable) then
         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
         if assigned(current_module.localsymtable) then
-          tstaticsymtable(current_module.localsymtable).concattypestabto(asmlist[al_debug]);
+          tstaticsymtable(current_module.localsymtable).concattypestabto(asmlist[al_typestabs]);
         { include files }
         { include files }
         if (cs_gdb_dbx in aktglobalswitches) then
         if (cs_gdb_dbx in aktglobalswitches) then
           begin
           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 '+
               tglobalsymtable(current_module.globalsymtable).name^+' has index '+
               tostr(tglobalsymtable(current_module.globalsymtable).moduleid))));
               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^+'",'+
               tglobalsymtable(current_module.globalsymtable).name^+'",'+
               tostr(N_EINCL)+',0,0,0')));
               tostr(N_EINCL)+',0,0,0')));
             tglobalsymtable(current_module.globalsymtable).dbx_count_ok:={true}false;
             tglobalsymtable(current_module.globalsymtable).dbx_count_ok:={true}false;

+ 2 - 2
compiler/symtable.pas

@@ -1533,8 +1533,8 @@ implementation
              unittypecount:=1;
              unittypecount:=1;
              pglobaltypecount := @unittypecount;
              pglobaltypecount := @unittypecount;
              {moduleid:=current_module.unitcount;}
              {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);}
              {inc(current_module.unitcount);}
              { we can't use dbx_vcount, because we don't know
              { we can't use dbx_vcount, because we don't know
                if the object file will be loaded before or afeter PM }
                if the object file will be loaded before or afeter PM }