mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-22 08:09:29 +02:00
+ implement support for SPARC 64-bit in fpcres
(cherry picked from commit 060f24600b
)
This commit is contained in:
parent
3060799961
commit
a7fb4d5593
@ -22,7 +22,8 @@ interface
|
||||
type
|
||||
TElfMachineType = (emtnone, emtsparc, emti386, emtm68k, emtppc, emtppc64,
|
||||
emtarm, emtarmeb, emtia64, emtx86_64, emtalpha,
|
||||
emtmips, emtmipsel, emtppc64le, emtaarch64);
|
||||
emtmips, emtmipsel, emtppc64le, emtaarch64,
|
||||
emtriscv32, emtriscv64, emtloongarch64, emtsparc64);
|
||||
const
|
||||
ELFMAGIC = chr($7f)+'ELF';
|
||||
|
||||
@ -68,6 +69,7 @@ const
|
||||
EM_PPC64 = 21;
|
||||
EM_ARM = 40;
|
||||
// EM_OLD_ALPHA = 41;
|
||||
EM_SPARCV9 = 43; // Sparc 64-bit
|
||||
EM_IA_64 = 50;
|
||||
EM_MIPS_X = 51; // GNU readelf returns machine name "Stanford MIPS-X"
|
||||
EM_X86_64 = 62;
|
||||
@ -134,6 +136,7 @@ const
|
||||
R_AARCH64_ABS64 = 257;
|
||||
R_68K_32 = 1;
|
||||
R_SPARC_32 = 3;
|
||||
R_SPARC_64 = 32;
|
||||
R_ALPHA_REFQUAD = 2;
|
||||
R_IA64_DIR64LSB = $27;
|
||||
R_MIPS_32 = 2;
|
||||
|
@ -46,6 +46,9 @@
|
||||
{$IFDEF CPUSPARC}
|
||||
fMachineType:=emtsparc;
|
||||
{$ENDIF}
|
||||
{$IFDEF CPUSPARC64}
|
||||
fMachineType:=emtsparc64;
|
||||
{$ENDIF}
|
||||
{$IFDEF CPUALPHA}
|
||||
fMachineType:=emtalpha;
|
||||
{$ENDIF}
|
||||
|
@ -274,6 +274,7 @@ begin
|
||||
end;
|
||||
case subreader.MachineType of
|
||||
EM_SPARC : fMachineType:=emtsparc;
|
||||
EM_SPARCV9: fMachineType:=emtsparc64;
|
||||
EM_386 : fMachineType:=emti386;
|
||||
EM_68K : fMachineType:=emtm68k;
|
||||
EM_PPC : fMachineType:=emtppc;
|
||||
|
@ -421,6 +421,7 @@ begin
|
||||
EM_AARCH64: begin RelocType:=R_AARCH64_ABS64; SectionType:=SHT_RELA; end;
|
||||
EM_68K : begin RelocType:=R_68K_32; SectionType:=SHT_RELA; end;
|
||||
EM_SPARC : begin RelocType:=R_SPARC_32; SectionType:=SHT_RELA; end;
|
||||
EM_SPARCV9: begin RelocType:=R_SPARC_64; SectionType:=SHT_RELA; end;
|
||||
EM_X86_64 : begin RelocType:=R_x86_64_64; SectionType:=SHT_RELA; end;
|
||||
EM_PPC64 : begin RelocType:=R_PPC64_ADDR64; SectionType:=SHT_RELA; end;
|
||||
EM_ALPHA : begin RelocType:=R_ALPHA_REFQUAD; SectionType:=SHT_RELA; end;
|
||||
|
@ -545,6 +545,7 @@ procedure TElfResourceWriter.SetMachineType(const aMachineType: TElfMachineType)
|
||||
begin
|
||||
case aMachineType of
|
||||
emtsparc : begin fMachineTypeInt:=EM_SPARC; fBits:=ELFCLASS32; fOrder:=ELFDATA2MSB; end;
|
||||
emtsparc64: begin fMachineTypeInt:=EM_SPARCV9; fBits:=ELFCLASS64; fOrder:=ELFDATA2MSB; end;
|
||||
emti386 : begin fMachineTypeInt:=EM_386; fBits:=ELFCLASS32; fOrder:=ELFDATA2LSB; end;
|
||||
emtm68k : begin fMachineTypeInt:=EM_68K; fBits:=ELFCLASS32; fOrder:=ELFDATA2MSB; end;
|
||||
emtppc : begin fMachineTypeInt:=EM_PPC; fBits:=ELFCLASS32; fOrder:=ELFDATA2MSB; end;
|
||||
|
@ -75,7 +75,7 @@ begin
|
||||
writeln(' --arch, -a <name> Set object file architecture. Supported architectures:');
|
||||
writeln(' i386, x86_64, arm (coff)');
|
||||
writeln(' i386, x86_64, powerpc, powerpc64, arm, armeb, m68k,');
|
||||
writeln(' sparc, alpha, ia64, mips, mipsel (elf)');
|
||||
writeln(' sparc, sparc64, alpha, ia64, mips, mipsel (elf)');
|
||||
writeln(' i386, x86_64, powerpc, powerpc64, arm, aarch64 (mach-o)');
|
||||
writeln(' bigendian, littleendian (external)');
|
||||
writeln(' --subarch, -s <name> Set object file sub-architecture. Supported values:');
|
||||
@ -254,6 +254,7 @@ begin
|
||||
mtarmeb : Result.MachineType:=emtarmeb;
|
||||
mtm68k : Result.MachineType:=emtm68k;
|
||||
mtsparc : Result.MachineType:=emtsparc;
|
||||
mtsparc64 : Result.MachineType:=emtsparc64;
|
||||
mtalpha : Result.MachineType:=emtalpha;
|
||||
mtia64 : Result.MachineType:=emtia64;
|
||||
mtmips : Result.MachineType:=emtmips;
|
||||
|
@ -23,6 +23,7 @@ interface
|
||||
type
|
||||
TMachineType = (mtnone, mti386,mtx86_64,mtppc,mtppc64,mtarm,mtarmeb,mtm68k,
|
||||
mtsparc,mtalpha,mtia64,mtmips,mtmipsel,mtaarch64,mtppc64le,
|
||||
mtriscv32,mtriscv64,mtloongarch64,mtsparc64,
|
||||
mtBigEndian,mtLittleEndian);
|
||||
TMachineTypes = set of TMachineType;
|
||||
|
||||
@ -35,6 +36,7 @@ type
|
||||
(subarm: TSubMachineTypeArm);
|
||||
mtnone, mti386,mtx86_64,mtppc,mtppc64,mtm68k,
|
||||
mtsparc,mtalpha,mtia64,mtmips,mtmipsel,mtaarch64,mtppc64le,
|
||||
mtriscv32,mtriscv64,mtloongarch64,mtsparc64,
|
||||
mtBigEndian,mtLittleEndian:
|
||||
(subgen: TSubMachineTypeGeneric);
|
||||
end;
|
||||
@ -85,6 +87,10 @@ var
|
||||
(name : 'mipsel'; formats : [ofElf]), //mtmipsel
|
||||
(name : 'aarch64'; formats : [ofElf, ofCoff, ofMachO]), //mtaarch64
|
||||
(name : 'powerpc64le'; formats : [ofElf]), //mtppc64le
|
||||
(name : 'riscv32'; formats : [ofElf]), //mtriscv32
|
||||
(name : 'riscv64'; formats : [ofElf]), //mtriscv64
|
||||
(name : 'loongarch64'; formats : [ofElf]), //mtloongarch64
|
||||
(name : 'sparc64'; formats : [ofElf]), //mtsparc64
|
||||
(name : 'bigendian'; formats : [ofExt]), //mtBigEndian
|
||||
(name : 'littleendian'; formats : [ofExt]) //mtLittleEndian
|
||||
);
|
||||
@ -102,7 +108,9 @@ var
|
||||
mtppc64,mtarm,mtarmeb,
|
||||
mtm68k,mtsparc,mtalpha,
|
||||
mtia64,mtmips,mtmipsel,
|
||||
mtppc64le,mtaarch64]),
|
||||
mtppc64le,mtaarch64,
|
||||
mtriscv32,mtriscv64,
|
||||
mtloongarch64,mtsparc64]),
|
||||
(name : 'coff'; ext : '.o'; machines : [mti386,mtx86_64,mtarm,
|
||||
mtaarch64,mtppc,mtppc64]),
|
||||
(name : 'xcoff'; ext : '.o'; machines : [mtppc{,mtppc64}]),
|
||||
@ -144,6 +152,9 @@ var
|
||||
{$elseif defined(CPUSPARC)}
|
||||
machine : mtsparc;
|
||||
submachine : (subgen: smtgen_all);
|
||||
{$elseif defined(CPUSPARC64)}
|
||||
machine : mtsparc64;
|
||||
submachine : (subgen: smtgen_all);
|
||||
{$elseif defined(CPUALPHA)}
|
||||
machine : mtalpha;
|
||||
submachine : (subgen: smtgen_all);
|
||||
|
Loading…
Reference in New Issue
Block a user