From 3eba3ef344b6d22187e50be0dcea883e8254609d Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Wed, 26 Aug 2020 15:13:41 +0100 Subject: [PATCH] Add support to readelf for the OpenBSD segment types. PR 26405 binutils* readelf.c (get_segment_type): Handle OpenBSD segment types. include * elf/common.h (PT_OPENBSD_BOOTDATA): Define. (PT_OPENBSD_RANDOMIZE): Define. (PT_OPENBSD_WXNEEDED): Define. --- binutils/ChangeLog | 5 +++++ binutils/readelf.c | 4 ++++ include/ChangeLog | 7 +++++++ include/elf/common.h | 5 +++++ 4 files changed, 21 insertions(+) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index bf56cc1a59f..7551db27d22 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,8 @@ +2020-08-26 Nick Clifton + + PR 26405 + * readelf.c (get_segment_type): Handle OpenBSD segment types. + 2020-08-26 Alan Modra PR 26412 diff --git a/binutils/readelf.c b/binutils/readelf.c index 86be92e3b00..7f228f1a7b0 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -4030,6 +4030,10 @@ get_segment_type (Filedata * filedata, unsigned long p_type) case PT_GNU_RELRO: return "GNU_RELRO"; case PT_GNU_PROPERTY: return "GNU_PROPERTY"; + case PT_OPENBSD_RANDOMIZE: return "OPENBSD_RANDOMIZE"; + case PT_OPENBSD_WXNEEDED: return "OPENBSD_WXNEEDED"; + case PT_OPENBSD_BOOTDATA: return "OPENBSD_BOOTDATA"; + default: if ((p_type >= PT_LOPROC) && (p_type <= PT_HIPROC)) { diff --git a/include/ChangeLog b/include/ChangeLog index b51a186fc6e..5b2bb61ba0c 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,10 @@ +2020-08-26 Nick Clifton + + PR 26405 + * elf/common.h (PT_OPENBSD_BOOTDATA): Define. + (PT_OPENBSD_RANDOMIZE): Define. + (PT_OPENBSD_WXNEEDED): Define. + 2020-08-26 Alan Modra PR 26458 diff --git a/include/elf/common.h b/include/elf/common.h index efef412caaf..805058146ab 100644 --- a/include/elf/common.h +++ b/include/elf/common.h @@ -472,6 +472,11 @@ #define PT_GNU_RELRO (PT_LOOS + 0x474e552) /* Read-only after relocation */ #define PT_GNU_PROPERTY (PT_LOOS + 0x474e553) /* GNU property */ +/* OpenBSD segment types. */ +#define PT_OPENBSD_RANDOMIZE (PT_LOOS + 0x5a3dbe6) /* Fill with random data. */ +#define PT_OPENBSD_WXNEEDED (PT_LOOS + 0x5a3dbe7) /* Program does W^X violations. */ +#define PT_OPENBSD_BOOTDATA (PT_LOOS + 0x5a41be6) /* Section for boot arguments. */ + /* Mbind segments */ #define PT_GNU_MBIND_NUM 4096 #define PT_GNU_MBIND_LO (PT_LOOS + 0x474e555) -- 2.30.2