Kaynağa Gözat

* fixed win32 that was broken by previous fix

peter 21 yıl önce
ebeveyn
işleme
6663adfd50
2 değiştirilmiş dosya ile 25 ekleme ve 14 silme
  1. 4 3
      compiler/assemble.pas
  2. 21 11
      compiler/ogcoff.pas

+ 4 - 3
compiler/assemble.pas

@@ -1039,8 +1039,6 @@ Implementation
                     not SmartAsm then
                   begin
                     objectdata.allocsymbol(currpass,Tai_datablock(hp).sym,Tai_datablock(hp).size);
-                    { common/external uses the size for address }
-                    Tai_datablock(hp).sym.address:=Tai_datablock(hp).size;
                     { force to be common/external, must be after setaddress as that would
                       set it to AB_GLOBAL }
                     Tai_datablock(hp).sym.currbind:=AB_COMMON;
@@ -1631,7 +1629,10 @@ Implementation
 end.
 {
   $Log$
-  Revision 1.72  2004-08-24 19:31:44  hajny
+  Revision 1.73  2004-08-25 15:55:32  peter
+    * fixed win32 that was broken by previous fix
+
+  Revision 1.72  2004/08/24 19:31:44  hajny
     * binary writer fix for GO32v2 from Peter
 
   Revision 1.71  2004/07/01 18:28:54  jonas

+ 21 - 11
compiler/ogcoff.pas

@@ -559,7 +559,7 @@ const go32v2stub : array[0..2047] of byte=(
     function TCoffObjectData.sectionname(atype:tasmsectiontype;const aname:string):string;
       const
         secnames : array[tasmsectiontype] of string[16] = ('',
-          '.text','.data','.data','.bss',
+          '.text','.data','.rodata','.bss',
           'common',
           '.note',
           '.stab','.stabstr',
@@ -603,12 +603,21 @@ const go32v2stub : array[0..2047] of byte=(
          begin
            { current address }
            curraddr:=currsec.mempos+currsec.datasize;
-           { real address of the symbol }
-           symaddr:=p.address;
            { external/common symbols don't have a fixed memory position yet }
-           if (p.section<>nil) and
-              (p.currbind<>AB_COMMON) then
-            inc(symaddr,p.section.mempos);
+           if (p.currbind=AB_COMMON) then
+             begin
+               { For go32v2 we need to use the size as address }
+               if not win32 then
+                 symaddr:=p.size
+               else
+                 symaddr:=0;
+             end
+           else
+             begin
+               symaddr:=p.address;
+               if assigned(p.section) then
+                 inc(symaddr,p.section.mempos);
+             end;
            { no symbol relocation need inside a section }
            if (p.section=currsec) and
               (p.currbind<>AB_COMMON) then
@@ -639,10 +648,8 @@ const go32v2stub : array[0..2047] of byte=(
                  currsec.addsectionreloc(curraddr,p.section,relative)
                else
                  currsec.addsymreloc(curraddr,p,relative);
-               if not win32 then {seems wrong to me (PM) }
-                inc(data,symaddr)
-               else
-                if (relative<>RELOC_RELATIVE) and (p.section<>nil) then
+               if (not win32) or
+                  ((relative<>RELOC_RELATIVE) and (p.section<>nil)) then
                  inc(data,symaddr);
                if relative=RELOC_RELATIVE then
                 begin
@@ -1786,7 +1793,10 @@ initialization
 end.
 {
   $Log$
-  Revision 1.30  2004-08-24 19:31:44  hajny
+  Revision 1.31  2004-08-25 15:55:32  peter
+    * fixed win32 that was broken by previous fix
+
+  Revision 1.30  2004/08/24 19:31:44  hajny
     * binary writer fix for GO32v2 from Peter
 
   Revision 1.29  2004/06/20 08:55:30  florian