From d39116912b9536bd77326260dc5c6e593fd4ee24 Mon Sep 17 00:00:00 2001 From: guenther Date: Wed, 10 Aug 2016 20:46:08 +0000 Subject: [PATCH] Teach readelf and objdump about the PT_OPENBSD_BOOTDATA section value. Teach ld to access that and PT_GNU_RELRO in linker scripts. ok deraadt@ --- gnu/usr.bin/binutils-2.17/bfd/elf.c | 1 + gnu/usr.bin/binutils-2.17/binutils/readelf.c | 2 ++ gnu/usr.bin/binutils-2.17/include/elf/common.h | 1 + gnu/usr.bin/binutils-2.17/ld/ldgram.y | 4 ++++ 4 files changed, 8 insertions(+) diff --git a/gnu/usr.bin/binutils-2.17/bfd/elf.c b/gnu/usr.bin/binutils-2.17/bfd/elf.c index c74b8503da9..eed6dd0a1d1 100644 --- a/gnu/usr.bin/binutils-2.17/bfd/elf.c +++ b/gnu/usr.bin/binutils-2.17/bfd/elf.c @@ -1087,6 +1087,7 @@ get_segment_type (unsigned int p_type) case PT_GNU_RELRO: pt = "RELRO"; break; case PT_OPENBSD_RANDOMIZE: pt = "OPENBSD_RANDOMIZE"; break; case PT_OPENBSD_WXNEEDED: pt = "OPENBSD_WXNEEDED"; break; + case PT_OPENBSD_BOOTDATA: pt = "OPENBSD_BOOTDATA"; break; default: pt = NULL; break; } return pt; diff --git a/gnu/usr.bin/binutils-2.17/binutils/readelf.c b/gnu/usr.bin/binutils-2.17/binutils/readelf.c index fe8b5200cee..85a7c18159a 100644 --- a/gnu/usr.bin/binutils-2.17/binutils/readelf.c +++ b/gnu/usr.bin/binutils-2.17/binutils/readelf.c @@ -2390,6 +2390,8 @@ get_segment_type (unsigned long p_type) 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/gnu/usr.bin/binutils-2.17/include/elf/common.h b/gnu/usr.bin/binutils-2.17/include/elf/common.h index da0a9dfa965..8f12f476c79 100644 --- a/gnu/usr.bin/binutils-2.17/include/elf/common.h +++ b/gnu/usr.bin/binutils-2.17/include/elf/common.h @@ -307,6 +307,7 @@ #define PT_OPENBSD_RANDOMIZE 0x65a3dbe6 /* Fill with random data. */ #define PT_OPENBSD_WXNEEDED 0x65a3dbe7 /* Program does W^X violations */ +#define PT_OPENBSD_BOOTDATA 0x65a41be6 /* Section for boot arguments */ /* Program segment permissions, in program header p_flags field. */ diff --git a/gnu/usr.bin/binutils-2.17/ld/ldgram.y b/gnu/usr.bin/binutils-2.17/ld/ldgram.y index 43205586a71..33ccd4d60f5 100644 --- a/gnu/usr.bin/binutils-2.17/ld/ldgram.y +++ b/gnu/usr.bin/binutils-2.17/ld/ldgram.y @@ -1089,10 +1089,14 @@ phdr_type: $$ = exp_intop (0x6474e550); else if (strcmp (s, "PT_GNU_STACK") == 0) $$ = exp_intop (0x6474e551); + else if (strcmp (s, "PT_GNU_RELRO") == 0) + $$ = exp_intop (0x6474e552); else if (strcmp (s, "PT_OPENBSD_RANDOMIZE") == 0) $$ = exp_intop (0x65a3dbe6); else if (strcmp (s, "PT_OPENBSD_WXNEEDED") == 0) $$ = exp_intop (0x65a3dbe7); + else if (strcmp (s, "PT_OPENBSD_BOOTDATA") == 0) + $$ = exp_intop (0x65a41be6); else { einfo (_("\ -- 2.20.1