From cf5feb0dca15e1898739352de4bc0028b831d0f9 Mon Sep 17 00:00:00 2001 From: Nikolay Nikolov Date: Tue, 12 Jul 2022 19:16:23 +0300 Subject: [PATCH] + support writing of 32-bit and 64-bit relocations in the REL object writer for Z80. This fixes DWARF debug output and makes it behave consistently with the Z80 external assembler writer. --- compiler/ogrel.pas | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/compiler/ogrel.pas b/compiler/ogrel.pas index 30840e5cf0..b3d491f8a0 100644 --- a/compiler/ogrel.pas +++ b/compiler/ogrel.pas @@ -334,7 +334,7 @@ implementation procedure TRelObjData.writeReloc(Data: TRelocDataInt; len: aword; p: TObjSymbol; Reloctype: TObjRelocationType); var - bytes: array [0..1] of Byte; + bytes: array [0..7] of Byte; symaddr: QWord; objreloc: TRelRelocation; begin @@ -373,6 +373,26 @@ implementation end; end; case len of + 8: + begin + bytes[0]:=Byte(Data); + bytes[1]:=Byte(Data shr 8); + bytes[2]:=Byte(Data shr 16); + bytes[3]:=Byte(Data shr 24); + bytes[4]:=0; + bytes[5]:=0; + bytes[6]:=0; + bytes[7]:=0; + writebytes(bytes,8); + end; + 4: + begin + bytes[0]:=Byte(Data); + bytes[1]:=Byte(Data shr 8); + bytes[2]:=Byte(Data shr 16); + bytes[3]:=Byte(Data shr 24); + writebytes(bytes,4); + end; 2: begin bytes[0]:=Byte(Data);