Selaa lähdekoodia

From patch submitted by Willibald Krenn in Bug Report 17500.

* assemble.pas (TInternalAssembler.WriteStab): Use RELOC_ABSOLUTE32 for
32-bit stab entry.
* ogcoff.pas: Add check for correct generated reloc section size.
* systems/t_win.pas: Use 0x400000 image base for x86_64 programs using
stabs debug information format.

git-svn-id: trunk@16056 -

pierre 15 vuotta sitten
vanhempi
commit
7c04d8d13b
3 muutettua tiedostoa jossa 22 lisäystä ja 10 poistoa
  1. 1 1
      compiler/assemble.pas
  2. 13 8
      compiler/ogcoff.pas
  3. 8 1
      compiler/systems/t_win.pas

+ 1 - 1
compiler/assemble.pas

@@ -899,7 +899,7 @@ Implementation
             oldsec:=ObjData.CurrObjSec;
             oldsec:=ObjData.CurrObjSec;
             ObjData.SetSection(ObjData.StabsSec);
             ObjData.SetSection(ObjData.StabsSec);
             ObjData.Writebytes(stab,sizeof(TObjStabEntry)-4);
             ObjData.Writebytes(stab,sizeof(TObjStabEntry)-4);
-            ObjData.Writereloc(stab.nvalue,4,relocsym,RELOC_ABSOLUTE);
+            ObjData.Writereloc(stab.nvalue,4,relocsym,RELOC_ABSOLUTE32);
             ObjData.setsection(oldsec);
             ObjData.setsection(oldsec);
           end;
           end;
         if assigned(pendquote) then
         if assigned(pendquote) then

+ 13 - 8
compiler/ogcoff.pas

@@ -959,15 +959,19 @@ const pemagic : array[0..3] of byte = (
             data.Seek(objreloc.dataoffset);
             data.Seek(objreloc.dataoffset);
             data.Write(address,address_size);
             data.Write(address,address_size);
 {$ifdef cpu64bitaddr}
 {$ifdef cpu64bitaddr}
-            if objreloc.typ = RELOC_ABSOLUTE32 then begin
-              if assigned(objreloc.symbol) then
-                s:=objreloc.symbol.Name
-              else
-                s:=objreloc.objsection.Name;
-              Message2(link_w_32bit_absolute_reloc, ObjData.Name, s);
-            end;
+            if (objreloc.typ = RELOC_ABSOLUTE32) and (name <> '.stab') then
+              begin
+                if assigned(objreloc.symbol) then
+                  s:=objreloc.symbol.Name
+                else
+                  s:=objreloc.objsection.Name;
+                Message2(link_w_32bit_absolute_reloc, ObjData.Name, s);
+              end;
 {$endif cpu64bitaddr}
 {$endif cpu64bitaddr}
           end;
           end;
+        {for size = 0 data is not valid PM }
+        if assigned(data) and (data.size <> size) then
+          internalerror(2010092801);
       end;
       end;
 
 
 
 
@@ -1089,7 +1093,8 @@ const pemagic : array[0..3] of byte = (
 {$endif cpu64bitaddr}
 {$endif cpu64bitaddr}
                   RELOC_RELATIVE :
                   RELOC_RELATIVE :
                     begin
                     begin
-                      inc(data,symaddr-len-CurrObjSec.Size);
+                      //inc(data,symaddr-len-CurrObjSec.Size);
+                      data:=data+symaddr-len-CurrObjSec.Size;
                     end;
                     end;
                   RELOC_RVA :
                   RELOC_RVA :
                     begin
                     begin

+ 8 - 1
compiler/systems/t_win.pas

@@ -969,7 +969,14 @@ implementation
                   if target_info.system in systems_wince then
                   if target_info.system in systems_wince then
                     imagebase:=$10000
                     imagebase:=$10000
                   else
                   else
-                    imagebase:={$ifdef cpu64bitaddr} $100000000 {$else} $400000 {$endif};
+{$ifdef cpu64bitaddr}
+                    if (paratargetdbg = dbg_stabs) then
+                      imagebase:=$400000
+                    else
+                      imagebase:= $100000000;
+{$else}
+                    imagebase:=$400000;
+{$endif}
               end;
               end;
             Concat('IMAGEBASE $' + hexStr(imagebase, SizeOf(imagebase)*2));
             Concat('IMAGEBASE $' + hexStr(imagebase, SizeOf(imagebase)*2));
             Concat('HEADER');
             Concat('HEADER');