mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-01 14:50:38 +02:00
* Fix writereloc for cross-endian compilation
This commit is contained in:
parent
f3e03f0483
commit
e3b93b07c6
@ -2180,6 +2180,10 @@ Implementation
|
|||||||
tmp : word;
|
tmp : word;
|
||||||
cpu: tcputype;
|
cpu: tcputype;
|
||||||
ddword : dword;
|
ddword : dword;
|
||||||
|
b : byte;
|
||||||
|
w : word;
|
||||||
|
d : dword;
|
||||||
|
q : qword;
|
||||||
eabi_section: TObjSection;
|
eabi_section: TObjSection;
|
||||||
s: String;
|
s: String;
|
||||||
TmpDataPos: TObjSectionOfs;
|
TmpDataPos: TObjSectionOfs;
|
||||||
@ -2345,6 +2349,33 @@ Implementation
|
|||||||
ObjData.writereloc(Tai_const(hp).symofs,tai_const(hp).size,Objdata.SymbolRef(tai_const(hp).sym),RELOC_ABSOLUTE)
|
ObjData.writereloc(Tai_const(hp).symofs,tai_const(hp).size,Objdata.SymbolRef(tai_const(hp).sym),RELOC_ABSOLUTE)
|
||||||
else if relative_reloc then
|
else if relative_reloc then
|
||||||
ObjData.writereloc(ObjData.CurrObjSec.size+tai_const(hp).size-objsym.address+tai_const(hp).symofs,tai_const(hp).size,objsymend,RELOC_RELATIVE)
|
ObjData.writereloc(ObjData.CurrObjSec.size+tai_const(hp).size-objsym.address+tai_const(hp).symofs,tai_const(hp).size,objsymend,RELOC_RELATIVE)
|
||||||
|
else
|
||||||
|
if source_info.endian<>target_info.endian then
|
||||||
|
begin
|
||||||
|
case tai_const(hp).size of
|
||||||
|
1 : begin
|
||||||
|
b:=byte(Tai_const(hp).value);
|
||||||
|
ObjData.writebytes(b,1);
|
||||||
|
end;
|
||||||
|
2 : begin
|
||||||
|
w:=word(Tai_const(hp).value);
|
||||||
|
w:=swapendian(w);
|
||||||
|
ObjData.writebytes(w,2);
|
||||||
|
end;
|
||||||
|
4 : begin
|
||||||
|
d:=dword(Tai_const(hp).value);
|
||||||
|
d:=swapendian(d);
|
||||||
|
ObjData.writebytes(d,4);
|
||||||
|
end;
|
||||||
|
8 : begin
|
||||||
|
q:=qword(Tai_const(hp).value);
|
||||||
|
q:=swapendian(q);
|
||||||
|
ObjData.writebytes(q,8);
|
||||||
|
end;
|
||||||
|
else
|
||||||
|
internalerror(2024012502);
|
||||||
|
end;
|
||||||
|
end
|
||||||
else
|
else
|
||||||
ObjData.writebytes(Tai_const(hp).value,tai_const(hp).size);
|
ObjData.writebytes(Tai_const(hp).value,tai_const(hp).size);
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user