Browse Source

* .rodata section support, disabled by default since it doesn't work
yet

peter 21 years ago
parent
commit
04cce65ea2
1 changed files with 22 additions and 2 deletions
  1. 22 2
      compiler/ogelf.pas

+ 22 - 2
compiler/ogelf.pas

@@ -335,8 +335,11 @@ implementation
     function telf32objectdata.sectionname(atype:tasmsectiontype;const aname:string):string;
     function telf32objectdata.sectionname(atype:tasmsectiontype;const aname:string):string;
       const
       const
         secnames : array[tasmsectiontype] of string[12] = ('',
         secnames : array[tasmsectiontype] of string[12] = ('',
-{$warning TODO .rodata not yet working}
+{$ifdef userodata}
+          '.text','.data','.rodata','.bss',
+{$else userodata}
           '.text','.data','.data','.bss',
           '.text','.data','.data','.bss',
+{$endif userodata}
           'common',
           'common',
           '.note',
           '.note',
           '.stab','.stabstr',
           '.stab','.stabstr',
@@ -379,6 +382,10 @@ implementation
       begin
       begin
         if currsec=nil then
         if currsec=nil then
           internalerror(200403292);
           internalerror(200403292);
+{$ifdef userodata}
+        if currsec.sectype in [sec_rodata,sec_bss] then
+          internalerror(200408252);
+{$endif userodata}
         if assigned(p) then
         if assigned(p) then
          begin
          begin
            { real address of the symbol }
            { real address of the symbol }
@@ -524,6 +531,15 @@ implementation
       begin
       begin
         with elf32data do
         with elf32data do
          begin
          begin
+{$ifdef userodata}
+           { rodata can't have relocations }
+           if s.sectype=sec_rodata then
+             begin
+               if assigned(s.relocations.first) then
+                 internalerror(200408251);
+               exit;
+             end;
+{$endif userodata}
            { create the reloc section }
            { create the reloc section }
            s.relocsect:=telf32section.create_ext('.rel'+s.name,sec_custom,9,0,symtabsect.secshidx,s.secshidx,4,8);
            s.relocsect:=telf32section.create_ext('.rel'+s.name,sec_custom,9,0,symtabsect.secshidx,s.secshidx,4,8);
            { add the relocations }
            { add the relocations }
@@ -906,7 +922,11 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.21  2004-06-20 08:55:30  florian
+  Revision 1.22  2004-08-25 15:55:10  peter
+    * .rodata section support, disabled by default since it doesn't work
+      yet
+
+  Revision 1.21  2004/06/20 08:55:30  florian
     * logs truncated
     * logs truncated
 
 
   Revision 1.20  2004/06/16 20:07:09  florian
   Revision 1.20  2004/06/16 20:07:09  florian