Browse Source

* generic compiler patches for ppc64/linux PIC code

git-svn-id: trunk@2222 -
tom_at_work 19 years ago
parent
commit
c887507adf

+ 5 - 2
compiler/aasmbase.pas

@@ -60,7 +60,9 @@ interface
          { dwarf }
          sec_debug_frame,
          { ELF resources }
-         sec_fpc
+         sec_fpc,
+         { Table of contents section }
+         sec_toc
        );
 
        TAsmSectionOption = (aso_alloconly,aso_executable);
@@ -588,7 +590,8 @@ implementation
           'idata2','idata4','idata5','idata6','idata7','edata',
           'eh_frame',
           'debug_frame',
-          'fpc'
+          'fpc',
+          'toc'
         );
       begin
         if aname<>'' then

+ 2 - 2
compiler/aasmtai.pas

@@ -301,7 +301,7 @@ interface
        end;
 
        tasmdirective=(asd_non_lazy_symbol_pointer,asd_indirect_symbol,asd_lazy_symbol_pointer,
-                      asd_extern,asd_nasm_import);
+                      asd_extern,asd_nasm_import, asd_toc_entry);
 
        tai_directive = class(tailineinfo)
           name : pstring;
@@ -633,7 +633,7 @@ interface
       stabtypestr : array[tstabtype] of string[5]=('stabs','stabn','stabd');
       directivestr : array[tasmdirective] of string[24]=(
         'non_lazy_symbol_pointer','indirect_symbol','lazy_symbol_pointer',
-        'extern','nasm_import'
+        'extern','nasm_import', 'tc'
       );
 
     var

+ 7 - 9
compiler/aggas.pas

@@ -213,7 +213,8 @@ implementation
           '.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
           '.eh_frame',
           '.debug_frame',
-          'fpc.resptrs'
+          'fpc.resptrs',
+          '.toc'
         );
         secnames_pic : array[tasmsectiontype] of string[12] = ('',
           '.text','.data.rel','.data.rel','.bss','.threadvar',
@@ -224,7 +225,8 @@ implementation
           '.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
           '.eh_frame',
           '.debug_frame',
-          'fpc.resptrs'
+          'fpc.resptrs',
+          '.toc'
         );
       var
         secname : string;
@@ -806,7 +808,7 @@ implementation
                    AsmWriteLn('.size ' + tai_symbol(hp).sym.name + ', 24');
                    AsmWriteLn('.globl .' + tai_symbol(hp).sym.name);
                    AsmWriteLn('.type .' + tai_symbol(hp).sym.name + ', @function');
-                   { the dotted name is the name of the actual function }
+                   { the dotted name is the name of the actual function entry }
                    AsmWrite('.');
                  end
                else
@@ -848,15 +850,11 @@ implementation
                   AsmWriteLn(s+':');
                   AsmWrite(#9'.size'#9);
                   if (target_info.system = system_powerpc64_linux) and (tai_symbol_end(hp).sym.typ = AT_FUNCTION) then
-                    begin
-                      AsmWrite('.');
-                    end;
+                    AsmWrite('.');
                   AsmWrite(tai_symbol_end(hp).sym.name);
                   AsmWrite(', '+s+' - ');
                   if (target_info.system = system_powerpc64_linux) and (tai_symbol_end(hp).sym.typ = AT_FUNCTION) then
-                    begin
-                      AsmWrite('.');
-                    end;
+                     AsmWrite('.');
                   AsmWriteLn(tai_symbol_end(hp).sym.name);
                 end;
              end;

+ 2 - 1
compiler/i386/ag386nsm.pas

@@ -363,7 +363,8 @@ interface
           '.idata2','.idata4','.idata5','.idata6','.idata7','.edata',
           '.eh_frame',
           '.debug_frame',
-          '.fpc'
+          '.fpc',
+		  ''
         );
       begin
         AsmLn;

+ 2 - 1
compiler/ogcoff.pas

@@ -561,7 +561,8 @@ const go32v2stub : array[0..2047] of byte=(
           '.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
           '.eh_frame',
           '.debug_frame',
-          '.fpc'
+          '.fpc',
+		  ''
         );
       begin
         { No support for named sections, because section names are limited to 8 chars }

+ 2 - 1
compiler/ogelf.pas

@@ -356,7 +356,8 @@ implementation
           '.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
           '.eh_frame',
           '.debug_frame',
-          'fpc'
+          'fpc',
+		  ''
         );
       begin
         if (use_smartlink_section and

+ 1 - 1
compiler/parabase.pas

@@ -56,7 +56,7 @@ unit parabase;
              E.g. the value $5544433 is passed in bits 40-63 of the register (others are zero),
              but they should actually be stored in the first bits of the stack location reserved
              for this value. So they have to be shifted left by this amount of bits before. }
-             {$IFDEF CPUPOWERPC64}shiftval : byte;{$ENDIF CPUPOWERPC64}
+             {$IFDEF POWERPC64}shiftval : byte;{$ENDIF POWERPC64}
              register : tregister);
        end;
 

+ 3 - 2
compiler/x86/agx86int.pas

@@ -61,14 +61,15 @@ implementation
       secnames : array[TAsmSectionType] of string[4] = ('',
         'CODE','DATA','DATA','BSS','',
         '','','','','','','',
-        '','','','','','',''
+        '','','','','','','',
+		''
       );
 
       secnamesml64 : array[TAsmSectionType] of string[7] = ('',
         '_TEXT','_DATE','_DATA','_BSS','',
         '','','','','',
         'idata$2','idata$4','idata$5','idata$6','idata$7','edata',
-        '','',''
+        '','','',''
       );
 
     function single2str(d : single) : string;