Checks
| Context |
Check |
Description |
| rivoscibot/toolchain-ci-rivos-lint |
warning
|
Lint failed
|
| rivoscibot/toolchain-ci-rivos-apply-patch |
success
|
Patch applied
|
| linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 |
success
|
Build passed
|
| rivoscibot/toolchain-ci-rivos-build--linux-rv64gcv-lp64d-multilib |
success
|
Build passed
|
| rivoscibot/toolchain-ci-rivos-build--newlib-rv64gcv-lp64d-multilib |
success
|
Build passed
|
| rivoscibot/toolchain-ci-rivos-build--linux-rv64gc_zba_zbb_zbc_zbs-lp64d-multilib |
success
|
Build passed
|
| rivoscibot/toolchain-ci-rivos-test |
success
|
Testing passed
|
| linaro-tcwg-bot/tcwg_gcc_check--master-aarch64 |
fail
|
Patch failed to apply
|
| linaro-tcwg-bot/tcwg_gcc_build--master-arm |
fail
|
Patch failed to apply
|
Commit Message
This adds the missing support for the S/390 and RISC-V architectures to the
object file reader present in the run-time library, fixing the regression.
Tested on x86-64/Linux, applied on the mainline.
2025-01-13 Eric Botcazou <ebotcazou@adacore.com>
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.
@@ -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;
@@ -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 --
------------------