# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../elfutils/elfutils-0.153-PaX-support.patch
# Copyright (C) 2012 The OpenSDE Project
#
# More information can be found in the files COPYING and README.
#
# This patch file is dual-licensed. It is available under the license the
# patched project is licensed under, as long as it is an OpenSource license
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
# of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
# --- SDE-COPYRIGHT-NOTE-END ---

Description: Add support for PaX ELF markings
Origin: Gentoo

This is a rediffed version of the original patch from Gentoo made
by Kevin F. Quinn <kevquinn@gentoo.org>

http://bugs.gentoo.org/115100

http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/dev-libs/elfutils/files/elfutils-0.118-PaX-support.patch?revision=1.1

diff -NurpP --minimal elfutils-0.153/libelf/elf.h elfutils-0.153-PaX/libelf/elf.h
--- elfutils-0.153/libelf/elf.h	2011-07-19 22:42:41.000000000 +0200
+++ elfutils-0.153-PaX/libelf/elf.h	2012-03-16 11:46:05.845672839 +0100
@@ -580,6 +580,7 @@ typedef struct
 #define PT_GNU_EH_FRAME	0x6474e550	/* GCC .eh_frame_hdr segment */
 #define PT_GNU_STACK	0x6474e551	/* Indicates stack executability */
 #define PT_GNU_RELRO	0x6474e552	/* Read-only after relocation */
+#define PT_PAX_FLAGS	0x65041580	/* Indicates PaX flag markings */
 #define PT_LOSUNW	0x6ffffffa
 #define PT_SUNWBSS	0x6ffffffa	/* Sun Specific segment */
 #define PT_SUNWSTACK	0x6ffffffb	/* Stack segment */
diff -NurpP --minimal elfutils-0.153/src/elflint.c elfutils-0.153-PaX/src/elflint.c
--- elfutils-0.153/src/elflint.c	2012-02-22 13:30:17.000000000 +0100
+++ elfutils-0.153-PaX/src/elflint.c	2012-03-16 11:41:09.918213604 +0100
@@ -4104,6 +4104,7 @@ only executables, shared objects, and co
 
       if (phdr->p_type >= PT_NUM && phdr->p_type != PT_GNU_EH_FRAME
 	  && phdr->p_type != PT_GNU_STACK && phdr->p_type != PT_GNU_RELRO
+	  && phdr->p_type != PT_PAX_FLAGS
 	  /* Check for a known machine-specific type.  */
 	  && ebl_segment_type_name (ebl, phdr->p_type, NULL, 0) == NULL)
 	ERROR (gettext ("\