aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.5.0/piepatch/15_all_gcc45-pr52194.patch')
-rw-r--r--gcc-4.5.0/piepatch/15_all_gcc45-pr52194.patch61
1 files changed, 61 insertions, 0 deletions
diff --git a/gcc-4.5.0/piepatch/15_all_gcc45-pr52194.patch b/gcc-4.5.0/piepatch/15_all_gcc45-pr52194.patch
new file mode 100644
index 0000000..4b7b4ae
--- /dev/null
+++ b/gcc-4.5.0/piepatch/15_all_gcc45-pr52194.patch
@@ -0,0 +1,61 @@
+2012-02-11 Magnus Granberg <zorry@gentoo.org>
+
+ PR52194
+ * gcc/c-pch.c (c_common_valid_pch) check for
+ Pax and RANDMMAP.
+
+--- a/gcc/c-pch.c 2011-08-28 22:14:46.000000000 +0200
++++ b/gcc/c-pch.c 2012-02-11 17:10:23.158018580 +0100
+@@ -36,6 +36,10 @@ along with GCC; see the file COPYING3.
+ #include "opts.h"
+ #include "timevar.h"
+
++#define FILE_BUFFER 256
++#define LINE_BUFFER 1024
++#define WORD_BUFFER 1024
++
+ /* This is a list of flag variables that must match exactly, and their
+ names for the error message. The possible values for *flag_var must
+ fit in a 'signed char'. */
+@@ -240,6 +244,11 @@ c_common_valid_pch (cpp_reader *pfile, c
+ char ident[IDENT_LENGTH + 16];
+ const char *pch_ident;
+ struct c_pch_validity v;
++ FILE *f;
++ char file[FILE_BUFFER];
++ char line[LINE_BUFFER];
++ char word[WORD_BUFFER];
++ char value[WORD_BUFFER];
+
+ /* Perform a quick test of whether this is a valid
+ precompiled header for the current language. */
+@@ -351,6 +360,29 @@ c_common_valid_pch (cpp_reader *pfile, c
+ }
+ }
+
++ /* FIXME: On PaX enabled kernel with RANDMMAP enabled we can't use
++ PCH. #PR52194 */
++
++ f = fopen ("/proc/self/status", "r");
++ if (f != NULL)
++ {
++ memset(file, 0, FILE_BUFFER);
++ while( fgets(line, LINE_BUFFER, f) )
++ {
++ sscanf(line, "%s %s", word, value);
++ if(!strcmp(word, "PaX:"))
++ {
++ if(value[3] == 'R')
++ {
++ cpp_error (pfile, CPP_DL_WARNING, "%s can't be used \
++ with PaX enabled kernel with RANDMMAP \
++ enabled.", name);
++ return 2;
++ }
++ }
++ }
++ }
++
+ /* Check the preprocessor macros are the same as when the PCH was
+ generated. */
+