Просмотр исходного кода

Merged revisions 2994 via svnmerge from
http://svn.freepascal.org/svn/fpc/branches/linker/compiler

........
r2994 | peter | 2006-03-21 07:58:12 +0100 (Tue, 21 Mar 2006) | 2 lines

* use float size for parameters on the stack

........

git-svn-id: trunk@2995 -

peter 19 лет назад
Родитель
Сommit
f87b04c034
3 измененных файлов с 28 добавлено и 21 удалено
  1. 18 0
      compiler/cgbase.pas
  2. 4 8
      compiler/ogelf.pas
  3. 6 13
      compiler/x86_64/cpupara.pas

+ 18 - 0
compiler/cgbase.pas

@@ -304,6 +304,7 @@ interface
        size.
     }
     function int_cgsize(const a: aint): tcgsize;{$ifdef USEINLINE}inline;{$endif}
+    function int_float_cgsize(const a: aint): tcgsize;
 
     { return the inverse condition of opcmp }
     function inverse_opcmp(opcmp: topcmp): topcmp;{$ifdef USEINLINE}inline;{$endif}
@@ -571,6 +572,23 @@ implementation
       end;
 
 
+    function int_float_cgsize(const a: aint): tcgsize;
+      begin
+        case a of
+          4 :
+            result:=OS_F32;
+          8 :
+            result:=OS_F64;
+          10 :
+            result:=OS_F80;
+          16 :
+            result:=OS_F128;
+          else
+            internalerror(200603211);
+        end;
+      end;
+
+
     function inverse_opcmp(opcmp: topcmp): topcmp;{$ifdef USEINLINE}inline;{$endif}
       const
         list: array[TOpCmp] of TOpCmp =

+ 4 - 8
compiler/ogelf.pas

@@ -723,14 +723,10 @@ implementation
 {$endif userodata}
            { create the reloc section }
 {$ifdef i386}
-           s.relocsect:=TElfObjSection.create_ext('.rel'+s.name,9,0,symtabsect.secshidx,s.secshidx,4,8);
+           s.relocsect:=TElfObjSection.create_ext('.rel'+s.name,SHT_RELA,0,symtabsect.secshidx,s.secshidx,4,sizeof(TElfReloc));
+{$else i386}
+           s.relocsect:=TElfObjSection.create_ext('.rel'+s.name,SHT_REL,0,symtabsect.secshidx,s.secshidx,4,sizeof(TElfReloc));
 {$endif i386}
-{$ifdef x86_64}
-           s.relocsect:=TElfObjSection.create_ext('.rela'+s.name,4,0,symtabsect.secshidx,s.secshidx,4,3*8);
-{$endif x86_64}
-{$ifdef sparc}
-           s.relocsect:=TElfObjSection.create_ext('.rel'+s.name,4,0,symtabsect.secshidx,s.secshidx,4,8);
-{$endif sparc}
            { add the relocations }
            r:=TObjRelocation(s.relocations.first);
            while assigned(r) do
@@ -781,7 +777,7 @@ implementation
                   begin
                     reltyp:=R_X86_64_PC32;
                     { length of the relocated location is handled here }
-                    rel.addend:=-4;
+                    rel.addend:=qword(-4);
                   end;
               RELOC_ABSOLUTE :
                   reltyp:=R_X86_64_64;

+ 6 - 13
compiler/x86_64/cpupara.pas

@@ -405,25 +405,18 @@ unit cpupara;
                         begin
                           paraloc:=hp.paraloc[side].add_location;
                           paraloc^.loc:=LOC_REFERENCE;
-                          { Extended needs a single location }
-                          if (paracgsize=OS_F80) then
-                            begin
-                              paraloc^.size:=paracgsize;
-                              l:=paralen;
-                            end
+                          if paracgsize in [OS_F32,OS_F64,OS_F80,OS_F128] then
+                            paraloc^.size:=int_float_cgsize(paralen)
                           else
-                            begin
-                              l:=paralen;
-                              paraloc^.size:=int_cgsize(l);
-                            end;
+                            paraloc^.size:=int_cgsize(paralen);
                           if side=callerside then
                             paraloc^.reference.index:=NR_STACK_POINTER_REG
                           else
                             paraloc^.reference.index:=NR_FRAME_POINTER_REG;
-                          varalign:=used_align(size_2_align(l),paraalign,paraalign);
+                          varalign:=used_align(size_2_align(paralen),paraalign,paraalign);
                           paraloc^.reference.offset:=parasize;
-                          parasize:=align(parasize+l,varalign);
-                          dec(paralen,l);
+                          parasize:=align(parasize+paralen,varalign);
+                          paralen:=0;
                         end;
                     end;
                     if (locidx<2) and