520cc8
Downstream-only adjustments to scripts/glibcelf.py.  We do not have
520cc8
CSKY nor RISC-V constants in <elf.h>, so glibcelf cannot extract
520cc8
those.  PT_AARCH64_* constants are missing as well.
520cc8
520cc8
Adjust elf/tst-glibcelf.py to use PT_MIPS_OPTIONS instead of
520cc8
PT_AARCH64_MEMTAG_MTE for testing.  It has the same numeric value
520cc8
(0x70000002).
520cc8
520cc8
diff --git a/elf/tst-glibcelf.py b/elf/tst-glibcelf.py
520cc8
index a5bff45eae55edea..9cb0861589d6ae2e 100644
520cc8
--- a/elf/tst-glibcelf.py
520cc8
+++ b/elf/tst-glibcelf.py
520cc8
@@ -75,15 +75,17 @@ def check_basic():
520cc8
     if repr(glibcelf.Pt(17609)) != 'Pt(17609)':
520cc8
         error('repr(Pt(17609))')
520cc8
 
520cc8
-    if glibcelf.Pt('PT_AARCH64_MEMTAG_MTE') \
520cc8
-       is not glibcelf.Pt.PT_AARCH64_MEMTAG_MTE:
520cc8
-        error('PT_AARCH64_MEMTAG_MTE identity')
520cc8
-    if glibcelf.Pt(0x70000002) is glibcelf.Pt.PT_AARCH64_MEMTAG_MTE:
520cc8
+    # Note: Upstream uses PT_AARCH64_MEMTAG_MTE instead of PT_MIPS_OPTIONS.
520cc8
+    # PT_AARCH64_MEMTAG_MTE is not yet available downstream.
520cc8
+    if glibcelf.Pt('PT_MIPS_OPTIONS') \
520cc8
+       is not glibcelf.Pt.PT_MIPS_OPTIONS:
520cc8
+        error('PT_MIPS_OPTIONS identity')
520cc8
+    if glibcelf.Pt(0x70000002) is glibcelf.Pt.PT_MIPS_OPTIONS:
520cc8
         error('Pt(0x70000002) identity')
520cc8
-    if glibcelf.PtAARCH64(0x70000002) is not glibcelf.Pt.PT_AARCH64_MEMTAG_MTE:
520cc8
-        error('PtAARCH64(0x70000002) identity')
520cc8
-    if glibcelf.Pt.PT_AARCH64_MEMTAG_MTE.short_name != 'AARCH64_MEMTAG_MTE':
520cc8
-        error('PT_AARCH64_MEMTAG_MTE short name')
520cc8
+    if glibcelf.PtMIPS(0x70000002) is not glibcelf.Pt.PT_MIPS_OPTIONS:
520cc8
+        error('PtMIPS(0x70000002) identity')
520cc8
+    if glibcelf.Pt.PT_MIPS_OPTIONS.short_name != 'MIPS_OPTIONS':
520cc8
+        error('PT_MIPS_OPTIONS short name')
520cc8
 
520cc8
     # Special cases for int-like Shn.
520cc8
     if glibcelf.Shn(32) == glibcelf.Shn.SHN_XINDEX:
520cc8
diff --git a/scripts/glibcelf.py b/scripts/glibcelf.py
520cc8
index 59aab56ecf9deb3e..5980d7cc906005e2 100644
520cc8
--- a/scripts/glibcelf.py
520cc8
+++ b/scripts/glibcelf.py
520cc8
@@ -306,23 +306,17 @@ class ShtALPHA(Sht):
520cc8
     """Supplemental SHT_* constants for EM_ALPHA."""
520cc8
 class ShtARM(Sht):
520cc8
     """Supplemental SHT_* constants for EM_ARM."""
520cc8
-class ShtCSKY(Sht):
520cc8
-    """Supplemental SHT_* constants for EM_CSKY."""
520cc8
 class ShtIA_64(Sht):
520cc8
     """Supplemental SHT_* constants for EM_IA_64."""
520cc8
 class ShtMIPS(Sht):
520cc8
     """Supplemental SHT_* constants for EM_MIPS."""
520cc8
 class ShtPARISC(Sht):
520cc8
     """Supplemental SHT_* constants for EM_PARISC."""
520cc8
-class ShtRISCV(Sht):
520cc8
-    """Supplemental SHT_* constants for EM_RISCV."""
520cc8
 _register_elf_h(ShtALPHA, prefix='SHT_ALPHA_', parent=Sht)
520cc8
 _register_elf_h(ShtARM, prefix='SHT_ARM_', parent=Sht)
520cc8
-_register_elf_h(ShtCSKY, prefix='SHT_CSKY_', parent=Sht)
520cc8
 _register_elf_h(ShtIA_64, prefix='SHT_IA_64_', parent=Sht)
520cc8
 _register_elf_h(ShtMIPS, prefix='SHT_MIPS_', parent=Sht)
520cc8
 _register_elf_h(ShtPARISC, prefix='SHT_PARISC_', parent=Sht)
520cc8
-_register_elf_h(ShtRISCV, prefix='SHT_RISCV_', parent=Sht)
520cc8
 _register_elf_h(Sht, ranges=True,
520cc8
                 skip='SHT_LOSUNW SHT_HISUNW SHT_LOUSER SHT_HIUSER'.split())
520cc8
 
520cc8
@@ -392,8 +386,6 @@ _register_elf_h(Stt, ranges=True)
520cc8
 class Pt(_TypedConstant):
520cc8
     """ELF program header types.  Type of Phdr.p_type."""
520cc8
     prefix = 'PT_'
520cc8
-class PtAARCH64(Pt):
520cc8
-    """Supplemental PT_* constants for EM_AARCH64."""
520cc8
 class PtARM(Pt):
520cc8
     """Supplemental PT_* constants for EM_ARM."""
520cc8
 class PtHP(Pt):
520cc8
@@ -404,15 +396,11 @@ class PtMIPS(Pt):
520cc8
     """Supplemental PT_* constants for EM_MIPS."""
520cc8
 class PtPARISC(Pt):
520cc8
     """Supplemental PT_* constants for EM_PARISC."""
520cc8
-class PtRISCV(Pt):
520cc8
-    """Supplemental PT_* constants for EM_RISCV."""
520cc8
-_register_elf_h(PtAARCH64, prefix='PT_AARCH64_', parent=Pt)
520cc8
 _register_elf_h(PtARM, prefix='PT_ARM_', parent=Pt)
520cc8
 _register_elf_h(PtHP, prefix='PT_HP_', parent=Pt)
520cc8
 _register_elf_h(PtIA_64, prefix='PT_IA_64_', parent=Pt)
520cc8
 _register_elf_h(PtMIPS, prefix='PT_MIPS_', parent=Pt)
520cc8
 _register_elf_h(PtPARISC, prefix='PT_PARISC_', parent=Pt)
520cc8
-_register_elf_h(PtRISCV, prefix='PT_RISCV_', parent=Pt)
520cc8
 _register_elf_h(Pt, skip='PT_LOSUNW PT_HISUNW'.split(), ranges=True)
520cc8
 
520cc8
 class Dt(_TypedConstant):
520cc8
@@ -432,8 +420,6 @@ class DtPPC(Dt):
520cc8
     """Supplemental DT_* constants for EM_PPC."""
520cc8
 class DtPPC64(Dt):
520cc8
     """Supplemental DT_* constants for EM_PPC64."""
520cc8
-class DtRISCV(Dt):
520cc8
-    """Supplemental DT_* constants for EM_RISCV."""
520cc8
 class DtSPARC(Dt):
520cc8
     """Supplemental DT_* constants for EM_SPARC."""
520cc8
 _dt_skip = '''
520cc8
@@ -456,7 +442,6 @@ _register_elf_h(DtIA_64, prefix='DT_IA_64_', skip=_dt_skip, parent=Dt)
520cc8
 _register_elf_h(DtMIPS, prefix='DT_MIPS_', skip=_dt_skip, parent=Dt)
520cc8
 _register_elf_h(DtPPC, prefix='DT_PPC_', skip=_dt_skip, parent=Dt)
520cc8
 _register_elf_h(DtPPC64, prefix='DT_PPC64_', skip=_dt_skip, parent=Dt)
520cc8
-_register_elf_h(DtRISCV, prefix='DT_RISCV_', skip=_dt_skip, parent=Dt)
520cc8
 _register_elf_h(DtSPARC, prefix='DT_SPARC_', skip=_dt_skip, parent=Dt)
520cc8
 _register_elf_h(Dt, skip=_dt_skip, ranges=True)
520cc8
 del _dt_skip