aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2024-05-28 10:12:28 +0100
committerNick Clifton <nickc@redhat.com>2024-05-28 10:12:28 +0100
commit08b0f198b16af719c329581e0ddc290c4c9b17ae (patch)
tree073d2a1f4305efdcfb0658f7310f4433aae5744f
parentb85af8d9fd31bc20c9f506350f22fda54fb3dbc7 (diff)
downloadbinutils-08b0f198b16af719c329581e0ddc290c4c9b17ae.zip
binutils-08b0f198b16af719c329581e0ddc290c4c9b17ae.tar.gz
binutils-08b0f198b16af719c329581e0ddc290c4c9b17ae.tar.bz2
Add new ELF section and segment types to readelf.
-rw-r--r--binutils/readelf.c617
-rw-r--r--include/elf/aarch64.h10
-rw-r--r--include/elf/alpha.h4
-rw-r--r--include/elf/arm.h11
-rw-r--r--include/elf/common.h89
-rw-r--r--include/elf/csky.h2
-rw-r--r--include/elf/hppa.h14
-rw-r--r--include/elf/mips.h87
-rw-r--r--include/elf/msp430.h2
-rw-r--r--include/elf/riscv.h2
-rw-r--r--include/elf/x86-64.h2
11 files changed, 517 insertions, 323 deletions
diff --git a/binutils/readelf.c b/binutils/readelf.c
index e2203cf..103720e 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -5099,6 +5099,7 @@ get_osabi_name (Filedata * filedata, unsigned int osabi)
case ELFOSABI_FENIXOS: return "FenixOS";
case ELFOSABI_CLOUDABI: return "Nuxi CloudABI";
case ELFOSABI_OPENVOS: return "Stratus Technologies OpenVOS";
+ case ELFOSABI_CUDA: return "CUDA";
default:
if (osabi >= 64)
switch (filedata->file_header.e_machine)
@@ -5158,9 +5159,9 @@ get_aarch64_segment_type (unsigned long type)
{
switch (type)
{
- case PT_AARCH64_ARCHEXT: return "AARCH64_ARCHEXT";
+ case PT_AARCH64_ARCHEXT: return "AARCH64_ARCHEXT";
case PT_AARCH64_MEMTAG_MTE: return "AARCH64_MEMTAG_MTE";
- default: return NULL;
+ default: return NULL;
}
}
@@ -5169,8 +5170,9 @@ get_arm_segment_type (unsigned long type)
{
switch (type)
{
- case PT_ARM_EXIDX: return "EXIDX";
- default: return NULL;
+ case PT_ARM_ARCHEXT: return "ARM_ARCHEXT";
+ case PT_ARM_EXIDX: return "ARM_EXIDX";
+ default: return NULL;
}
}
@@ -5262,17 +5264,19 @@ get_hpux_segment_type (unsigned long type, unsigned e_machine)
case PT_HP_HSL_ANNOT: return "HP_HSL_ANNOT";
case PT_HP_STACK: return "HP_STACK";
case PT_HP_CORE_UTSNAME: return "HP_CORE_UTSNAME";
- default: return NULL;
+ default:
+ break;
}
if (e_machine == EM_IA_64)
switch (type)
{
- case PT_HP_TLS: return "HP_TLS";
+ case PT_HP_TLS: return "HP_TLS";
case PT_IA_64_HP_OPT_ANOT: return "HP_OPT_ANNOT";
case PT_IA_64_HP_HSL_ANOT: return "HP_HSL_ANNOT";
case PT_IA_64_HP_STACK: return "HP_STACK";
- default: return NULL;
+ default:
+ break;
}
return NULL;
@@ -5283,19 +5287,127 @@ get_solaris_segment_type (unsigned long type)
{
switch (type)
{
- case 0x6464e550: return "PT_SUNW_UNWIND";
- case 0x6474e550: return "PT_SUNW_EH_FRAME";
- case 0x6ffffff7: return "PT_LOSUNW";
- case 0x6ffffffa: return "PT_SUNWBSS";
- case 0x6ffffffb: return "PT_SUNWSTACK";
- case 0x6ffffffc: return "PT_SUNWDTRACE";
- case 0x6ffffffd: return "PT_SUNWCAP";
- case 0x6fffffff: return "PT_HISUNW";
- default: return NULL;
+ case PT_SUNW_UNWIND: return "SUNW_UNWIND";
+ case PT_SUNW_EH_FRAME: return "SUNW_EH_FRAME";
+ case PT_SUNWBSS: return "SUNW_BSS";
+ case PT_SUNWSTACK: return "SUNW_STACK";
+ case PT_SUNWDTRACE: return "SUNW_DTRACE";
+ case PT_SUNWCAP: return "SUNW_CAP";
+ default: return NULL;
}
}
static const char *
+get_os_specific_segment_type (Filedata * filedata, unsigned long p_type)
+{
+ static char buff[32];
+ const char * result = NULL;
+
+ switch (filedata->file_header.e_ident[EI_OSABI])
+ {
+ case ELFOSABI_GNU:
+ case ELFOSABI_FREEBSD:
+ if (p_type >= PT_GNU_MBIND_LO && p_type <= PT_GNU_MBIND_HI)
+ {
+ sprintf (buff, "GNU_MBIND+%#lx", p_type - PT_GNU_MBIND_LO);
+ result = buff;
+ }
+ break;
+
+ case ELFOSABI_HPUX:
+ result = get_hpux_segment_type (p_type,
+ filedata->file_header.e_machine);
+ break;
+
+ case ELFOSABI_SOLARIS:
+ result = get_solaris_segment_type (p_type);
+ break;
+
+ default:
+ break;
+ }
+
+ if (result != NULL)
+ return result;
+
+ switch (p_type)
+ {
+ case PT_GNU_EH_FRAME: return "GNU_EH_FRAME";
+ case PT_GNU_STACK: return "GNU_STACK";
+ case PT_GNU_RELRO: return "GNU_RELRO";
+ case PT_GNU_PROPERTY: return "GNU_PROPERTY";
+ case PT_GNU_SFRAME: return "GNU_SFRAME";
+
+ case PT_OPENBSD_MUTABLE: return "OPENBSD_MUTABLE";
+ case PT_OPENBSD_RANDOMIZE: return "OPENBSD_RANDOMIZE";
+ case PT_OPENBSD_WXNEEDED: return "OPENBSD_WXNEEDED";
+ case PT_OPENBSD_NOBTCFI: return "OPENBSD_NOBTCFI";
+ case PT_OPENBSD_SYSCALLS: return "OPENBSD_SYSCALLS";
+ case PT_OPENBSD_BOOTDATA: return "OPENBSD_BOOTDATA";
+
+ default:
+ break;
+ }
+
+ sprintf (buff, "LOOS+%#lx", p_type - PT_LOOS);
+ return buff;
+}
+
+static const char *
+get_processor_specific_segment_type (Filedata * filedata, unsigned long p_type)
+{
+ static char buff[32];
+ const char * result = NULL;
+
+ switch (filedata->file_header.e_machine)
+ {
+ case EM_AARCH64:
+ result = get_aarch64_segment_type (p_type);
+ break;
+
+ case EM_ARM:
+ result = get_arm_segment_type (p_type);
+ break;
+
+ case EM_MIPS:
+ case EM_MIPS_RS3_LE:
+ result = get_mips_segment_type (p_type);
+ break;
+
+ case EM_PARISC:
+ result = get_parisc_segment_type (p_type);
+ break;
+
+ case EM_IA_64:
+ result = get_ia64_segment_type (p_type);
+ break;
+
+ case EM_TI_C6000:
+ result = get_tic6x_segment_type (p_type);
+ break;
+
+ case EM_S390:
+ case EM_S390_OLD:
+ result = get_s390_segment_type (p_type);
+ break;
+
+ case EM_RISCV:
+ result = get_riscv_segment_type (p_type);
+ break;
+
+ default:
+ result = NULL;
+ break;
+ }
+
+ if (result != NULL)
+ return result;
+
+ sprintf (buff, "LOPROC+%#lx", p_type - PT_LOPROC);
+ return buff;
+}
+
+static const char *
get_segment_type (Filedata * filedata, unsigned long p_type)
{
static char buff[32];
@@ -5310,96 +5422,17 @@ get_segment_type (Filedata * filedata, unsigned long p_type)
case PT_SHLIB: return "SHLIB";
case PT_PHDR: return "PHDR";
case PT_TLS: return "TLS";
- case PT_GNU_EH_FRAME: return "GNU_EH_FRAME";
- case PT_GNU_STACK: return "GNU_STACK";
- case PT_GNU_RELRO: return "GNU_RELRO";
- case PT_GNU_PROPERTY: return "GNU_PROPERTY";
- case PT_GNU_SFRAME: return "GNU_SFRAME";
-
- case PT_OPENBSD_MUTABLE: return "OPENBSD_MUTABLE";
- case PT_OPENBSD_RANDOMIZE: return "OPENBSD_RANDOMIZE";
- case PT_OPENBSD_WXNEEDED: return "OPENBSD_WXNEEDED";
- case PT_OPENBSD_NOBTCFI: return "OPENBSD_NOBTCFI";
- case PT_OPENBSD_SYSCALLS: return "OPENBSD_SYSCALLS";
- case PT_OPENBSD_BOOTDATA: return "OPENBSD_BOOTDATA";
-
- default:
- if ((p_type >= PT_LOPROC) && (p_type <= PT_HIPROC))
- {
- const char * result;
-
- switch (filedata->file_header.e_machine)
- {
- case EM_AARCH64:
- result = get_aarch64_segment_type (p_type);
- break;
- case EM_ARM:
- result = get_arm_segment_type (p_type);
- break;
- case EM_MIPS:
- case EM_MIPS_RS3_LE:
- result = get_mips_segment_type (p_type);
- break;
- case EM_PARISC:
- result = get_parisc_segment_type (p_type);
- break;
- case EM_IA_64:
- result = get_ia64_segment_type (p_type);
- break;
- case EM_TI_C6000:
- result = get_tic6x_segment_type (p_type);
- break;
- case EM_S390:
- case EM_S390_OLD:
- result = get_s390_segment_type (p_type);
- break;
- case EM_RISCV:
- result = get_riscv_segment_type (p_type);
- break;
- default:
- result = NULL;
- break;
- }
-
- if (result != NULL)
- return result;
-
- sprintf (buff, "LOPROC+%#lx", p_type - PT_LOPROC);
- }
- else if ((p_type >= PT_LOOS) && (p_type <= PT_HIOS))
- {
- const char * result = NULL;
+ case PT_NUM: return "NUM";
+ }
- switch (filedata->file_header.e_ident[EI_OSABI])
- {
- case ELFOSABI_GNU:
- case ELFOSABI_FREEBSD:
- if (p_type >= PT_GNU_MBIND_LO && p_type <= PT_GNU_MBIND_HI)
- {
- sprintf (buff, "GNU_MBIND+%#lx", p_type - PT_GNU_MBIND_LO);
- result = buff;
- }
- break;
- case ELFOSABI_HPUX:
- result = get_hpux_segment_type (p_type,
- filedata->file_header.e_machine);
- break;
- case ELFOSABI_SOLARIS:
- result = get_solaris_segment_type (p_type);
- break;
- default:
- break;
- }
- if (result != NULL)
- return result;
+ if ((p_type >= PT_LOOS) && (p_type <= PT_HIOS))
+ return get_os_specific_segment_type (filedata, p_type);
- sprintf (buff, "LOOS+%#lx", p_type - PT_LOOS);
- }
- else
- snprintf (buff, sizeof (buff), _("<unknown>: %lx"), p_type);
+ if ((p_type >= PT_LOPROC) && (p_type <= PT_HIPROC))
+ return get_processor_specific_segment_type (filedata, p_type);
- return buff;
- }
+ snprintf (buff, sizeof (buff), _("<unknown>: %lx"), p_type);
+ return buff;
}
static const char *
@@ -5475,9 +5508,9 @@ get_parisc_section_type_name (unsigned int sh_type)
case SHT_PARISC_UNWIND: return "PARISC_UNWIND";
case SHT_PARISC_DOC: return "PARISC_DOC";
case SHT_PARISC_ANNOT: return "PARISC_ANNOT";
+ case SHT_PARISC_DLKM: return "PARISC_DLKM";
case SHT_PARISC_SYMEXTN: return "PARISC_SYMEXTN";
case SHT_PARISC_STUBS: return "PARISC_STUBS";
- case SHT_PARISC_DLKM: return "PARISC_DLKM";
default: return NULL;
}
}
@@ -5494,6 +5527,17 @@ get_ia64_section_type_name (Filedata * filedata, unsigned int sh_type)
case SHT_IA_64_EXT: return "IA_64_EXT";
case SHT_IA_64_UNWIND: return "IA_64_UNWIND";
case SHT_IA_64_PRIORITY_INIT: return "IA_64_PRIORITY_INIT";
+ default:
+ break;
+ }
+ return NULL;
+}
+
+static const char *
+get_vms_section_type_name (unsigned int sh_type)
+{
+ switch (sh_type)
+ {
case SHT_IA_64_VMS_TRACE: return "VMS_TRACE";
case SHT_IA_64_VMS_TIE_SIGNATURES: return "VMS_TIE_SIGNATURES";
case SHT_IA_64_VMS_DEBUG: return "VMS_DEBUG";
@@ -5522,8 +5566,16 @@ get_aarch64_section_type_name (unsigned int sh_type)
{
switch (sh_type)
{
- case SHT_AARCH64_ATTRIBUTES: return "AARCH64_ATTRIBUTES";
- default: return NULL;
+ case SHT_AARCH64_ATTRIBUTES:
+ return "AARCH64_ATTRIBUTES";
+ case SHT_AARCH64_AUTH_RELR:
+ return "AARCH64_AUTH_RELR";
+ case SHT_AARCH64_MEMTAG_GLOBALS_STATIC:
+ return "AARCH64_MEMTAG_GLOBALS_STATIC";
+ case SHT_AARCH64_MEMTAG_GLOBALS_DYNAMIC:
+ return "AARCH64_MEMTAG_GLOBALS_DYNAMIC";
+ default:
+ return NULL;
}
}
@@ -5617,11 +5669,222 @@ get_csky_section_type_name (unsigned int sh_type)
}
static const char *
-get_section_type_name (Filedata * filedata, unsigned int sh_type)
+get_powerpc_section_type_name (unsigned int sh_type)
+{
+ switch (sh_type)
+ {
+ case SHT_ORDERED: return "ORDERED";
+ default: return NULL;
+ }
+}
+
+static const char *
+get_alpha_section_type_name (unsigned int sh_type)
+{
+ switch (sh_type)
+ {
+ case SHT_ALPHA_DEBUG: return "DEBUG";
+ case SHT_ALPHA_REGINFO: return "REGINFO";
+ default: return NULL;
+ }
+}
+
+static const char *
+get_processor_specific_section_type_name (Filedata * filedata, unsigned int sh_type)
+{
+ static char buff[32];
+ const char * result = NULL;
+
+ switch (filedata->file_header.e_machine)
+ {
+ case EM_AARCH64:
+ result = get_aarch64_section_type_name (sh_type);
+ break;
+
+ case EM_ALPHA:
+ result = get_alpha_section_type_name (sh_type);
+ break;
+
+ case EM_ARC:
+ case EM_ARC_COMPACT:
+ case EM_ARC_COMPACT2:
+ case EM_ARC_COMPACT3:
+ case EM_ARC_COMPACT3_64:
+ result = get_arc_section_type_name (sh_type);
+ break;
+
+ case EM_ARM:
+ result = get_arm_section_type_name (sh_type);
+ break;
+
+ case EM_CSKY:
+ result = get_csky_section_type_name (sh_type);
+ break;
+
+ case EM_IA_64:
+ result = get_ia64_section_type_name (filedata, sh_type);
+ break;
+
+ case EM_MIPS:
+ case EM_MIPS_RS3_LE:
+ result = get_mips_section_type_name (sh_type);
+ break;
+
+ case EM_MSP430:
+ result = get_msp430_section_type_name (sh_type);
+ break;
+
+ case EM_NFP:
+ result = get_nfp_section_type_name (sh_type);
+ break;
+
+ case EM_PARISC:
+ result = get_parisc_section_type_name (sh_type);
+ break;
+
+ case EM_PPC64:
+ case EM_PPC:
+ return get_powerpc_section_type_name (sh_type);
+ break;
+
+ case EM_RISCV:
+ result = get_riscv_section_type_name (sh_type);
+ break;
+
+ case EM_TI_C6000:
+ result = get_tic6x_section_type_name (sh_type);
+ break;
+
+ case EM_V800:
+ case EM_V850:
+ case EM_CYGNUS_V850:
+ result = get_v850_section_type_name (sh_type);
+ break;
+
+ case EM_X86_64:
+ case EM_L1OM:
+ case EM_K1OM:
+ result = get_x86_64_section_type_name (sh_type);
+ break;
+
+ default:
+ break;
+ }
+
+ if (result != NULL)
+ return result;
+
+ switch (sh_type)
+ {
+ /* FIXME: Are these correct ? If so, why do they not have #define's ? */
+ case 0x7ffffffd: return "AUXILIARY";
+ case 0x7fffffff: return "FILTER";
+ default:
+ break;
+ }
+
+ sprintf (buff, "LOPROC+%#x", sh_type - SHT_LOPROC);
+ return buff;
+}
+
+static const char *
+get_os_specific_section_type_name (Filedata * filedata, unsigned int sh_type)
+{
+ static char buff[32];
+ const char * result = NULL;
+
+ switch (filedata->file_header.e_machine)
+ {
+ case EM_IA_64:
+ result = get_vms_section_type_name (sh_type);
+ break;
+ default:
+ break;
+ }
+
+ if (result != NULL)
+ return result;
+
+ if (filedata->file_header.e_ident[EI_OSABI] == ELFOSABI_SOLARIS)
+ result = get_solaris_section_type (sh_type);
+
+ if (result != NULL)
+ return result;
+
+ switch (sh_type)
+ {
+ case SHT_GNU_INCREMENTAL_INPUTS: return "GNU_INCREMENTAL_INPUTS";
+ case SHT_GNU_ATTRIBUTES: return "GNU_ATTRIBUTES";
+ case SHT_GNU_HASH: return "GNU_HASH";
+ case SHT_GNU_LIBLIST: return "GNU_LIBLIST";
+
+ case SHT_SUNW_move: return "SUNW_MOVE";
+ case SHT_SUNW_COMDAT: return "SUNW_COMDAT";
+ case SHT_SUNW_syminfo: return "SUNW_SYMINFO";
+ case SHT_GNU_verdef: return "VERDEF";
+ case SHT_GNU_verneed: return "VERNEED";
+ case SHT_GNU_versym: return "VERSYM";
+
+ case SHT_LLVM_ODRTAB: return "LLVM_ODRTAB";
+ case SHT_LLVM_LINKER_OPTIONS: return "LLVM_LINKER_OPTIONS";
+ case SHT_LLVM_ADDRSIG: return "LLVM_ADDRSIG";
+ case SHT_LLVM_DEPENDENT_LIBRARIES: return "LLVM_DEPENDENT_LIBRARIES";
+ case SHT_LLVM_SYMPART: return "LLVM_SYMPART";
+ case SHT_LLVM_PART_EHDR: return "LLVM_PART_EHDR";
+ case SHT_LLVM_PART_PHDR: return "LLVM_PART_PHDR";
+ case SHT_LLVM_BB_ADDR_MAP_V0: return "LLVM_BB_ADDR_MAP_V0";
+ case SHT_LLVM_CALL_GRAPH_PROFILE: return "LLVM_CALL_GRAPH_PROFILE";
+ case SHT_LLVM_BB_ADDR_MAP: return "LLVM_BB_ADDR_MAP";
+ case SHT_LLVM_OFFLOADING: return "LLVM_OFFLOADING";
+ case SHT_LLVM_LTO: return "LLVM_LTO";
+
+ case SHT_ANDROID_REL: return "ANDROID_REL";
+ case SHT_ANDROID_RELA: return "ANDROID_RELA";
+ case SHT_ANDROID_RELR: return "ANDROID_RELR";
+
+ case SHT_CHECKSUM: return "CHECKSUM";
+
+ /* FIXME: Are these correct ? If so, why do they not have #define's ? */
+ case 0x6ffffff0: return "VERSYM";
+
+ default:
+ break;
+ }
+
+ sprintf (buff, "LOOS+%#x", sh_type - SHT_LOOS);
+ return buff;
+}
+
+static const char *
+get_user_specific_section_type_name (Filedata * filedata, unsigned int sh_type)
{
static char buff[32];
const char * result;
+ switch (filedata->file_header.e_machine)
+ {
+ case EM_V800:
+ case EM_V850:
+ case EM_CYGNUS_V850:
+ result = get_v850_section_type_name (sh_type);
+ break;
+
+ default:
+ result = NULL;
+ break;
+ }
+
+ if (result != NULL)
+ return result;
+
+ sprintf (buff, "LOUSER+%#x", sh_type - SHT_LOUSER);
+ return buff;
+}
+
+static const char *
+get_section_type_name (Filedata * filedata,
+ unsigned int sh_type)
+{
switch (sh_type)
{
case SHT_NULL: return "NULL";
@@ -5645,139 +5908,25 @@ get_section_type_name (Filedata * filedata, unsigned int sh_type)
case SHT_RELR: return "RELR";
/* End of generic section types. */
- /* OS specific section types: */
- case SHT_GNU_verdef: return "VERDEF";
- case SHT_GNU_verneed: return "VERNEED";
- case SHT_GNU_versym: return "VERSYM";
- case SHT_GNU_INCREMENTAL_INPUTS: return "GNU_INCREMENTAL_INPUTS";
- case 0x6ffffff0: return "VERSYM";
- case SHT_GNU_ATTRIBUTES: return "GNU_ATTRIBUTES";
- case SHT_GNU_HASH: return "GNU_HASH";
- case SHT_GNU_LIBLIST: return "GNU_LIBLIST";
- case 0x6ffffffc: return "VERDEF";
- case 0x7ffffffd: return "AUXILIARY";
- case 0x7fffffff: return "FILTER";
-
default:
- if ((sh_type >= SHT_LOPROC) && (sh_type <= SHT_HIPROC))
- {
- switch (filedata->file_header.e_machine)
- {
- case EM_ARC:
- case EM_ARC_COMPACT:
- case EM_ARC_COMPACT2:
- case EM_ARC_COMPACT3:
- case EM_ARC_COMPACT3_64:
- result = get_arc_section_type_name (sh_type);
- break;
- case EM_MIPS:
- case EM_MIPS_RS3_LE:
- result = get_mips_section_type_name (sh_type);
- break;
- case EM_PARISC:
- result = get_parisc_section_type_name (sh_type);
- break;
- case EM_IA_64:
- result = get_ia64_section_type_name (filedata, sh_type);
- break;
- case EM_X86_64:
- case EM_L1OM:
- case EM_K1OM:
- result = get_x86_64_section_type_name (sh_type);
- break;
- case EM_AARCH64:
- result = get_aarch64_section_type_name (sh_type);
- break;
- case EM_ARM:
- result = get_arm_section_type_name (sh_type);
- break;
- case EM_TI_C6000:
- result = get_tic6x_section_type_name (sh_type);
- break;
- case EM_MSP430:
- result = get_msp430_section_type_name (sh_type);
- break;
- case EM_NFP:
- result = get_nfp_section_type_name (sh_type);
- break;
- case EM_V800:
- case EM_V850:
- case EM_CYGNUS_V850:
- result = get_v850_section_type_name (sh_type);
- break;
- case EM_RISCV:
- result = get_riscv_section_type_name (sh_type);
- break;
- case EM_CSKY:
- result = get_csky_section_type_name (sh_type);
- break;
- default:
- result = NULL;
- break;
- }
-
- if (result != NULL)
- return result;
-
- sprintf (buff, "LOPROC+%#x", sh_type - SHT_LOPROC);
- }
- else if ((sh_type >= SHT_LOOS) && (sh_type <= SHT_HIOS))
- {
- switch (filedata->file_header.e_machine)
- {
- case EM_IA_64:
- result = get_ia64_section_type_name (filedata, sh_type);
- break;
- default:
- if (filedata->file_header.e_ident[EI_OSABI] == ELFOSABI_SOLARIS)
- result = get_solaris_section_type (sh_type);
- else
- {
- switch (sh_type)
- {
- case SHT_GNU_INCREMENTAL_INPUTS: result = "GNU_INCREMENTAL_INPUTS"; break;
- case SHT_GNU_ATTRIBUTES: result = "GNU_ATTRIBUTES"; break;
- case SHT_GNU_HASH: result = "GNU_HASH"; break;
- case SHT_GNU_LIBLIST: result = "GNU_LIBLIST"; break;
- default:
- result = NULL;
- break;
- }
- }
- break;
- }
+ break;
+ }
- if (result != NULL)
- return result;
+ if ((sh_type >= SHT_LOPROC) && (sh_type <= SHT_HIPROC))
+ return get_processor_specific_section_type_name (filedata, sh_type);
- sprintf (buff, "LOOS+%#x", sh_type - SHT_LOOS);
- }
- else if ((sh_type >= SHT_LOUSER) && (sh_type <= SHT_HIUSER))
- {
- switch (filedata->file_header.e_machine)
- {
- case EM_V800:
- case EM_V850:
- case EM_CYGNUS_V850:
- result = get_v850_section_type_name (sh_type);
- break;
- default:
- result = NULL;
- break;
- }
+ if ((sh_type >= SHT_LOOS) && (sh_type <= SHT_HIOS))
+ return get_os_specific_section_type_name (filedata, sh_type);
- if (result != NULL)
- return result;
+ if ((sh_type >= SHT_LOUSER) && (sh_type <= SHT_HIUSER))
+ return get_user_specific_section_type_name (filedata, sh_type);
- sprintf (buff, "LOUSER+%#x", sh_type - SHT_LOUSER);
- }
- else
- /* This message is probably going to be displayed in a 15
- character wide field, so put the hex value first. */
- snprintf (buff, sizeof (buff), _("%08x: <unknown>"), sh_type);
+ static char buff[32];
- return buff;
- }
+ /* This message is probably going to be displayed in a 15
+ character wide field, so put the hex value first. */
+ snprintf (buff, sizeof (buff), _("%08x: <unknown>"), sh_type);
+ return buff;
}
enum long_option_values
diff --git a/include/elf/aarch64.h b/include/elf/aarch64.h
index fe92a83..cd0f77d 100644
--- a/include/elf/aarch64.h
+++ b/include/elf/aarch64.h
@@ -31,7 +31,15 @@
#define PT_AARCH64_MEMTAG_MTE (PT_LOPROC + 0x2)
/* Additional section types. */
-#define SHT_AARCH64_ATTRIBUTES 0x70000003 /* Section holds attributes. */
+/* Section holds attributes. */
+#define SHT_AARCH64_ATTRIBUTES (SHT_LOPROC + 3)
+/* Special aarch64-specific section for MTE support, as described in:
+ https://github.com/ARM-software/abi-aa/blob/main/pauthabielf64/pauthabielf64.rst#section-types */
+#define SHT_AARCH64_AUTH_RELR (SHT_LOPROC + 4)
+/* Special aarch64-specific sections for MTE support, as described in:
+ https://github.com/ARM-software/abi-aa/blob/main/memtagabielf64/memtagabielf64.rst#7section-types */
+#define SHT_AARCH64_MEMTAG_GLOBALS_STATIC (SHT_LOPROC + 7)
+#define SHT_AARCH64_MEMTAG_GLOBALS_DYNAMIC (SHT_LOPROC + 8)
/* AArch64-specific values for sh_flags. */
#define SHF_ENTRYSECT 0x10000000 /* Section contains an
diff --git a/include/elf/alpha.h b/include/elf/alpha.h
index 02618c0..a65bf9c 100644
--- a/include/elf/alpha.h
+++ b/include/elf/alpha.h
@@ -42,10 +42,10 @@
/* Section contains some sort of debugging information. The exact
format is unspecified. It's probably ECOFF symbols. */
-#define SHT_ALPHA_DEBUG 0x70000001
+#define SHT_ALPHA_DEBUG (SHT_LOPROC + 1)
/* Section contains register usage information. */
-#define SHT_ALPHA_REGINFO 0x70000002
+#define SHT_ALPHA_REGINFO (SHT_LOPROC + 2)
/* A section of type SHT_MIPS_REGINFO contains the following
structure. */
diff --git a/include/elf/arm.h b/include/elf/arm.h
index 01708ef..6d96d6b 100644
--- a/include/elf/arm.h
+++ b/include/elf/arm.h
@@ -37,6 +37,7 @@
#define EF_ARM_VFP_FLOAT 0x400
/* Removed, was EF_ARM_MAVERICK_FLOAT 0x800 */
+#define PT_ARM_ARCHEXT (PT_LOPROC + 0)
/* Frame unwind information */
#define PT_ARM_EXIDX (PT_LOPROC + 1)
@@ -76,11 +77,11 @@
#define STT_ARM_16BIT STT_HIPROC /* A Thumb label. */
/* Additional section types. */
-#define SHT_ARM_EXIDX 0x70000001 /* Section holds ARM unwind info. */
-#define SHT_ARM_PREEMPTMAP 0x70000002 /* Section pre-emption details. */
-#define SHT_ARM_ATTRIBUTES 0x70000003 /* Section holds attributes. */
-#define SHT_ARM_DEBUGOVERLAY 0x70000004 /* Section holds overlay debug info. */
-#define SHT_ARM_OVERLAYSECTION 0x70000005 /* Section holds GDB and overlay integration info. */
+#define SHT_ARM_EXIDX (SHT_LOPROC + 1) /* Section holds ARM unwind info. */
+#define SHT_ARM_PREEMPTMAP (SHT_LOPROC + 2) /* Section pre-emption details. */
+#define SHT_ARM_ATTRIBUTES (SHT_LOPROC + 3) /* Section holds attributes. */
+#define SHT_ARM_DEBUGOVERLAY (SHT_LOPROC + 4) /* Section holds overlay debug info. */
+#define SHT_ARM_OVERLAYSECTION (SHT_LOPROC + 5) /* Section holds GDB and overlay integration info. */
/* ARM-specific values for sh_flags. */
#define SHF_ENTRYSECT 0x10000000 /* Section contains an entry point. */
diff --git a/include/elf/common.h b/include/elf/common.h
index 7e62c34..78c85bd 100644
--- a/include/elf/common.h
+++ b/include/elf/common.h
@@ -76,20 +76,20 @@
#define ELFOSABI_CLOUDABI 17 /* Nuxi CloudABI */
#define ELFOSABI_OPENVOS 18 /* Stratus Technologies OpenVOS */
-#define ELFOSABI_C6000_ELFABI 64 /* Bare-metal TMS320C6000 */
-#define ELFOSABI_AMDGPU_HSA 64 /* AMD HSA Runtime */
-#define ELFOSABI_C6000_LINUX 65 /* Linux TMS320C6000 */
-#define ELFOSABI_AMDGPU_PAL 65 /* AMD PAL Runtime */
-#define ELFOSABI_ARM_FDPIC 65 /* ARM FDPIC */
+#define ELFOSABI_CUDA 51 /* NVIDIA CUDA architecture. */
+#define ELFOSABI_C6000_ELFABI 64 /* Bare-metal TMS320C6000 */
+#define ELFOSABI_AMDGPU_HSA 64 /* AMD HSA Runtime */
+#define ELFOSABI_C6000_LINUX 65 /* Linux TMS320C6000 */
+#define ELFOSABI_AMDGPU_PAL 65 /* AMD PAL Runtime */
+#define ELFOSABI_ARM_FDPIC 65 /* ARM FDPIC */
#define ELFOSABI_AMDGPU_MESA3D 66 /* AMD Mesa3D Runtime */
-#define ELFOSABI_ARM 97 /* ARM */
-#define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */
+#define ELFOSABI_ARM 97 /* ARM */
+#define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */
#define EI_ABIVERSION 8 /* ABI version */
#define EI_PAD 9 /* Start of padding bytes */
-
/* Values for e_type, which identifies the object file type. */
#define ET_NONE 0 /* No file type */
@@ -479,11 +479,12 @@
#define PT_SHLIB 5 /* Reserved, unspecified semantics */
#define PT_PHDR 6 /* Entry for header table itself */
#define PT_TLS 7 /* Thread local storage segment */
+#define PT_NUM 8 /* Number of defined types. */
+
#define PT_LOOS 0x60000000 /* OS-specific */
#define PT_HIOS 0x6fffffff /* OS-specific */
-#define PT_LOPROC 0x70000000 /* Processor-specific */
-#define PT_HIPROC 0x7FFFFFFF /* Processor-specific */
+#define PT_SUNW_UNWIND (PT_LOOS + 0x464e550)
#define PT_GNU_EH_FRAME (PT_LOOS + 0x474e550) /* Frame unwind information */
#define PT_SUNW_EH_FRAME PT_GNU_EH_FRAME /* Solaris uses the same value */
#define PT_GNU_STACK (PT_LOOS + 0x474e551) /* Stack flags */
@@ -499,11 +500,20 @@
#define PT_OPENBSD_SYSCALLS (PT_LOOS + 0x5a3dbe9) /* System call sites. */
#define PT_OPENBSD_BOOTDATA (PT_LOOS + 0x5a41be6) /* Section for boot arguments. */
+/* Solaris segment types. */
+#define PT_SUNWBSS (PT_LOOS + 0xffffffa) /* Sun Specific segment. */
+#define PT_SUNWSTACK (PT_LOOS + 0xffffffb) /* Stack segment. */
+#define PT_SUNWDTRACE (PT_LOOS + 0xffffffc)
+#define PT_SUNWCAP (PT_LOOS + 0xffffffd)
+
/* Mbind segments */
#define PT_GNU_MBIND_NUM 4096
#define PT_GNU_MBIND_LO (PT_LOOS + 0x474e555)
#define PT_GNU_MBIND_HI (PT_GNU_MBIND_LO + PT_GNU_MBIND_NUM - 1)
+#define PT_LOPROC 0x70000000 /* Processor-specific */
+#define PT_HIPROC 0x7FFFFFFF /* Processor-specific */
+
/* Program segment permissions, in program header p_flags field. */
#define PF_X (1 << 0) /* Segment is executable */
@@ -538,17 +548,40 @@
#define SHT_LOOS 0x60000000 /* First of OS specific semantics */
#define SHT_HIOS 0x6fffffff /* Last of OS specific semantics */
-#define SHT_GNU_INCREMENTAL_INPUTS 0x6fff4700 /* incremental build data */
-#define SHT_GNU_ATTRIBUTES 0x6ffffff5 /* Object attributes */
-#define SHT_GNU_HASH 0x6ffffff6 /* GNU style symbol hash table */
-#define SHT_GNU_LIBLIST 0x6ffffff7 /* List of prelink dependencies */
-
+#define SHT_ANDROID_REL 0x60000001
+#define SHT_ANDROID_RELA 0x60000002
+
+#define SHT_GNU_INCREMENTAL_INPUTS 0x6fff4700 /* Incremental build data */
+
+#define SHT_LLVM_ODRTAB 0x6fff4c00 /* LLVM ODR table. */
+#define SHT_LLVM_LINKER_OPTIONS 0x6fff4c01 /* LLVM Linker Options. */
+#define SHT_LLVM_ADDRSIG 0x6fff4c03 /* List of address-significant symbols for safe ICF. */
+#define SHT_LLVM_DEPENDENT_LIBRARIES 0x6fff4c04 /* LLVM Dependent Library Specifiers. */
+#define SHT_LLVM_SYMPART 0x6fff4c05 /* Symbol partition specification. */
+#define SHT_LLVM_PART_EHDR 0x6fff4c06 /* ELF header for loadable partition. */
+#define SHT_LLVM_PART_PHDR 0x6fff4c07 /* Phdrs for loadable partition. */
+#define SHT_LLVM_BB_ADDR_MAP_V0 0x6fff4c08 /* LLVM Basic Block Address Map. */
+#define SHT_LLVM_CALL_GRAPH_PROFILE 0x6fff4c09 /* LLVM Call Graph Profile. */
+#define SHT_LLVM_BB_ADDR_MAP 0x6fff4c0a /* LLVM Basic Block Address Map. */
+#define SHT_LLVM_OFFLOADING 0x6fff4c0b /* LLVM device offloading data. */
+#define SHT_LLVM_LTO 0x6fff4c0c /* .llvm.lto for fat LTO. */
+
+#define SHT_ANDROID_RELR 0x6fffff00
+
+#define SHT_GNU_ATTRIBUTES 0x6ffffff5 /* Object attributes */
+#define SHT_GNU_HASH 0x6ffffff6 /* GNU style symbol hash table */
+#define SHT_GNU_LIBLIST 0x6ffffff7 /* List of prelink dependencies */
+#define SHT_CHECKSUM 0x6ffffff8 /* Checksum for DSO content. */
+
+#define SHT_SUNW_move 0x6ffffffa
+#define SHT_SUNW_COMDAT 0x6ffffffb
+#define SHT_SUNW_syminfo 0x6ffffffc
/* The next three section types are defined by Solaris, and are named
SHT_SUNW*. We use them in GNU code, so we also define SHT_GNU*
versions. */
-#define SHT_SUNW_verdef 0x6ffffffd /* Versions defined by file */
-#define SHT_SUNW_verneed 0x6ffffffe /* Versions needed by file */
-#define SHT_SUNW_versym 0x6fffffff /* Symbol versions */
+#define SHT_SUNW_verdef 0x6ffffffd /* Versions defined by file */
+#define SHT_SUNW_verneed 0x6ffffffe /* Versions needed by file */
+#define SHT_SUNW_versym 0x6fffffff /* Symbol versions */
#define SHT_GNU_verdef SHT_SUNW_verdef
#define SHT_GNU_verneed SHT_SUNW_verneed
@@ -556,6 +589,7 @@
#define SHT_LOPROC 0x70000000 /* Processor-specific semantics, lo */
#define SHT_HIPROC 0x7FFFFFFF /* Processor-specific semantics, hi */
+
#define SHT_LOUSER 0x80000000 /* Application-specific semantics */
/* #define SHT_HIUSER 0x8FFFFFFF *//* Application-specific semantics */
#define SHT_HIUSER 0xFFFFFFFF /* New value, defined in Oct 4, 1999 Draft */
@@ -576,19 +610,16 @@
/* #define SHF_MASKOS 0x0F000000 *//* OS-specific semantics */
#define SHF_MASKOS 0x0FF00000 /* New value, Oct 4, 1999 Draft */
-#define SHF_GNU_RETAIN (1 << 21) /* Section should not be garbage collected by the linker. */
-#define SHF_MASKPROC 0xF0000000 /* Processor-specific semantics */
+#define SHF_GNU_RETAIN (1 << 21) /* Section should not be garbage collected by the linker. */
+#define SHF_GNU_MBIND (1 << 24) /* Mbind section. */
+#define SHF_MASKPROC 0xF0000000 /* Processor-specific semantics */
/* This used to be implemented as a processor specific section flag.
- We just make it generic. */
-#define SHF_EXCLUDE 0x80000000 /* Link editor is to exclude
- this section from executable
- and shared library that it
- builds when those objects
- are not to be further
- relocated. */
-
-#define SHF_GNU_MBIND 0x01000000 /* Mbind section. */
+ We just make it generic. The definition is: the link editor is
+ to exclude this section from executable and shared libraries that
+ it builds when those objects are not to be further relocated. */
+#define SHF_EXCLUDE (1U << 31)
+
/* Compression types. */
#define ELFCOMPRESS_ZLIB 1 /* Compressed with zlib. */
diff --git a/include/elf/csky.h b/include/elf/csky.h
index fcecbb1..c35a9ff 100644
--- a/include/elf/csky.h
+++ b/include/elf/csky.h
@@ -95,7 +95,7 @@ START_RELOC_NUMBERS (elf_csky_reloc_type)
END_RELOC_NUMBERS (R_CKCORE_MAX)
/* Additional section types. */
-#define SHT_CSKY_ATTRIBUTES 0x70000001 /* Section holds attributes. */
+#define SHT_CSKY_ATTRIBUTES (SHT_LOPROC + 1) /* Section holds attributes. */
/* Object attribute tags. */
enum
diff --git a/include/elf/hppa.h b/include/elf/hppa.h
index 0cafb99..fc90108 100644
--- a/include/elf/hppa.h
+++ b/include/elf/hppa.h
@@ -63,27 +63,27 @@
/* Processor specific section types. */
/* Section contains product specific extension bits. */
-#define SHT_PARISC_EXT 0x70000000
+#define SHT_PARISC_EXT (SHT_LOPROC + 0)
/* Section contains unwind table entries. */
-#define SHT_PARISC_UNWIND 0x70000001
+#define SHT_PARISC_UNWIND (SHT_LOPROC + 1)
/* Section contains debug information for optimized code. */
-#define SHT_PARISC_DOC 0x70000002
+#define SHT_PARISC_DOC (SHT_LOPROC + 2)
/* Section contains code annotations. */
-#define SHT_PARISC_ANNOT 0x70000003
+#define SHT_PARISC_ANNOT (SHT_LOPROC + 3)
/* DLKM special section. */
-#define SHT_PARISC_DLKM 0x70000004
+#define SHT_PARISC_DLKM (SHT_LOPROC + 4)
/* These are strictly for compatibility with the older elf32-hppa
implementation. Hopefully we can eliminate them in the future. */
/* Optional section holding argument location/relocation info. */
-#define SHT_PARISC_SYMEXTN SHT_LOPROC + 8
+#define SHT_PARISC_SYMEXTN (SHT_LOPROC + 8)
/* Option section for linker stubs. */
-#define SHT_PARISC_STUBS SHT_LOPROC + 9
+#define SHT_PARISC_STUBS (SHT_LOPROC + 9)
/* Processor specific section flags. */
diff --git a/include/elf/mips.h b/include/elf/mips.h
index 686d550..fb33576 100644
--- a/include/elf/mips.h
+++ b/include/elf/mips.h
@@ -373,131 +373,136 @@ END_RELOC_NUMBERS (R_MIPS_maxext)
/* Section contains the set of dynamic shared objects used when
statically linking. */
-#define SHT_MIPS_LIBLIST 0x70000000
+#define SHT_MIPS_LIBLIST (SHT_LOPROC + 0)
/* I'm not sure what this is, but it's used on Irix 5. */
-#define SHT_MIPS_MSYM 0x70000001
+#define SHT_MIPS_MSYM (SHT_LOPROC + 1)
/* Section contains list of symbols whose definitions conflict with
symbols defined in shared objects. */
-#define SHT_MIPS_CONFLICT 0x70000002
+#define SHT_MIPS_CONFLICT (SHT_LOPROC + 2)
/* Section contains the global pointer table. */
-#define SHT_MIPS_GPTAB 0x70000003
+#define SHT_MIPS_GPTAB (SHT_LOPROC + 3)
/* Section contains microcode information. The exact format is
unspecified. */
-#define SHT_MIPS_UCODE 0x70000004
+#define SHT_MIPS_UCODE (SHT_LOPROC + 4)
/* Section contains some sort of debugging information. The exact
format is unspecified. It's probably ECOFF symbols. */
-#define SHT_MIPS_DEBUG 0x70000005
+#define SHT_MIPS_DEBUG (SHT_LOPROC + 5)
/* Section contains register usage information. */
-#define SHT_MIPS_REGINFO 0x70000006
+#define SHT_MIPS_REGINFO (SHT_LOPROC + 6)
/* ??? */
-#define SHT_MIPS_PACKAGE 0x70000007
+#define SHT_MIPS_PACKAGE (SHT_LOPROC + 7)
/* ??? */
-#define SHT_MIPS_PACKSYM 0x70000008
+#define SHT_MIPS_PACKSYM (SHT_LOPROC + 8)
/* ??? */
-#define SHT_MIPS_RELD 0x70000009
+#define SHT_MIPS_RELD (SHT_LOPROC + 9)
+/* Note: SHT_LOPROC + 0xa is missing... */
+
/* Section contains interface information. */
-#define SHT_MIPS_IFACE 0x7000000b
+#define SHT_MIPS_IFACE (SHT_LOPROC + 0xb)
/* Section contains description of contents of another section. */
-#define SHT_MIPS_CONTENT 0x7000000c
+#define SHT_MIPS_CONTENT (SHT_LOPROC + 0xc)
/* Section contains miscellaneous options. */
-#define SHT_MIPS_OPTIONS 0x7000000d
+#define SHT_MIPS_OPTIONS (SHT_LOPROC + 0xd)
+
+/* Note: SHT_LOPROC + 0xe is missing... */
+/* Note: SHT_LOPROC + 0xf is missing... */
/* ??? */
-#define SHT_MIPS_SHDR 0x70000010
+#define SHT_MIPS_SHDR (SHT_LOPROC + 0x10)
/* ??? */
-#define SHT_MIPS_FDESC 0x70000011
+#define SHT_MIPS_FDESC (SHT_LOPROC + 0x11)
/* ??? */
-#define SHT_MIPS_EXTSYM 0x70000012
+#define SHT_MIPS_EXTSYM (SHT_LOPROC + 0x12)
/* ??? */
-#define SHT_MIPS_DENSE 0x70000013
+#define SHT_MIPS_DENSE (SHT_LOPROC + 0x13)
/* ??? */
-#define SHT_MIPS_PDESC 0x70000014
+#define SHT_MIPS_PDESC (SHT_LOPROC + 0x14)
/* ??? */
-#define SHT_MIPS_LOCSYM 0x70000015
+#define SHT_MIPS_LOCSYM (SHT_LOPROC + 0x15)
/* ??? */
-#define SHT_MIPS_AUXSYM 0x70000016
+#define SHT_MIPS_AUXSYM (SHT_LOPROC + 0x16)
/* ??? */
-#define SHT_MIPS_OPTSYM 0x70000017
+#define SHT_MIPS_OPTSYM (SHT_LOPROC + 0x17)
/* ??? */
-#define SHT_MIPS_LOCSTR 0x70000018
+#define SHT_MIPS_LOCSTR (SHT_LOPROC + 0x18)
/* ??? */
-#define SHT_MIPS_LINE 0x70000019
+#define SHT_MIPS_LINE (SHT_LOPROC + 0x19)
/* ??? */
-#define SHT_MIPS_RFDESC 0x7000001a
+#define SHT_MIPS_RFDESC (SHT_LOPROC + 0x1a)
/* Delta C++: symbol table */
-#define SHT_MIPS_DELTASYM 0x7000001b
+#define SHT_MIPS_DELTASYM (SHT_LOPROC + 0x1b)
/* Delta C++: instance table */
-#define SHT_MIPS_DELTAINST 0x7000001c
+#define SHT_MIPS_DELTAINST (SHT_LOPROC + 0x1c)
/* Delta C++: class table */
-#define SHT_MIPS_DELTACLASS 0x7000001d
+#define SHT_MIPS_DELTACLASS (SHT_LOPROC + 0x1d)
/* DWARF debugging section. */
-#define SHT_MIPS_DWARF 0x7000001e
+#define SHT_MIPS_DWARF (SHT_LOPROC + 0x1e)
/* Delta C++: declarations */
-#define SHT_MIPS_DELTADECL 0x7000001f
+#define SHT_MIPS_DELTADECL (SHT_LOPROC + 0x1f)
/* List of libraries the binary depends on. Includes a time stamp, version
number. */
-#define SHT_MIPS_SYMBOL_LIB 0x70000020
+#define SHT_MIPS_SYMBOL_LIB (SHT_LOPROC + 0x20)
/* Events section. */
-#define SHT_MIPS_EVENTS 0x70000021
+#define SHT_MIPS_EVENTS (SHT_LOPROC + 0x21)
/* ??? */
-#define SHT_MIPS_TRANSLATE 0x70000022
+#define SHT_MIPS_TRANSLATE (SHT_LOPROC + 0x22)
/* Special pixie sections */
-#define SHT_MIPS_PIXIE 0x70000023
+#define SHT_MIPS_PIXIE (SHT_LOPROC + 0x23)
/* Address translation table (for debug info) */
-#define SHT_MIPS_XLATE 0x70000024
+#define SHT_MIPS_XLATE (SHT_LOPROC + 0x24)
/* SGI internal address translation table (for debug info) */
-#define SHT_MIPS_XLATE_DEBUG 0x70000025
+#define SHT_MIPS_XLATE_DEBUG (SHT_LOPROC + 0x25)
/* Intermediate code */
-#define SHT_MIPS_WHIRL 0x70000026
+#define SHT_MIPS_WHIRL (SHT_LOPROC + 0x26)
/* C++ exception handling region info */
-#define SHT_MIPS_EH_REGION 0x70000027
+#define SHT_MIPS_EH_REGION (SHT_LOPROC + 0x27)
/* Obsolete address translation table (for debug info) */
-#define SHT_MIPS_XLATE_OLD 0x70000028
+#define SHT_MIPS_XLATE_OLD (SHT_LOPROC + 0x28)
/* Runtime procedure descriptor table exception information (ucode) ??? */
-#define SHT_MIPS_PDR_EXCEPTION 0x70000029
+#define SHT_MIPS_PDR_EXCEPTION (SHT_LOPROC + 0x29)
/* ABI related flags section. */
-#define SHT_MIPS_ABIFLAGS 0x7000002a
+#define SHT_MIPS_ABIFLAGS (SHT_LOPROC + 0x2a)
/* GNU style symbol hash table with xlat. */
-#define SHT_MIPS_XHASH 0x7000002b
+#define SHT_MIPS_XHASH (SHT_LOPROC + 0x2b)
/* A section of type SHT_MIPS_LIBLIST contains an array of the
following structure. The sh_link field is the section index of the
diff --git a/include/elf/msp430.h b/include/elf/msp430.h
index dfff0d5..3b085fd 100644
--- a/include/elf/msp430.h
+++ b/include/elf/msp430.h
@@ -50,7 +50,7 @@
#define E_MSP430_MACH_MSP430x47 47
#define E_MSP430_MACH_MSP430x54 54
-#define SHT_MSP430_ATTRIBUTES 0x70000003 /* Section holds ABI attributes. */
+#define SHT_MSP430_ATTRIBUTES (SHT_LOPROC + 3)/* Section holds ABI attributes. */
#define SHT_MSP430_SEC_FLAGS 0x7f000005 /* Holds TI compiler's section flags. */
#define SHT_MSP430_SYM_ALIASES 0x7f000006 /* Holds TI compiler's symbol aliases. */
diff --git a/include/elf/riscv.h b/include/elf/riscv.h
index c1e73f7..24903c0 100644
--- a/include/elf/riscv.h
+++ b/include/elf/riscv.h
@@ -141,7 +141,7 @@ END_RELOC_NUMBERS (R_RISCV_max)
#define EF_RISCV_TSO 0x0010
/* Additional section types. */
-#define SHT_RISCV_ATTRIBUTES 0x70000003 /* Section holds attributes. */
+#define SHT_RISCV_ATTRIBUTES (SHT_LOPROC + 3) /* Section holds attributes. */
/* Processor specific program header types. */
diff --git a/include/elf/x86-64.h b/include/elf/x86-64.h
index ea5036a..6b5ada8 100644
--- a/include/elf/x86-64.h
+++ b/include/elf/x86-64.h
@@ -118,7 +118,7 @@ END_RELOC_NUMBERS (R_X86_64_max)
/* Processor specific section types. */
-#define SHT_X86_64_UNWIND 0x70000001 /* unwind information */
+#define SHT_X86_64_UNWIND (SHT_LOPROC + 1) /* Unwind information. */
/* Like SHN_COMMON but the symbol will be allocated in the .lbss
section. */