gcc/ada/ChangeLog:

        * libgnat/s-objrea.adb (Object_Arch): Add LOONGARCH.
        * libgnat/s-objrea.ads (EM_LOONGARCH): New e_machine number.
        (ELF_Ops.Initialize) Handle the EM_LOONGARCH case.
        (Read_Address): Same.
---
 gcc/ada/libgnat/s-objrea.adb | 6 +++++-
 gcc/ada/libgnat/s-objrea.ads | 5 ++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/gcc/ada/libgnat/s-objrea.adb b/gcc/ada/libgnat/s-objrea.adb
index 255ddde4a98..2223697c016 100644
--- a/gcc/ada/libgnat/s-objrea.adb
+++ b/gcc/ada/libgnat/s-objrea.adb
@@ -82,6 +82,7 @@ package body System.Object_Reader is
       EM_X86_64      : constant := 62; --  AMD x86-64 architecture
       EM_AARCH64     : constant := 183; --  Aarch64
       EM_RISCV       : constant := 243; --  RISC-V
+      EM_LOONGARCH   : constant := 258; --  LoongArch
 
       EN_NIDENT  : constant := 16;
 
@@ -657,6 +658,9 @@ package body System.Object_Reader is
             when EM_RISCV =>
                Res.Arch := RISCV;
 
+            when EM_LOONGARCH =>
+               Res.Arch := LOONGARCH;
+
             when others =>
                raise Format_Error with "unrecognized architecture";
          end case;
@@ -2081,7 +2085,7 @@ package body System.Object_Reader is
             Address_64 := Read (S);
             return Address_64;
 
-         when RISCV | S390 =>
+         when RISCV | S390 | LOONGARCH =>
             case Obj.Format is
                when ELF32 =>
                   Address_32 := Read (S);
diff --git a/gcc/ada/libgnat/s-objrea.ads b/gcc/ada/libgnat/s-objrea.ads
index 88bf21629c3..b044946fabb 100644
--- a/gcc/ada/libgnat/s-objrea.ads
+++ b/gcc/ada/libgnat/s-objrea.ads
@@ -129,9 +129,12 @@ package System.Object_Reader is
       AARCH64,
       --  64-bit ARM
 
-      RISCV);
+      RISCV,
       --  RISC-V
 
+      LOONGARCH);
+      --  LoongArch
+
    ------------------
    -- Target types --
    ------------------
-- 
2.34.1

Reply via email to