Jelajahi Sumber

* support ABSOLUTE32 in the COFF writer on x86-64, resolves #10641

git-svn-id: trunk@11376 -
florian 17 tahun lalu
induk
melakukan
9e88af9a78
3 mengubah file dengan 29 tambahan dan 0 penghapusan
  1. 1 0
      .gitattributes
  2. 7 0
      compiler/ogcoff.pas
  3. 21 0
      tests/webtbs/tw10641.pp

+ 1 - 0
.gitattributes

@@ -8294,6 +8294,7 @@ tests/webtbs/tw10519.pp svneol=native#text/plain
 tests/webtbs/tw10540.pp svneol=native#text/plain
 tests/webtbs/tw1061.pp svneol=native#text/plain
 tests/webtbs/tw10623.pp svneol=native#text/plain
+tests/webtbs/tw10641.pp svneol=native#text/plain
 tests/webtbs/tw1066a.pp svneol=native#text/plain
 tests/webtbs/tw1066b.pp svneol=native#text/plain
 tests/webtbs/tw1068.pp svneol=native#text/plain

+ 7 - 0
compiler/ogcoff.pas

@@ -1012,6 +1012,13 @@ const pemagic : array[0..3] of byte = (
                       CurrObjSec.addsectionreloc(curraddr,CurrObjSec,RELOC_ABSOLUTE);
                       inc(data,symaddr);
                     end;
+{$ifdef x86_64}
+                  RELOC_ABSOLUTE32 :
+                    begin
+                      CurrObjSec.addsectionreloc(curraddr,CurrObjSec,RELOC_ABSOLUTE32);
+                      inc(data,symaddr);
+                    end;
+{$endif x86_64}
                   RELOC_RELATIVE :
                     begin
                       inc(data,symaddr-len-CurrObjSec.Size);

+ 21 - 0
tests/webtbs/tw10641.pp

@@ -0,0 +1,21 @@
+{ %cpu=x86_64 }
+var
+  test : dword;
+
+begin
+  test:=$deadbeef;
+  ASM
+    MOVL $0,%EAX
+    JMP .LLT(%RAX)
+    .align 16
+.LLT:
+    .quad .L1,.L2
+.L2:
+    MOVL $12341234,test
+.L1:
+    MOVL $0,test
+  END;
+  if test<>0 then
+    halt(1);
+  writeln('ok');
+end.