From 86771e8963653c306e53c07e1640914081afb30a Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mjw@redhat.com>
Date: Tue, 24 Mar 2015 11:32:36 +0100
Subject: [PATCH] elf.h SHF_EXCLUDE signed int 31 bit shift triggers undefined
behaviour.
Any use of SHF_EXCLUDE in code that tries to check it against sh_flags
will trigger undefined behaviour because it is defined as a 31 bit shift
against an signed integer. Fix by explicitly using an unsigned int.
---
ChangeLog | 4 ++++
elf/elf.h | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
@@ -371,7 +371,7 @@ typedef struct
#define SHF_MASKPROC 0xf0000000 /* Processor-specific */
#define SHF_ORDERED (1 << 30) /* Special ordering requirement
(Solaris). */
-#define SHF_EXCLUDE (1 << 31) /* Section is excluded unless
+#define SHF_EXCLUDE (1U << 31) /* Section is excluded unless
referenced or allocated (Solaris).*/
/* Section group handling. */
--
1.8.3.1