2
0
Эх сурвалжийг харах

+ gcc_except_table section
+ support exception related sections in the default LD linker script

git-svn-id: branches/debug_eh@41285 -


(cherry picked from commit 27ab140dd95ef01259320e1fc97fbde8140ec7a5)

florian 6 жил өмнө
parent
commit
39401708f3

+ 5 - 3
compiler/aasmbase.pas

@@ -74,10 +74,10 @@ interface
        { is the label only there for getting an DataOffset (e.g. for i/o
        { is the label only there for getting an DataOffset (e.g. for i/o
          checks -> alt_addr) or is it a jump target (alt_jump), for debug
          checks -> alt_addr) or is it a jump target (alt_jump), for debug
          info alt_dbgline and alt_dbgfile, etc. }
          info alt_dbgline and alt_dbgfile, etc. }
-       TAsmLabelType = (alt_jump,alt_addr,alt_data,alt_dbgline,alt_dbgfile,alt_dbgtype,alt_dbgframe);
+       TAsmLabelType = (alt_jump,alt_addr,alt_data,alt_dbgline,alt_dbgfile,alt_dbgtype,alt_dbgframe,alt_eh_begin,alt_eh_end);
 
 
     const
     const
-       asmlabeltypeprefix : array[TAsmLabeltype] of char = ('j','a','d','l','f','t','c');
+       asmlabeltypeprefix : array[TAsmLabeltype] of string[2] = ('j','a','d','l','f','t','c','eb','ee');
        asmsymbindname : array[TAsmsymbind] of string[23] = ('none', 'external','common',
        asmsymbindname : array[TAsmsymbind] of string[23] = ('none', 'external','common',
        'local','global','weak external','private external','lazy','import','internal temp',
        'local','global','weak external','private external','lazy','import','internal temp',
        'indirect','external indirect');
        'indirect','external indirect');
@@ -166,7 +166,9 @@ interface
          { stack segment for 16-bit DOS }
          { stack segment for 16-bit DOS }
          sec_stack,
          sec_stack,
          { initial heap segment for 16-bit DOS }
          { initial heap segment for 16-bit DOS }
-         sec_heap
+         sec_heap,
+         { dwarf based/gcc style exception handling }
+         sec_gcc_except_table
        );
        );
 
 
        TObjCAsmSectionType = sec_objc_class..sec_objc_protolist;
        TObjCAsmSectionType = sec_objc_class..sec_objc_protolist;

+ 6 - 3
compiler/aggas.pas

@@ -271,7 +271,8 @@ implementation
           '.obcj_nlcatlist',
           '.obcj_nlcatlist',
           '.objc_protolist',
           '.objc_protolist',
           '.stack',
           '.stack',
-          '.heap'
+          '.heap',
+          '.gcc_except_table'
         );
         );
         secnames_pic : array[TAsmSectiontype] of string[length('__DATA, __datacoal_nt,coalesced')] = ('','',
         secnames_pic : array[TAsmSectiontype] of string[length('__DATA, __datacoal_nt,coalesced')] = ('','',
           '.text',
           '.text',
@@ -330,7 +331,8 @@ implementation
           '.obcj_nlcatlist',
           '.obcj_nlcatlist',
           '.objc_protolist',
           '.objc_protolist',
           '.stack',
           '.stack',
-          '.heap'
+          '.heap',
+          '.gcc_except_table'
         );
         );
       var
       var
         sep     : string[3];
         sep     : string[3];
@@ -1890,7 +1892,8 @@ implementation
          sec_none (* sec_objc_nlcatlist *),
          sec_none (* sec_objc_nlcatlist *),
          sec_none (* sec_objc_protlist *),
          sec_none (* sec_objc_protlist *),
          sec_none (* sec_stack *),
          sec_none (* sec_stack *),
-         sec_none (* sec_heap *)
+         sec_none (* sec_heap *),
+         sec_none (* gcc_except_table *)
         );
         );
       begin
       begin
         Result := inherited SectionName (SecXTable [AType], AName, AOrder);
         Result := inherited SectionName (SecXTable [AType], AName, AOrder);

+ 2 - 1
compiler/ogbase.pas

@@ -1256,7 +1256,8 @@ implementation
           {sec_objc_nlcatlist} [oso_data,oso_load],
           {sec_objc_nlcatlist} [oso_data,oso_load],
           {sec_objc_protolist'} [oso_data,oso_load],
           {sec_objc_protolist'} [oso_data,oso_load],
           {stack} [oso_load,oso_write],
           {stack} [oso_load,oso_write],
-          {heap} [oso_load,oso_write]
+          {heap} [oso_load,oso_write],
+          {gcc_except_table} [oso_data,oso_load]
         );
         );
       begin
       begin
         result:=secoptions[atype];
         result:=secoptions[atype];

+ 2 - 1
compiler/ogcoff.pas

@@ -592,7 +592,8 @@ implementation
           '.obcj_nlcatlist',
           '.obcj_nlcatlist',
           '.objc_protolist',
           '.objc_protolist',
           '.stack',
           '.stack',
-          '.heap'
+          '.heap',
+          '.gcc_except_table'
         );
         );
 
 
 const go32v2stub : array[0..2047] of byte=(
 const go32v2stub : array[0..2047] of byte=(

+ 2 - 1
compiler/ogelf.pas

@@ -557,7 +557,8 @@ implementation
           '.obcj_nlcatlist',
           '.obcj_nlcatlist',
           '.objc_protolist',
           '.objc_protolist',
           '.stack',
           '.stack',
-          '.heap'
+          '.heap',
+          '.gcc_except_table'
         );
         );
       var
       var
         sep : string[3];
         sep : string[3];

+ 4 - 2
compiler/omfbase.pas

@@ -86,7 +86,8 @@ interface
       'obcj_nlcatlist',
       'obcj_nlcatlist',
       'objc_protolist',
       'objc_protolist',
       'stack',
       'stack',
-      'heap'
+      'heap',
+      'gcc_except_table'
     );
     );
 
 
     { OMF record types }
     { OMF record types }
@@ -2820,7 +2821,8 @@ implementation
         {objc_nlcatlist} 'DATA',
         {objc_nlcatlist} 'DATA',
         {objc_protolist} 'DATA',
         {objc_protolist} 'DATA',
         {stack} 'STACK',
         {stack} 'STACK',
-        {heap} 'HEAP'
+        {heap} 'HEAP',
+        {gcc_except_table} 'DATA'
       );
       );
     begin
     begin
       result:=segclass[atype];
       result:=segclass[atype];

+ 8 - 0
compiler/systems/t_linux.pas

@@ -1303,9 +1303,17 @@ begin
             add('  {');
             add('  {');
             add('    *(.rodata .rodata.* .gnu.linkonce.r.*)');
             add('    *(.rodata .rodata.* .gnu.linkonce.r.*)');
             add('  }');
             add('  }');
+            add('  .rodata1        : { *(.rodata1) }');
+            add('  .eh_frame_hdr : { *(.eh_frame_hdr) }');
+            add('  .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) }');
+            add('  .gcc_except_table   : { KEEP *(.gcc_except_table .gcc_except_table.*) }');
+
             {Adjust the address for the data segment.  We want to adjust up to
             {Adjust the address for the data segment.  We want to adjust up to
              the same address within the page on the next page up.}
              the same address within the page on the next page up.}
             add('  . = ALIGN (0x1000) - ((0x1000 - .) & (0x1000 - 1));');
             add('  . = ALIGN (0x1000) - ((0x1000 - .) & (0x1000 - 1));');
+            add('  /* Exception handling  */');
+            add('  .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }');
+            add('  .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }');
             add('  .dynamic        : { *(.dynamic) }');
             add('  .dynamic        : { *(.dynamic) }');
             add('  .got            : { *(.got) }');
             add('  .got            : { *(.got) }');
             add('  .got.plt        : { *(.got.plt) }');
             add('  .got.plt        : { *(.got.plt) }');

+ 2 - 0
compiler/x86/agx86int.pas

@@ -149,6 +149,7 @@ implementation
         '',
         '',
         '',
         '',
         '',
         '',
+        '',
         ''
         ''
       );
       );
 
 
@@ -201,6 +202,7 @@ implementation
         '',
         '',
         '',
         '',
         '',
         '',
+        '',
         ''
         ''
       );
       );
 
 

+ 2 - 1
compiler/x86/agx86nsm.pas

@@ -556,7 +556,8 @@ interface
           '.obcj_nlcatlist',
           '.obcj_nlcatlist',
           '.objc_protolist',
           '.objc_protolist',
           '.stack',
           '.stack',
-          '.heap'
+          '.heap',
+          ',gcc_except_table'
         );
         );
       var
       var
         secname,secgroup: string;
         secname,secgroup: string;