Browse Source

* RELOC_ABSOLUTE32 made different than RELOC_ABSOLUTE on i8086 (and fixed all
the i8086 bugs, related to code that assumes that they are the same)
+ also added RELOC_RELATIVE32 on i8086
* RELOC_ABSOLUTE32 and RELOC_RELATIVE32 are not yet implemented in the OMF
object writer and linker (and currently produce an internal error), but will
be implemented in the future, as the OMF format supports both 16-bit and
32-bit relocations

git-svn-id: trunk@32311 -

nickysn 9 years ago
parent
commit
78362ed6ae
2 changed files with 15 additions and 3 deletions
  1. 3 1
      compiler/ogbase.pas
  2. 12 2
      compiler/x86/aasmcpu.pas

+ 3 - 1
compiler/ogbase.pas

@@ -67,6 +67,8 @@ interface
          RELOC_PLT32,
          RELOC_PLT32,
 {$endif i386}
 {$endif i386}
 {$ifdef i8086}
 {$ifdef i8086}
+         RELOC_ABSOLUTE32,
+         RELOC_RELATIVE32,
          RELOC_FARPTR,
          RELOC_FARPTR,
          RELOC_SEG,
          RELOC_SEG,
          RELOC_SEGREL,
          RELOC_SEGREL,
@@ -102,7 +104,7 @@ interface
          RELOC_RAW
          RELOC_RAW
       );
       );
 
 
-{$ifndef x86_64}
+{$if not defined(x86_64) and not defined(i8086)}
     const
     const
       RELOC_ABSOLUTE32 = RELOC_ABSOLUTE;
       RELOC_ABSOLUTE32 = RELOC_ABSOLUTE;
 {$endif x86_64}
 {$endif x86_64}

+ 12 - 2
compiler/x86/aasmcpu.pas

@@ -3287,16 +3287,26 @@ implementation
                            currabsreloc:=RELOC_GOT32
                            currabsreloc:=RELOC_GOT32
                          else
                          else
 {$endif i386}
 {$endif i386}
+{$ifdef i8086}
+                         if ea_data.bytes=2 then
+                           currabsreloc:=RELOC_ABSOLUTE
+                         else
+{$endif i8086}
                              currabsreloc:=RELOC_ABSOLUTE32;
                              currabsreloc:=RELOC_ABSOLUTE32;
 
 
-                           if (currabsreloc=RELOC_ABSOLUTE32) and
+                           if (currabsreloc in [RELOC_ABSOLUTE32{$ifdef i8086},RELOC_ABSOLUTE{$endif}]) and
                             (Assigned(oper[opidx]^.ref^.relsymbol)) then
                             (Assigned(oper[opidx]^.ref^.relsymbol)) then
                            begin
                            begin
                              relsym:=objdata.symbolref(oper[opidx]^.ref^.relsymbol);
                              relsym:=objdata.symbolref(oper[opidx]^.ref^.relsymbol);
                              if relsym.objsection=objdata.CurrObjSec then
                              if relsym.objsection=objdata.CurrObjSec then
                                begin
                                begin
                                  currval:=objdata.CurrObjSec.size+ea_data.bytes-relsym.offset+currval;
                                  currval:=objdata.CurrObjSec.size+ea_data.bytes-relsym.offset+currval;
-                                 currabsreloc:=RELOC_RELATIVE;
+{$ifdef i8086}
+                                 if ea_data.bytes=4 then
+                                   currabsreloc:=RELOC_RELATIVE32
+                                 else
+{$endif i8086}
+                                   currabsreloc:=RELOC_RELATIVE;
                                end
                                end
                              else
                              else
                                begin
                                begin