diff --git a/gcc/ada/libgnat/s-objrea.adb b/gcc/ada/libgnat/s-objrea.adb index ab0e70116d1fe3c58e5a19c187441bf8edac5a8a..25ab1a2cc9d51eb7dd10002b13134cec994bbb46 100644 --- a/gcc/ada/libgnat/s-objrea.adb +++ b/gcc/ada/libgnat/s-objrea.adb @@ -75,11 +75,13 @@ package body System.Object_Reader is EM_SPARC32PLUS : constant := 18; -- Sun SPARC 32+ EM_PPC : constant := 20; -- PowerPC EM_PPC64 : constant := 21; -- PowerPC 64-bit + EM_S390 : constant := 22; -- IBM S/390 EM_ARM : constant := 40; -- ARM EM_SPARCV9 : constant := 43; -- SPARC v9 64-bit EM_IA_64 : constant := 50; -- Intel Merced EM_X86_64 : constant := 62; -- AMD x86-64 architecture EM_AARCH64 : constant := 183; -- Aarch64 + EM_RISCV : constant := 243; -- RISC-V EN_NIDENT : constant := 16; @@ -620,8 +622,8 @@ package body System.Object_Reader is => Res.Arch := SPARC; - when EM_386 => - Res.Arch := i386; + when EM_SPARCV9 => + Res.Arch := SPARC64; when EM_MIPS | EM_MIPS_RS3_LE @@ -634,8 +636,11 @@ package body System.Object_Reader is when EM_PPC64 => Res.Arch := PPC64; - when EM_SPARCV9 => - Res.Arch := SPARC64; + when EM_S390 => + Res.Arch := S390; + + when EM_386 => + Res.Arch := i386; when EM_IA_64 => Res.Arch := IA64; @@ -649,6 +654,9 @@ package body System.Object_Reader is when EM_AARCH64 => Res.Arch := AARCH64; + when EM_RISCV => + Res.Arch := RISCV; + when others => raise Format_Error with "unrecognized architecture"; end case; @@ -2073,6 +2081,20 @@ package body System.Object_Reader is Address_64 := Read (S); return Address_64; + when RISCV | S390 => + case Obj.Format is + when ELF32 => + Address_32 := Read (S); + return uint64 (Address_32); + + when ELF64 => + Address_64 := Read (S); + return Address_64; + + when others => + raise Format_Error with "unrecognized object format"; + end case; + when Unknown => raise Format_Error with "unrecognized machine architecture"; end case; diff --git a/gcc/ada/libgnat/s-objrea.ads b/gcc/ada/libgnat/s-objrea.ads index 6159564e78ab3edc5b25a75bfc4877c2fcec5de7..a606b6d2bc4daebbf384354eb961c224f690ee7a 100644 --- a/gcc/ada/libgnat/s-objrea.ads +++ b/gcc/ada/libgnat/s-objrea.ads @@ -120,12 +120,18 @@ package System.Object_Reader is PPC64, -- 64-bit PowerPC + S390, + -- IBM S/390 + ARM, -- 32-bit ARM - AARCH64); + AARCH64, -- 64-bit ARM + RISCV); + -- RISC-V + ------------------ -- Target types -- ------------------