mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 00:39:15 +02:00
* Fix writereloc for cross-endian compilation
This commit is contained in:
parent
f3e03f0483
commit
e3b93b07c6
@ -2180,6 +2180,10 @@ Implementation
|
||||
tmp : word;
|
||||
cpu: tcputype;
|
||||
ddword : dword;
|
||||
b : byte;
|
||||
w : word;
|
||||
d : dword;
|
||||
q : qword;
|
||||
eabi_section: TObjSection;
|
||||
s: String;
|
||||
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)
|
||||
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)
|
||||
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
|
||||
ObjData.writebytes(Tai_const(hp).value,tai_const(hp).size);
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user