aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2025-01-14 11:00:24 +0100
committerEric Botcazou <ebotcazou@adacore.com>2025-01-14 11:02:01 +0100
commit744a59f3f55bfc890f755c57c72919566e1bcad5 (patch)
treefc1a1695917c3447279c04b6ce2d001451e5d0b0 /gcc/ada
parent31c3c1a83fd885b4687c9f6f7acd68af76d758d3 (diff)
downloadgcc-744a59f3f55bfc890f755c57c72919566e1bcad5.zip
gcc-744a59f3f55bfc890f755c57c72919566e1bcad5.tar.gz
gcc-744a59f3f55bfc890f755c57c72919566e1bcad5.tar.bz2
Ada: add missing support for the S/390 and RISC-V architectures
...to the object file reader present in the run-time library. gcc/ada/ PR ada/118459 * libgnat/s-objrea.ads (Object_Arch): Add S390 and RISCV. * libgnat/s-objrea.adb (EM_S390): New named number. (EM_RISCV): Likewise. (ELF_Ops.Initialize): Deal with EM_S390 and EM_RISCV. (Read_Address): Deal with S390 and RISCV.
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/libgnat/s-objrea.adb30
-rw-r--r--gcc/ada/libgnat/s-objrea.ads8
2 files changed, 33 insertions, 5 deletions
diff --git a/gcc/ada/libgnat/s-objrea.adb b/gcc/ada/libgnat/s-objrea.adb
index ab0e701..25ab1a2 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 6159564..a606b6d 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 --
------------------