summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/patchsets/gcc/5.3.0/gentoo/05_all_gcc-spec-env.patch87
-rw-r--r--src/patchsets/gcc/5.3.0/gentoo/09_all_default-ssp.patch261
-rw-r--r--src/patchsets/gcc/5.3.0/gentoo/10_all_default-fortify-source.patch29
-rw-r--r--src/patchsets/gcc/5.3.0/gentoo/11_all_default-warn-format-security.patch43
-rw-r--r--src/patchsets/gcc/5.3.0/gentoo/12_all_default-warn-trampolines.patch25
-rw-r--r--src/patchsets/gcc/5.3.0/gentoo/20_all_msgfmt-libstdc++-link.patch39
-rw-r--r--src/patchsets/gcc/5.3.0/gentoo/25_all_alpha-mieee-default.patch38
-rw-r--r--src/patchsets/gcc/5.3.0/gentoo/26_all_alpha-asm-mcpu.patch17
-rw-r--r--src/patchsets/gcc/5.3.0/gentoo/29_all_arm_armv4t-default.patch16
-rw-r--r--src/patchsets/gcc/5.3.0/gentoo/34_all_ia64_note.GNU-stack.patch92
-rw-r--r--src/patchsets/gcc/5.3.0/gentoo/34_all_libjava-classpath-locale-sort.patch57
-rw-r--r--src/patchsets/gcc/5.3.0/gentoo/38_all_sh_pr24836_all-archs.patch27
-rw-r--r--src/patchsets/gcc/5.3.0/gentoo/42_all_superh_default-multilib.patch24
-rw-r--r--src/patchsets/gcc/5.3.0/gentoo/50_all_libiberty-asprintf.patch18
-rw-r--r--src/patchsets/gcc/5.3.0/gentoo/51_all_libiberty-pic.patch10
-rw-r--r--src/patchsets/gcc/5.3.0/gentoo/52_all_netbsd-Bsymbolic.patch13
-rw-r--r--src/patchsets/gcc/5.3.0/gentoo/53_all_libitm-no-fortify-source.patch27
-rw-r--r--src/patchsets/gcc/5.3.0/gentoo/67_all_gcc-poison-system-directories.patch176
-rw-r--r--src/patchsets/gcc/5.3.0/gentoo/70_all_gcc-5-pr546752.patch459
-rw-r--r--src/patchsets/gcc/5.3.0/gentoo/74_all_gcc5_isl-dl.patch617
-rw-r--r--src/patchsets/gcc/5.3.0/gentoo/77_all_gcc-5-pr65958.patch215
-rw-r--r--src/patchsets/gcc/5.3.0/gentoo/85_all_gcc5-aarch64-pr65689.patch233
-rw-r--r--src/patchsets/gcc/5.3.0/gentoo/90_all_pr55930-dependency-tracking.patch18
-rw-r--r--src/patchsets/gcc/5.3.0/gentoo/README.history24
-rw-r--r--src/patchsets/gcc/5.3.0/pie/01_all_gcc53_configure.patch156
-rw-r--r--src/patchsets/gcc/5.3.0/pie/02_all_gcc48_config.in.patch32
-rw-r--r--src/patchsets/gcc/5.3.0/pie/03_all_gcc51_Makefile.in.patch106
-rw-r--r--src/patchsets/gcc/5.3.0/pie/05_all_gcc48_gcc.c.patch25
-rw-r--r--src/patchsets/gcc/5.3.0/pie/16_all_gcc47_nopie_option.patch16
-rw-r--r--src/patchsets/gcc/5.3.0/pie/20_all_gcc49_config_crtbeginp.patch40
-rw-r--r--src/patchsets/gcc/5.3.0/pie/24_all_gcc49_invoke.texi.patch44
-rw-r--r--src/patchsets/gcc/5.3.0/pie/33_all_gcc48_config_rs6000.patch34
-rw-r--r--src/patchsets/gcc/5.3.0/pie/34_all_gcc51_config_i386.patch56
-rw-r--r--src/patchsets/gcc/5.3.0/pie/35_all_gcc51_config_arm.patch37
-rw-r--r--src/patchsets/gcc/5.3.0/pie/36_all_gcc51_config_mips.patch43
-rw-r--r--src/patchsets/gcc/5.3.0/pie/37_all_gcc48_config_ia64.patch30
-rw-r--r--src/patchsets/gcc/5.3.0/pie/40_all_gcc49_config_esp.patch140
-rw-r--r--src/patchsets/gcc/5.3.0/pie/README19
-rw-r--r--src/patchsets/gcc/5.3.0/pie/README.Changelog442
-rw-r--r--src/patchsets/gcc/5.3.0/pie/README.history363
-rw-r--r--src/patchsets/gcc/5.3.0/uclibc/90_all_100-uclibc-conf.patch33
-rw-r--r--src/patchsets/gcc/5.3.0/uclibc/90_all_301-missing-execinfo_h.patch11
-rw-r--r--src/patchsets/gcc/5.3.0/uclibc/90_all_302-c99-snprintf.patch13
43 files changed, 4205 insertions, 0 deletions
diff --git a/src/patchsets/gcc/5.3.0/gentoo/05_all_gcc-spec-env.patch b/src/patchsets/gcc/5.3.0/gentoo/05_all_gcc-spec-env.patch
new file mode 100644
index 0000000000..214638e1fe
--- /dev/null
+++ b/src/patchsets/gcc/5.3.0/gentoo/05_all_gcc-spec-env.patch
@@ -0,0 +1,87 @@
+2013-08-22 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/gcc.c (main): Add support for external spec file via the GCC_SPECS env var
+ and move the process of the user specifed specs.
+
+ This allows us to easily control pie/ssp defaults with gcc-config profiles.
+ Original patch by Rob Holland
+ Extended to support multiple entries separated by ':' by Kevin F. Quinn
+ Modified to use getenv instead of poisoned GET_ENVIRONMENT by Ryan Hill
+ Modified to process the GCC_SPECS env var befor DRIVER_SELF_SPECS by Magnus Granberg
+
+--- a/gcc/gcc.c
++++ b/gcc/gcc.c
+@@ -6427,6 +6428,48 @@ main (int argc, char **argv)
+ do_option_spec (option_default_specs[i].name,
+ option_default_specs[i].spec);
+
++#if !(defined (__MSDOS__) || defined (OS2) || defined (VMS) || defined (WIN32))
++ /* Add specs listed in GCC_SPECS. Note; in the process of separating
++ * each spec listed, the string is overwritten at token boundaries
++ * (':') with '\0', an effect of strtok_r().
++ */
++ specs_file = getenv ("GCC_SPECS");
++ if (specs_file && (strlen(specs_file) > 0))
++ {
++ char *spec, *saveptr;
++ for (spec=strtok_r(specs_file,":",&saveptr);
++ spec!=NULL;
++ spec=strtok_r(NULL,":",&saveptr))
++ {
++ struct user_specs *user = (struct user_specs *)
++ xmalloc (sizeof (struct user_specs));
++ user->next = (struct user_specs *) 0;
++ user->filename = spec;
++ if (user_specs_tail)
++ user_specs_tail->next = user;
++ else
++ user_specs_head = user;
++ user_specs_tail = user;
++ }
++ }
++#endif
++ /* Process any user specified specs in the order given on the command
++ * line. */
++ for (struct user_specs *uptr = user_specs_head; uptr; uptr = uptr->next)
++ {
++ char *filename = find_a_file (&startfile_prefixes, uptr->filename,
++ R_OK, true);
++ read_specs (filename ? filename : uptr->filename, false, true);
++ }
++ /* Process any user self specs. */
++ {
++ struct spec_list *sl;
++ for (sl = specs; sl; sl = sl->next)
++ if (sl->name_len == sizeof "self_spec" - 1
++ && !strcmp (sl->name, "self_spec"))
++ do_self_spec (*sl->ptr_spec);
++ }
++
+ /* Process DRIVER_SELF_SPECS, adding any new options to the end
+ of the command line. */
+
+@@ -6535,24 +6578,6 @@ main (int argc, char **argv)
+ PREFIX_PRIORITY_LAST, 0, 1);
+ }
+
+- /* Process any user specified specs in the order given on the command
+- line. */
+- for (struct user_specs *uptr = user_specs_head; uptr; uptr = uptr->next)
+- {
+- char *filename = find_a_file (&startfile_prefixes, uptr->filename,
+- R_OK, true);
+- read_specs (filename ? filename : uptr->filename, false, true);
+- }
+-
+- /* Process any user self specs. */
+- {
+- struct spec_list *sl;
+- for (sl = specs; sl; sl = sl->next)
+- if (sl->name_len == sizeof "self_spec" - 1
+- && !strcmp (sl->name, "self_spec"))
+- do_self_spec (*sl->ptr_spec);
+- }
+-
+ if (compare_debug)
+ {
+ enum save_temps save;
diff --git a/src/patchsets/gcc/5.3.0/gentoo/09_all_default-ssp.patch b/src/patchsets/gcc/5.3.0/gentoo/09_all_default-ssp.patch
new file mode 100644
index 0000000000..68254ea359
--- /dev/null
+++ b/src/patchsets/gcc/5.3.0/gentoo/09_all_default-ssp.patch
@@ -0,0 +1,261 @@
+2014-04-27 Magnus Granberg <zorry@gentoo.org>
+
+ Patch orig: Debian/Ubuntu
+ # 484714
+ We Add -fstack-protector-strong as default and change
+ ssp-buffer-size
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -3238,6 +3238,9 @@ case $build in
+ esac ;;
+ esac
+
++# Needed when we build with -fstack-protector as default.
++stage1_cflags="$stage1_cflags -fno-stack-protector"
++
+ AC_SUBST(stage1_cflags)
+
+ # Enable --enable-checking in stage1 of the compiler.
+--- a/configure
++++ b/configure
+@@ -14453,7 +14453,8 @@ case $build in
+ esac ;;
+ esac
+
+-
++# Needed when we build with -fstack-protector as default.
++stage1_cflags="$stage1_cflags -fno-stack-protector"
+
+ # Enable --enable-checking in stage1 of the compiler.
+ # Check whether --enable-stage1-checking was given.
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -362,7 +362,7 @@ BUILD_PREFIX_1 = @BUILD_PREFIX_1@
+
+ # Flags to pass to stage2 and later makes. They are defined
+ # here so that they can be overridden by Makefile fragments.
+-BOOT_CFLAGS= -g -O2
++BOOT_CFLAGS= -g -O2 -fno-stack-protector
+ BOOT_LDFLAGS=
+ BOOT_ADAFLAGS= -gnatpg
+
+@@ -408,9 +408,9 @@ GNATMAKE = @GNATMAKE@
+
+ CFLAGS = @CFLAGS@
+ LDFLAGS = @LDFLAGS@
+-LIBCFLAGS = $(CFLAGS)
++LIBCFLAGS = $(CFLAGS) -fno-stack-protector
+ CXXFLAGS = @CXXFLAGS@
+-LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
++LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates -fno-stack-protector
+ GOCFLAGS = $(CFLAGS)
+
+ TFLAGS =
+--- a/gcc/doc/invoke.texi
++++ b/gcc/doc/invoke.texi
+@@ -9239,6 +9251,11 @@ Like @option{-fstack-protector} but incl
+ be protected --- those that have local array definitions, or have
+ references to local frame addresses.
+
++NOTE: In Gentoo GCC 4.9.0 and later versions this option is enabled by default
++for C, C++, ObjC, and ObjC++ if none of the options @option{-fno-stack-protector},
++@option{-nostdlib}, @option{-ffreestanding}, @option{-fstack-protector},
++@option{-fstack-protector-strong}, or @option{-fstack-protector-all} are found.
++
+ @item -fstack-protector-explicit
+ @opindex fstack-protector-explicit
+ Like @option{-fstack-protector} but only protects those functions which
+@@ -9461,6 +9465,9 @@
+ The minimum size of buffers (i.e.@: arrays) that receive stack smashing
+ protection when @option{-fstack-protection} is used.
+
++NOTE: In Gentoo this is change from "8" to "4", to increase
++the number of functions protected by the stack protector.
++
+ @item min-size-for-stack-sharing
+ The minimum size of variables taking part in stack slot sharing when not
+ optimizing. The default value is 32.
+--- a/gcc/cp/lang-specs.h
++++ b/gcc/cp/lang-specs.h
+@@ -46,7 +46,7 @@ along with GCC; see the file COPYING3. If not see
+ %(cpp_options) %2 -o %{save-temps*:%b.ii} %{!save-temps*:%g.ii} \n}\
+ cc1plus %{save-temps*|no-integrated-cpp:-fpreprocessed %{save-temps*:%b.ii} %{!save-temps*:%g.ii}}\
+ %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}\
+- %(cc1_options) %2\
++ %(cc1_options) %(ssp_default) %2\
+ %{!fsyntax-only:%{!fdump-ada-spec*:-o %g.s %{!o*:--output-pch=%i.gch}\
+ %W{o*:--output-pch=%*}}%V}}}}",
+ CPLUSPLUS_CPP_SPEC, 0, 0},
+@@ -57,11 +57,11 @@ along with GCC; see the file COPYING3. If not see
+ %(cpp_options) %2 -o %{save-temps*:%b.ii} %{!save-temps*:%g.ii} \n}\
+ cc1plus %{save-temps*|no-integrated-cpp:-fpreprocessed %{save-temps*:%b.ii} %{!save-temps*:%g.ii}}\
+ %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}\
+- %(cc1_options) %2\
++ %(cc1_options) %(ssp_default) %2\
+ %{!fsyntax-only:%(invoke_as)}}}}",
+ CPLUSPLUS_CPP_SPEC, 0, 0},
+ {".ii", "@c++-cpp-output", 0, 0, 0},
+ {"@c++-cpp-output",
+ "%{!M:%{!MM:%{!E:\
+- cc1plus -fpreprocessed %i %(cc1_options) %2\
++ cc1plus -fpreprocessed %i %(cc1_options) %(ssp_default) %2\
+ %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
+--- a/gcc/gcc.c
++++ b/gcc/gcc.c
+@@ -651,6 +651,19 @@ proper position among the other output files. */
+ #define LINK_GCC_C_SEQUENCE_SPEC "%G %L %G"
+ #endif
+
++#ifndef SSP_DEFAULT_SPEC
++#if defined ( TARGET_LIBC_PROVIDES_SSP ) && defined ( EFAULT_SSP )
++#define SSP_DEFAULT_SPEC "%{fno-stack-protector|fstack-protector| \
++ fstack-protector-strong|fstack-protector-all| \
++ ffreestanding|nostdlib:;:-fstack-protector-strong}"
++/* Add -fno-stack-protector for the use of gcc-specs-ssp. */
++#define CC1_SSP_DEFAULT_SPEC "%{!fno-stack-protector:}"
++#else
++#define SSP_DEFAULT_SPEC ""
++#define CC1_SSP_DEFAULT_SPEC ""
++#endif
++#endif
++
+ #ifndef LINK_SSP_SPEC
+ #ifdef TARGET_LIBC_PROVIDES_SSP
+ #define LINK_SSP_SPEC "%{fstack-protector:}"
+@@ -771,7 +781,7 @@ proper position among the other output f
+
+ static const char *asm_debug = ASM_DEBUG_SPEC;
+ static const char *cpp_spec = CPP_SPEC;
+-static const char *cc1_spec = CC1_SPEC;
++static const char *cc1_spec = CC1_SPEC CC1_SSP_DEFAULT_SPEC;
+ static const char *cc1plus_spec = CC1PLUS_SPEC;
+ static const char *link_gcc_c_sequence_spec = LINK_GCC_C_SEQUENCE_SPEC;
+ static const char *link_ssp_spec = LINK_SSP_SPEC;
+@@ -777,6 +785,8 @@ static const char *cc1_spec = CC1_SPEC;
+ static const char *cc1plus_spec = CC1PLUS_SPEC;
+ static const char *link_gcc_c_sequence_spec = LINK_GCC_C_SEQUENCE_SPEC;
+ static const char *link_ssp_spec = LINK_SSP_SPEC;
++static const char *ssp_default_spec = SSP_DEFAULT_SPEC;
++static const char *cc1_ssp_default_spec = CC1_SSP_DEFAULT_SPEC;
+ static const char *asm_spec = ASM_SPEC;
+ static const char *asm_final_spec = ASM_FINAL_SPEC;
+ static const char *link_spec = LINK_SPEC;
+@@ -835,7 +844,7 @@ static const char *cpp_unique_options =
+ static const char *cpp_options =
+ "%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w}\
+ %{f*} %{g*:%{!g0:%{g*} %{!fno-working-directory:-fworking-directory}}} %{O*}\
+- %{undef} %{save-temps*:-fpch-preprocess}";
++ %{undef} %{save-temps*:-fpch-preprocess} %(ssp_default)";
+
+ /* This contains cpp options which are not passed when the preprocessor
+ output will be used by another program. */
+@@ -1015,9 +1024,9 @@ static const struct compiler default_compilers[] =
+ %{save-temps*|traditional-cpp|no-integrated-cpp:%(trad_capable_cpp) \
+ %(cpp_options) -o %{save-temps*:%b.i} %{!save-temps*:%g.i} \n\
+ cc1 -fpreprocessed %{save-temps*:%b.i} %{!save-temps*:%g.i} \
+- %(cc1_options)}\
++ %(cc1_options) %(ssp_default)}\
+ %{!save-temps*:%{!traditional-cpp:%{!no-integrated-cpp:\
+- cc1 %(cpp_unique_options) %(cc1_options)}}}\
++ cc1 %(cpp_unique_options) %(cc1_options) %(ssp_default)}}}\
+ %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 1},
+ {"-",
+ "%{!E:%e-E or -x required when input is from standard input}\
+@@ -1040,7 +1049,7 @@ static const struct compiler default_compilers[] =
+ %W{o*:--output-pch=%*}}%V}}}}}}", 0, 0, 0},
+ {".i", "@cpp-output", 0, 0, 0},
+ {"@cpp-output",
+- "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
++ "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %(ssp_default) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
+ {".s", "@assembler", 0, 0, 0},
+ {"@assembler",
+ "%{!M:%{!MM:%{!E:%{!S:as %(asm_debug) %(asm_options) %i %A }}}}", 0, 0, 0},
+@@ -1267,6 +1276,8 @@ static struct spec_list static_specs[] =
+ INIT_STATIC_SPEC ("cc1plus", &cc1plus_spec),
+ INIT_STATIC_SPEC ("link_gcc_c_sequence", &link_gcc_c_sequence_spec),
+ INIT_STATIC_SPEC ("link_ssp", &link_ssp_spec),
++ INIT_STATIC_SPEC ("ssp_default", &ssp_default_spec),
++ INIT_STATIC_SPEC ("cc1_ssp_default", &cc1_ssp_default_spec),
+ INIT_STATIC_SPEC ("endfile", &endfile_spec),
+ INIT_STATIC_SPEC ("link", &link_spec),
+ INIT_STATIC_SPEC ("lib", &lib_spec),
+--- a/gcc/objc/lang-specs.h
++++ b/gcc/objc/lang-specs.h
+@@ -29,9 +29,9 @@ along with GCC; see the file COPYING3. If not see
+ %{traditional|traditional-cpp:\
+ %eGNU Objective C no longer supports traditional compilation}\
+ %{save-temps*|no-integrated-cpp:cc1obj -E %(cpp_options) -o %{save-temps*:%b.mi} %{!save-temps*:%g.mi} \n\
+- cc1obj -fpreprocessed %{save-temps*:%b.mi} %{!save-temps*:%g.mi} %(cc1_options) %{print-objc-runtime-info} %{gen-decls}}\
++ cc1obj -fpreprocessed %{save-temps*:%b.mi} %{!save-temps*:%g.mi} %(cc1_options) %(ssp_default) %{print-objc-runtime-info} %{gen-decls}}\
+ %{!save-temps*:%{!no-integrated-cpp:\
+- cc1obj %(cpp_unique_options) %(cc1_options) %{print-objc-runtime-info} %{gen-decls}}}\
++ cc1obj %(cpp_unique_options) %(cc1_options) %(ssp_default) %{print-objc-runtime-info} %{gen-decls}}}\
+ %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
+ {"@objective-c-header",
+ "%{E|M|MM:cc1obj -E %{traditional|traditional-cpp:-traditional-cpp}\
+@@ -40,18 +40,18 @@ along with GCC; see the file COPYING3. If not see
+ %{traditional|traditional-cpp:\
+ %eGNU Objective C no longer supports traditional compilation}\
+ %{save-temps*|no-integrated-cpp:cc1obj -E %(cpp_options) -o %{save-temps*:%b.mi} %{!save-temps*:%g.mi} \n\
+- cc1obj -fpreprocessed %b.mi %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\
++ cc1obj -fpreprocessed %b.mi %(cc1_options) %(ssp_default) %{print-objc-runtime-info} %{gen-decls}\
+ -o %g.s %{!o*:--output-pch=%i.gch}\
+ %W{o*:--output-pch=%*}%V}\
+ %{!save-temps*:%{!no-integrated-cpp:\
+- cc1obj %(cpp_unique_options) %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\
++ cc1obj %(cpp_unique_options) %(cc1_options) %(ssp_default) %{print-objc-runtime-info} %{gen-decls}\
+ -o %g.s %{!o*:--output-pch=%i.gch}\
+ %W{o*:--output-pch=%*}%V}}}}}", 0, 0, 0},
+ {".mi", "@objective-c-cpp-output", 0, 0, 0},
+ {"@objective-c-cpp-output",
+- "%{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\
++ "%{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %(ssp_default) %{print-objc-runtime-info} %{gen-decls}\
+ %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
+ {"@objc-cpp-output",
+ "%nobjc-cpp-output is deprecated; please use objective-c-cpp-output instead\n\
+- %{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\
++ %{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %(ssp_default) %{print-objc-runtime-info} %{gen-decls}\
+ %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
+--- a/gcc/objcp/lang-specs.h
++++ b/gcc/objcp/lang-specs.h
+@@ -36,7 +36,7 @@ along with GCC; see the file COPYING3. If not see
+ %(cpp_options) %2 -o %{save-temps*:%b.mii} %{!save-temps*:%g.mii} \n}\
+ cc1objplus %{save-temps*|no-integrated-cpp:-fpreprocessed %{save-temps*:%b.mii} %{!save-temps*:%g.mii}}\
+ %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}\
+- %(cc1_options) %2\
++ %(cc1_options) %(ssp_default) %2\
+ -o %g.s %{!o*:--output-pch=%i.gch} %W{o*:--output-pch=%*}%V}}}",
+ CPLUSPLUS_CPP_SPEC, 0, 0},
+ {"@objective-c++",
+@@ -46,16 +46,16 @@ along with GCC; see the file COPYING3. If not see
+ %(cpp_options) %2 -o %{save-temps*:%b.mii} %{!save-temps*:%g.mii} \n}\
+ cc1objplus %{save-temps*|no-integrated-cpp:-fpreprocessed %{save-temps*:%b.mii} %{!save-temps*:%g.mii}}\
+ %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}\
+- %(cc1_options) %2\
++ %(cc1_options) %(ssp_default) %2\
+ %{!fsyntax-only:%(invoke_as)}}}}",
+ CPLUSPLUS_CPP_SPEC, 0, 0},
+ {".mii", "@objective-c++-cpp-output", 0, 0, 0},
+ {"@objective-c++-cpp-output",
+ "%{!M:%{!MM:%{!E:\
+- cc1objplus -fpreprocessed %i %(cc1_options) %2\
++ cc1objplus -fpreprocessed %i %(cc1_options) %(ssp_default) %2\
+ %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
+ {"@objc++-cpp-output",
+ "%nobjc++-cpp-output is deprecated; please use objective-c++-cpp-output instead\n\
+ %{!M:%{!MM:%{!E:\
+- cc1objplus -fpreprocessed %i %(cc1_options) %2\
++ cc1objplus -fpreprocessed %i %(cc1_options) %(ssp_default) %2\
+ %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
+--- a/gcc/params.def
++++ b/gcc/params.def
+@@ -662,7 +662,7 @@ DEFPARAM (PARAM_INTEGER_SHARE_LIMIT,
+ DEFPARAM (PARAM_SSP_BUFFER_SIZE,
+ "ssp-buffer-size",
+ "The lower bound for a buffer to be considered for stack smashing protection",
+- 8, 1, 0)
++ 4, 1, 0)
+
+ /* When we thread through a block we have to make copies of the
+ statements within the block. Clearly for large blocks the code
diff --git a/src/patchsets/gcc/5.3.0/gentoo/10_all_default-fortify-source.patch b/src/patchsets/gcc/5.3.0/gentoo/10_all_default-fortify-source.patch
new file mode 100644
index 0000000000..d143da920a
--- /dev/null
+++ b/src/patchsets/gcc/5.3.0/gentoo/10_all_default-fortify-source.patch
@@ -0,0 +1,29 @@
+Enable -D_FORTIFY_SOURCE=2 by default.
+
+
+--- a/gcc/c-family/c-cppbuiltin.c
++++ b/gcc/c-family/c-cppbuiltin.c
+@@ -951,6 +951,9 @@ c_cpp_builtins (cpp_reader *pfile)
+ builtin_define_with_value ("__REGISTER_PREFIX__", REGISTER_PREFIX, 0);
+ builtin_define_with_value ("__USER_LABEL_PREFIX__", user_label_prefix, 0);
+
++ /* Fortify Source enabled by default w/optimization. */
++ cpp_define (pfile, "_FORTIFY_SOURCE=((defined __OPTIMIZE__ && __OPTIMIZE__ > 0) ? 2 : 0)");
++
+ /* Misc. */
+ if (flag_gnu89_inline)
+ cpp_define (pfile, "__GNUC_GNU_INLINE__");
+--- a/gcc/doc/gcc.info
++++ b/gcc/doc/gcc.info
+@@ -6255,6 +6255,11 @@
+ Please note the warning under `-fgcse' about invoking `-O2' on
+ programs that use computed gotos.
+
++ NOTE: In Gentoo, `-D_FORTIFY_SOURCE=2' is set by default, and is
++ activated when `-O' is set to 2 or higher. This enables additional
++ compile-time and run-time checks for several libc functions. To disable,
++ specify either `-U_FORTIFY_SOURCE' or `-D_FORTIFY_SOURCE=0'.
++
+ `-O3'
+ Optimize yet more. `-O3' turns on all optimizations specified by
+ `-O2' and also turns on the `-finline-functions',
diff --git a/src/patchsets/gcc/5.3.0/gentoo/11_all_default-warn-format-security.patch b/src/patchsets/gcc/5.3.0/gentoo/11_all_default-warn-format-security.patch
new file mode 100644
index 0000000000..022ca85c5a
--- /dev/null
+++ b/src/patchsets/gcc/5.3.0/gentoo/11_all_default-warn-format-security.patch
@@ -0,0 +1,43 @@
+Enable -Wformat and -Wformat-security by default.
+
+
+--- a/gcc/c-family/c.opt
++++ b/gcc/c-family/c.opt
+@@ -412,7 +412,7 @@ C ObjC C++ ObjC++ Var(warn_format_nonliteral) Warning LangEnabledBy(C ObjC C++ O
+ Warn about format strings that are not literals
+
+ Wformat-security
+-C ObjC C++ ObjC++ Var(warn_format_security) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 2, 0)
++C ObjC C++ ObjC++ Var(warn_format_security) Init(1) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 2, 0)
+ Warn about possible security problems with format functions
+
+ Wformat-signedness
+@@ -424,7 +424,7 @@ C ObjC C++ ObjC++ Var(warn_format_zero_length) Warning LangEnabledBy(C ObjC C++
+ Warn about zero-length formats
+
+ Wformat=
+-C ObjC C++ ObjC++ Joined RejectNegative UInteger Var(warn_format) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall, 1, 0)
++C ObjC C++ ObjC++ Joined RejectNegative UInteger Var(warn_format) Init(1) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall, 1, 0)
+ Warn about printf/scanf/strftime/strfmon format string anomalies
+
+ Wignored-qualifiers
+--- a/gcc/doc/gcc.info
++++ b/gcc/doc/gcc.info
+@@ -3451,6 +3451,8 @@
+ `-Wno-format-extra-args', and `-Wno-format-zero-length'.
+ `-Wformat' is enabled by `-Wall'.
+
++ This option is enabled by default in Gentoo.
++
+ `-Wno-format-contains-nul'
+ If `-Wformat' is specified, do not warn about format strings
+ that contain NUL bytes.
+@@ -3496,6 +3498,8 @@ compiler warns that an unrecognized option is present.
+ requires an unsigned argument and the argument is signed and
+ vice versa.
+
++ This option is enabled by default in Gentoo.
++
+ `-Wformat-y2k'
+ If `-Wformat' is specified, also warn about `strftime'
+ formats that may yield only a two-digit year.
diff --git a/src/patchsets/gcc/5.3.0/gentoo/12_all_default-warn-trampolines.patch b/src/patchsets/gcc/5.3.0/gentoo/12_all_default-warn-trampolines.patch
new file mode 100644
index 0000000000..6781b7b5b6
--- /dev/null
+++ b/src/patchsets/gcc/5.3.0/gentoo/12_all_default-warn-trampolines.patch
@@ -0,0 +1,25 @@
+Enable -Wtrampolines by default.
+
+
+--- a/gcc/common.opt
++++ b/gcc/common.opt
+@@ -648,7 +648,7 @@ Common Var(warn_system_headers) Warning
+ Do not suppress warnings from system headers
+
+ Wtrampolines
+-Common Var(warn_trampolines) Warning
++Common Var(warn_trampolines) Init(1) Warning
+ Warn whenever a trampoline is generated
+
+ Wtype-limits
+--- a/gcc/doc/gcc.info
++++ b/gcc/doc/gcc.info
+@@ -4021,6 +4021,8 @@ compiler warns that an unrecognized option is present.
+ and thus requires the stack to be made executable in order for the
+ program to work properly.
+
++ This warning is enabled by default in Gentoo.
++
+ `-Wfloat-equal'
+ Warn if floating-point values are used in equality comparisons.
+
diff --git a/src/patchsets/gcc/5.3.0/gentoo/20_all_msgfmt-libstdc++-link.patch b/src/patchsets/gcc/5.3.0/gentoo/20_all_msgfmt-libstdc++-link.patch
new file mode 100644
index 0000000000..a70ea50a07
--- /dev/null
+++ b/src/patchsets/gcc/5.3.0/gentoo/20_all_msgfmt-libstdc++-link.patch
@@ -0,0 +1,39 @@
+Ensure that msgfmt doesn't encounter problems during gcc bootstrapping.
+
+Solves error messages like the following:
+
+msgfmt: /var/tmp/portage/sys-devel/gcc-4.1.2/work/build/./gcc/libgcc_s.so.1: version `GCC_4.2.0' not found (required by /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/libstdc++.so.6)
+
+The libgcc_s.so used during build doesn't satisfy the needs of the
+libstdc++.so that msgfmt is linked against. On the other hand, msgfmt
+is used as a stand-alone application here, and what library it uses
+behind the scenes is of no concern to the gcc build process.
+Therefore, simply invoking it "as usual", i.e. without any special
+library path, will make it work as expected here.
+
+2011-09-19 Martin von Gagern
+
+References:
+https://bugs.gentoo.org/372377
+https://bugs.gentoo.org/295480
+
+--- gcc-4.1.2.orig/libstdc++-v3/po/Makefile.am
++++ gcc-4.1.2/libstdc++-v3/po/Makefile.am
+@@ -39,6 +39,7 @@ MSGFMT = msgfmt
+ EXTRA_DIST = string_literals.cc POTFILES.in $(PACKAGE).pot $(LOCALE_IN)
+
+ .po.mo:
++ env --unset=LD_LIBRARY_PATH \
+ $(MSGFMT) -o $@ $<
+
+ all-local: all-local-$(USE_NLS)
+--- gcc-4.1.2.orig/libstdc++-v3/po/Makefile.in
++++ gcc-4.1.2/libstdc++-v3/po/Makefile.in
+@@ -419,6 +419,7 @@ uninstall-am: uninstall-info-am
+
+
+ .po.mo:
++ env --unset=LD_LIBRARY_PATH \
+ $(MSGFMT) -o $@ $<
+
+ all-local: all-local-$(USE_NLS)
diff --git a/src/patchsets/gcc/5.3.0/gentoo/25_all_alpha-mieee-default.patch b/src/patchsets/gcc/5.3.0/gentoo/25_all_alpha-mieee-default.patch
new file mode 100644
index 0000000000..f66b393f30
--- /dev/null
+++ b/src/patchsets/gcc/5.3.0/gentoo/25_all_alpha-mieee-default.patch
@@ -0,0 +1,38 @@
+Set the default behavior on alpha to use -mieee since the large majority of
+time we want this (bad/weird things can happen with packages built without
+it).
+
+To satisfy those people who may not want -mieee forced on them all the time,
+we also provide -mno-ieee.
+
+Patch by Mike Frysinger <vapier@gentoo.org>
+
+Note: upstream doesn't want to take this due to long standing behavior, and
+because it'd make behavior across OS's inconsistent:
+ https://gcc.gnu.org/ml/gcc-patches/2003-07/msg02144.html
+
+This makes sense for upstream, but Gentoo is more concerned about packages
+behaving the same across arches under Linux.
+
+--- a/gcc/config/alpha/alpha.h
++++ b/gcc/config/alpha/alpha.h
+@@ -96,6 +96,8 @@ along with GCC; see the file COPYING3. If not see
+ while (0)
+ #endif
+
++#define CPP_SPEC "%{!no-ieee:-mieee}"
++
+ /* Run-time compilation parameters selecting different hardware subsets. */
+
+ /* Which processor to schedule for. The cpu attribute defines a list that
+--- a/gcc/config/alpha/alpha.opt
++++ b/gcc/config/alpha/alpha.opt
+@@ -39,7 +39,7 @@ Target RejectNegative Mask(IEEE_CONFORMANT)
+ Request IEEE-conformant math library routines (OSF/1)
+
+ mieee
+-Target Report RejectNegative Mask(IEEE)
++Target Report Mask(IEEE)
+ Emit IEEE-conformant code, without inexact exceptions
+
+ mieee-with-inexact
diff --git a/src/patchsets/gcc/5.3.0/gentoo/26_all_alpha-asm-mcpu.patch b/src/patchsets/gcc/5.3.0/gentoo/26_all_alpha-asm-mcpu.patch
new file mode 100644
index 0000000000..d487333c93
--- /dev/null
+++ b/src/patchsets/gcc/5.3.0/gentoo/26_all_alpha-asm-mcpu.patch
@@ -0,0 +1,17 @@
+https://bugs.gentoo.org/170146
+http://gcc.gnu.org/ml/gcc-patches/2009-11/msg00403.html
+https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=223888
+
+alpha: turn -mcpu=<cpu> into -m<cpu> for assembler all the time
+
+--- a/gcc/config/alpha/elf.h
++++ b/gcc/config/alpha/elf.h
+@@ -46,7 +46,7 @@ along with GCC; see the file COPYING3. If not see
+ #define CC1_SPEC "%{G*}"
+
+ #undef ASM_SPEC
+-#define ASM_SPEC "%{G*} %{relax:-relax} %{!gstabs*:-no-mdebug}%{gstabs*:-mdebug}"
++#define ASM_SPEC "%{G*} %{relax:-relax} %{!gstabs*:-no-mdebug}%{gstabs*:-mdebug} %{mcpu=*:-m%*}"
+
+ #undef IDENT_ASM_OP
+ #define IDENT_ASM_OP "\t.ident\t"
diff --git a/src/patchsets/gcc/5.3.0/gentoo/29_all_arm_armv4t-default.patch b/src/patchsets/gcc/5.3.0/gentoo/29_all_arm_armv4t-default.patch
new file mode 100644
index 0000000000..4616cf9ab8
--- /dev/null
+++ b/src/patchsets/gcc/5.3.0/gentoo/29_all_arm_armv4t-default.patch
@@ -0,0 +1,16 @@
+gcc defaults to armv5t for all targets even armv4t
+
+http://sourceware.org/ml/crossgcc/2008-05/msg00009.html
+
+
+--- a/gcc/config/arm/linux-eabi.h
++++ b/gcc/config/arm/linux-eabi.h
+@@ -45,7 +45,7 @@
+ The ARM10TDMI core is the default for armv5t, so set
+ SUBTARGET_CPU_DEFAULT to achieve this. */
+ #undef SUBTARGET_CPU_DEFAULT
+-#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm10tdmi
++#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm9tdmi
+
+ /* TARGET_BIG_ENDIAN_DEFAULT is set in
+ config.gcc for big endian configurations. */
diff --git a/src/patchsets/gcc/5.3.0/gentoo/34_all_ia64_note.GNU-stack.patch b/src/patchsets/gcc/5.3.0/gentoo/34_all_ia64_note.GNU-stack.patch
new file mode 100644
index 0000000000..66a787e1b2
--- /dev/null
+++ b/src/patchsets/gcc/5.3.0/gentoo/34_all_ia64_note.GNU-stack.patch
@@ -0,0 +1,92 @@
+http://gcc.gnu.org/PR21098
+
+
+2004-09-20 Jakub Jelinek <jakub@redhat.com>
+
+ * config/rs6000/ppc-asm.h: Add .note.GNU-stack section also
+ on ppc64-linux.
+
+ * config/ia64/lib1funcs.asm: Add .note.GNU-stack section on
+ ia64-linux.
+ * config/ia64/crtbegin.asm: Likewise.
+ * config/ia64/crtend.asm: Likewise.
+ * config/ia64/crti.asm: Likewise.
+ * config/ia64/crtn.asm: Likewise.
+
+2004-05-14 Jakub Jelinek <jakub@redhat.com>
+
+ * config/ia64/linux.h (TARGET_ASM_FILE_END): Define.
+
+
+--- a/gcc/config/ia64/linux.h
++++ b/gcc/config/ia64/linux.h
+@@ -24,6 +24,8 @@ a copy of the GCC Runtime Library Exception along with this program;
+ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ <http://www.gnu.org/licenses/>. */
+
++#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
++
+ /* This is for -profile to use -lc_p instead of -lc. */
+ #undef CC1_SPEC
+ #define CC1_SPEC "%{profile:-p} %{G*}"
+--- a/gcc/config/rs6000/ppc-asm.h
++++ b/gcc/config/rs6000/ppc-asm.h
+@@ -352,7 +352,7 @@ GLUE(.L,name): \
+ #endif
+ #endif
+
+-#if defined __linux__ && !defined __powerpc64__
++#if defined __linux__
+ .section .note.GNU-stack
+ .previous
+ #endif
+--- a/libgcc/config/ia64/crtbegin.S
++++ b/libgcc/config/ia64/crtbegin.S
+@@ -252,3 +252,7 @@ __do_jv_register_classes:
+ .weak __cxa_finalize
+ #endif
+ .weak _Jv_RegisterClasses
++
++#ifdef __linux__
++.section .note.GNU-stack; .previous
++#endif
+--- a/libgcc/config/ia64/crtend.S
++++ b/libgcc/config/ia64/crtend.S
+@@ -119,3 +119,6 @@ __do_global_ctors_aux:
+
+ br.ret.sptk.many rp
+ .endp __do_global_ctors_aux
++#ifdef __linux__
++.section .note.GNU-stack; .previous
++#endif
+--- a/libgcc/config/ia64/crti.S
++++ b/libgcc/config/ia64/crti.S
+@@ -49,5 +49,8 @@ _fini:
+ .save rp, r33
+ mov r33 = b0
+ .body
++#ifdef __linux__
++.section .note.GNU-stack; .previous
++#endif
+
+ # end of crti.S
+--- a/libgcc/config/ia64/crtn.S
++++ b/libgcc/config/ia64/crtn.S
+@@ -39,5 +39,8 @@
+ .restore sp
+ mov r12 = r35
+ br.ret.sptk.many b0
++#ifdef __linux__
++.section .note.GNU-stack; .previous
++#endif
+
+ # end of crtn.S
+--- a/libgcc/config/ia64/lib1funcs.S
++++ b/libgcc/config/ia64/lib1funcs.S
+@@ -793,3 +793,6 @@ __floattitf:
+ .endp __floattitf
+ #endif
+ #endif
++#ifdef __linux__
++.section .note.GNU-stack; .previous
++#endif
diff --git a/src/patchsets/gcc/5.3.0/gentoo/34_all_libjava-classpath-locale-sort.patch b/src/patchsets/gcc/5.3.0/gentoo/34_all_libjava-classpath-locale-sort.patch
new file mode 100644
index 0000000000..0870939d1f
--- /dev/null
+++ b/src/patchsets/gcc/5.3.0/gentoo/34_all_libjava-classpath-locale-sort.patch
@@ -0,0 +1,57 @@
+From 3a52cf750bd9da06cffa7d642f1e74e77bfd8a8c Mon Sep 17 00:00:00 2001
+From: vapier <vapier@138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Mon, 26 Oct 2015 18:32:41 +0000
+Subject: [PATCH] libjava: fix locale handling when sorting JNI methods
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+When building under LANG=cs_CZ.UTF-8, the JNI method check fails:
+
+/bin/bash ../../scripts/check_jni_methods.sh
+Found a problem with the JNI methods declared and implemented.
+(<) missing in implementation, (>) missing in header files
+> Java_gnu_java_awt_peer_gtk_GtkClipboard_advertiseContent
+> Java_gnu_java_awt_peer_gtk_GtkClipboard_initNativeState
+... lots more ...
+
+While the sed commands are run under LC_ALL=C, the two sort commands are
+not, and they end up producing unexpected output (for the test). Once we
+run both under LC_ALL=C, the check passes. While we're here, we can also
+combine latter the `sort|uniq` into `sort -u` to match the earlier code.
+
+URL: https://bugs.gentoo.org/563710
+Reported-by: Miroslav Šulc <fordfrog@gentoo.org>
+
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@229388 138bc75d-0d04-0410-961f-82ee72b054a4
+---
+ libjava/classpath/ChangeLog | 5 +++++
+ libjava/classpath/scripts/check_jni_methods.sh.in | 4 ++--
+ 2 files changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/libjava/classpath/scripts/check_jni_methods.sh.in b/libjava/classpath/scripts/check_jni_methods.sh.in
+index facf34b..fb9d104 100644
+--- a/libjava/classpath/scripts/check_jni_methods.sh.in
++++ b/libjava/classpath/scripts/check_jni_methods.sh.in
+@@ -14,7 +14,7 @@ grep -h '^JNIEXPORT .* Java_' @abs_top_srcdir@/include/*.h | \
+ LC_ALL=C sed -e 's,.*JNICALL \(Java_[a-z_A-Z0-9]*\).*$,\1,' > $TMPFILE
+ grep -h '^JNIEXPORT .* Java_' @abs_top_builddir@/include/*.h | \
+ LC_ALL=C sed -e 's,.*JNICALL \(Java_[a-z_A-Z0-9]*\).*$,\1,' >> $TMPFILE
+-sort -u $TMPFILE > $TMPFILE4
++LC_ALL=C sort -u $TMPFILE > $TMPFILE4
+ mv $TMPFILE4 $TMPFILE
+
+ # Find all methods in the JNI C source files.
+@@ -31,7 +31,7 @@ find @abs_top_srcdir@/native/jni -name \*.cpp | \
+ cut -f4 -d\ | \
+ LC_ALL=C sed -e 's,^\JNIEXPORT .* JNICALL \(Java_[a-z_A-Z0-9]*\).*$,\1,' >> $TMPFILE2
+ mv $TMPFILE2 $TMPFILE3
+-sort $TMPFILE3 | uniq > $TMPFILE2
++LC_ALL=C sort -u $TMPFILE3 > $TMPFILE2
+ rm $TMPFILE3
+
+ # Write temporary ignore file.
+--
+2.5.2
+
diff --git a/src/patchsets/gcc/5.3.0/gentoo/38_all_sh_pr24836_all-archs.patch b/src/patchsets/gcc/5.3.0/gentoo/38_all_sh_pr24836_all-archs.patch
new file mode 100644
index 0000000000..03db560e0a
--- /dev/null
+++ b/src/patchsets/gcc/5.3.0/gentoo/38_all_sh_pr24836_all-archs.patch
@@ -0,0 +1,27 @@
+gcc/configure doesn't handle all possible SH architectures
+
+http://gcc.gnu.org/PR24836
+
+
+--- a/gcc/configure.ac
++++ b/gcc/configure.ac
+@@ -2924,7 +2924,7 @@ foo: .long 25
+ tls_first_minor=14
+ tls_as_opt="-m64 -Aesame --fatal-warnings"
+ ;;
+- sh-*-* | sh[34]-*-*)
++ sh-*-* | sh[34]*-*-*)
+ conftest_s='
+ .section ".tdata","awT",@progbits
+ foo: .long 25
+--- a/gcc/configure
++++ b/gcc/configure
+@@ -22753,7 +22753,7 @@ foo: .long 25
+ tls_first_minor=14
+ tls_as_opt="-m64 -Aesame --fatal-warnings"
+ ;;
+- sh-*-* | sh[34]-*-*)
++ sh-*-* | sh[34]*-*-*)
+ conftest_s='
+ .section ".tdata","awT",@progbits
+ foo: .long 25
diff --git a/src/patchsets/gcc/5.3.0/gentoo/42_all_superh_default-multilib.patch b/src/patchsets/gcc/5.3.0/gentoo/42_all_superh_default-multilib.patch
new file mode 100644
index 0000000000..8b638d9d0a
--- /dev/null
+++ b/src/patchsets/gcc/5.3.0/gentoo/42_all_superh_default-multilib.patch
@@ -0,0 +1,24 @@
+The gcc-3.x toolchains would contain all the targets by default. With gcc-4,
+you have to actually list out the multilibs you want or you will end up with
+just one when using targets like 'sh4-linux-gnu'.
+
+The resulting toolchain can't even build a kernel as the kernel needs to build
+with the nofpu flag to be sure that no fpu ops are generated.
+
+Here we restore the gcc-3.x behavior; the additional overhead of building all
+of these multilibs by default is negligible.
+
+https://bugs.gentoo.org/140205
+https://bugs.gentoo.org/320251
+
+--- a/gcc/config.gcc
++++ b/gcc/config.gcc
+@@ -2455,7 +2455,7 @@ sh-*-symbianelf* | sh[12346l]*-*-symbianelf* | \
+ if test "$sh_multilibs" = "default" ; then
+ case ${target} in
+ sh64-superh-linux* | \
+- sh[1234]*) sh_multilibs=${sh_cpu_target} ;;
++ sh[1234]*) sh_multilibs=$(echo $(sed -n '/^[[:space:]]*case ${sh_multilib} in/,/)/{s:case ${sh_multilib} in::;s: | *:,:g;s:[\\)]::g;p}' ${srcdir}/config.gcc) | sed 's: ::g') ;;
+ sh64* | sh5*) sh_multilibs=m5-32media,m5-32media-nofpu,m5-compact,m5-compact-nofpu,m5-64media,m5-64media-nofpu ;;
+ sh-superh-*) sh_multilibs=m4,m4-single,m4-single-only,m4-nofpu ;;
+ sh*-*-linux*) sh_multilibs=m1,m3e,m4 ;;
diff --git a/src/patchsets/gcc/5.3.0/gentoo/50_all_libiberty-asprintf.patch b/src/patchsets/gcc/5.3.0/gentoo/50_all_libiberty-asprintf.patch
new file mode 100644
index 0000000000..bee0c4c237
--- /dev/null
+++ b/src/patchsets/gcc/5.3.0/gentoo/50_all_libiberty-asprintf.patch
@@ -0,0 +1,18 @@
+2008-07-25 Magnus Granberg <zorry@ume.nu>
+
+ * include/libiberty.h (asprintf): Don't declare if defined as a macro
+
+--- a/include/libiberty.h
++++ b/include/libiberty.h
+@@ -609,8 +609,11 @@ extern int pwait (int, int *, int);
+ /* Like sprintf but provides a pointer to malloc'd storage, which must
+ be freed by the caller. */
+
++/* asprintf may be declared as a macro by glibc with __USE_FORTIFY_LEVEL. */
++#ifndef asprintf
+ extern int asprintf (char **, const char *, ...) ATTRIBUTE_PRINTF_2;
+ #endif
++#endif
+
+ #if !HAVE_DECL_VASPRINTF
+ /* Like vsprintf but provides a pointer to malloc'd storage, which
diff --git a/src/patchsets/gcc/5.3.0/gentoo/51_all_libiberty-pic.patch b/src/patchsets/gcc/5.3.0/gentoo/51_all_libiberty-pic.patch
new file mode 100644
index 0000000000..b6160a7307
--- /dev/null
+++ b/src/patchsets/gcc/5.3.0/gentoo/51_all_libiberty-pic.patch
@@ -0,0 +1,10 @@
+--- a/libiberty/Makefile.in
++++ b/libiberty/Makefile.in
+@@ -246,6 +246,7 @@ $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
+ $(AR) $(AR_FLAGS) $(TARGETLIB) \
+ $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \
+ $(RANLIB) $(TARGETLIB); \
++ cp $(TARGETLIB) ../ ; \
+ cd ..; \
+ else true; fi
+
diff --git a/src/patchsets/gcc/5.3.0/gentoo/52_all_netbsd-Bsymbolic.patch b/src/patchsets/gcc/5.3.0/gentoo/52_all_netbsd-Bsymbolic.patch
new file mode 100644
index 0000000000..c9b654e8fe
--- /dev/null
+++ b/src/patchsets/gcc/5.3.0/gentoo/52_all_netbsd-Bsymbolic.patch
@@ -0,0 +1,13 @@
+https://bugs.gentoo.org/122698
+https://gcc.gnu.org/ml/gcc-patches/2015-05/msg02854.html
+
+--- a/gcc/config/netbsd-elf.h
++++ b/gcc/config/netbsd-elf.h
+@@ -70,6 +70,7 @@ along with GCC; see the file COPYING3. If not see
+ #define NETBSD_LINK_SPEC_ELF \
+ "%{assert*} %{R*} %{rpath*} \
+ %{shared:-shared} \
++ %{symbolic:-Bsymbolic} \
+ %{!shared: \
+ -dc -dp \
+ %{!nostdlib: \
diff --git a/src/patchsets/gcc/5.3.0/gentoo/53_all_libitm-no-fortify-source.patch b/src/patchsets/gcc/5.3.0/gentoo/53_all_libitm-no-fortify-source.patch
new file mode 100644
index 0000000000..5ab15afc37
--- /dev/null
+++ b/src/patchsets/gcc/5.3.0/gentoo/53_all_libitm-no-fortify-source.patch
@@ -0,0 +1,27 @@
+https://bugs.gentoo.org/508852
+https://gcc.gnu.org/PR61164
+
+2014-04-27 Magnus Granberg <zorry@gentoo.org>
+
+ #508852
+ * libitm/configure.tgt: Disable FORTIFY
+
+--- a/libitm/configure.tgt
++++ b/libitm/configure.tgt
+@@ -43,6 +43,16 @@ if test "$gcc_cv_have_tls" = yes ; then
+ esac
+ fi
+
++# FIXME: error: inlining failed in call to always_inline
++# ‘int vfprintf(FILE*, const char*, __va_list_tag*)’
++# : function body can be overwritten at link time
++# Disable Fortify in libitm for now. #508852
++case "${target}" in
++ *-*-linux*)
++ XCFLAGS="${XCFLAGS} -U_FORTIFY_SOURCE"
++ ;;
++esac
++
+ # Map the target cpu to an ARCH sub-directory. At the same time,
+ # work out any special compilation flags as necessary.
+ case "${target_cpu}" in
diff --git a/src/patchsets/gcc/5.3.0/gentoo/67_all_gcc-poison-system-directories.patch b/src/patchsets/gcc/5.3.0/gentoo/67_all_gcc-poison-system-directories.patch
new file mode 100644
index 0000000000..c46e24e78d
--- /dev/null
+++ b/src/patchsets/gcc/5.3.0/gentoo/67_all_gcc-poison-system-directories.patch
@@ -0,0 +1,176 @@
+http://cgit.openembedded.org/openembedded-core/tree/meta/recipes-devtools/gcc/gcc-4.9/0016-gcc-poison-system-directories.patch
+
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 29 Mar 2013 08:59:00 +0400
+Subject: [PATCH 16/35] gcc: poison-system-directories
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Upstream-Status: Inappropriate [distribution: codesourcery]
+---
+ gcc/Makefile.in | 2 +-
+ gcc/common.opt | 4 ++++
+ gcc/config.in | 6 ++++++
+ gcc/configure | 20 ++++++++++++++++++--
+ gcc/configure.ac | 10 ++++++++++
+ gcc/doc/invoke.texi | 9 +++++++++
+ gcc/gcc.c | 2 ++
+ gcc/incpath.c | 19 +++++++++++++++++++
+ 8 files changed, 69 insertions(+), 3 deletions(-)
+
+--- a/gcc/common.opt
++++ b/gcc/common.opt
+@@ -603,6 +603,10 @@ Wpedantic
+ Common Var(pedantic) Init(0) Warning
+ Issue warnings needed for strict compliance to the standard
+
++Wpoison-system-directories
++Common Var(flag_poison_system_directories) Init(1) Warning
++Warn for -I and -L options using system directories if cross compiling
++
+ Wreturn-local-addr
+ Common Var(warn_return_local_addr) Init(1) Warning
+ Warn about returning a pointer/reference to a local or temporary variable.
+--- a/gcc/configure.ac
++++ b/gcc/configure.ac
+@@ -5366,6 +5366,16 @@ AC_ARG_ENABLE(version-specific-runtime-l
+ [specify that runtime libraries should be
+ installed in a compiler-specific directory])])
+
++AC_ARG_ENABLE([poison-system-directories],
++ AS_HELP_STRING([--enable-poison-system-directories],
++ [warn for use of native system header directories]),,
++ [enable_poison_system_directories=no])
++if test "x${enable_poison_system_directories}" = "xyes"; then
++ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
++ [1],
++ [Define to warn for use of native system header directories])
++fi
++
+ # Substitute configuration variables
+ AC_SUBST(subdirs)
+ AC_SUBST(srcdir)
+--- a/gcc/configure
++++ b/gcc/configure
+@@ -928,6 +928,7 @@ with_system_zlib
+ enable_maintainer_mode
+ enable_link_mutex
+ enable_version_specific_runtime_libs
++enable_poison_system_directories
+ enable_plugin
+ enable_host_shared
+ enable_libquadmath_support
+@@ -1648,6 +1649,8 @@ Optional Features:
+ --enable-version-specific-runtime-libs
+ specify that runtime libraries should be installed
+ in a compiler-specific directory
++ --enable-poison-system-directories
++ warn for use of native system header directories
+ --enable-plugin enable plugin support
+ --enable-host-shared build host code as shared libraries
+ --disable-libquadmath-support
+@@ -27702,6 +27705,19 @@ if test "${enable_version_specific_runti
+ fi
+
+
++# Check whether --enable-poison-system-directories was given.
++if test "${enable_poison_system_directories+set}" = set; then :
++ enableval=$enable_poison_system_directories;
++else
++ enable_poison_system_directories=no
++fi
++
++if test "x${enable_poison_system_directories}" = "xyes"; then
++
++$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
++
++fi
++
+ # Substitute configuration variables
+
+
+--- a/gcc/config.in
++++ b/gcc/config.in
+@@ -138,6 +138,12 @@
+ #endif
+
+
++/* Define to warn for use of native system header directories */
++#ifndef USED_FOR_TARGET
++#undef ENABLE_POISON_SYSTEM_DIRECTORIES
++#endif
++
++
+ /* Define if you want all operations on RTL (the basic data structure of the
+ optimizer and back end) to be checked for dynamic type safety at runtime.
+ This is quite expensive. */
+--- a/gcc/gcc.c
++++ b/gcc/gcc.c
+@@ -764,6 +764,8 @@ proper position among the other output f
+ "%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \
+ "%X %{o*} %{e*} %{N} %{n} %{r}\
+ %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}} " VTABLE_VERIFICATION_SPEC " \
++ %{Wno-poison-system-directories:--no-poison-system-directories}\
++ %{Werror=poison-system-directories:--error-poison-system-directories}\
+ %{static:} %{L*} %(mfwrap) %(link_libgcc) " SANITIZER_EARLY_SPEC " %o\
+ " CHKP_SPEC " \
+ %{fopenacc|fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)}\
+--- a/gcc/incpath.c
++++ b/gcc/incpath.c
+@@ -28,6 +28,7 @@
+ #include "intl.h"
+ #include "incpath.h"
+ #include "cppdefault.h"
++#include "diagnostic-core.h"
+
+ /* Microsoft Windows does not natively support inodes.
+ VMS has non-numeric inodes. */
+@@ -382,6 +383,24 @@ merge_include_chains (const char *sysroo
+ }
+ fprintf (stderr, _("End of search list.\n"));
+ }
++
++#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
++ if (flag_poison_system_directories)
++ {
++ struct cpp_dir *p;
++
++ for (p = heads[QUOTE]; p; p = p->next)
++ {
++ if ((!strncmp (p->name, "/usr/include", 12))
++ || (!strncmp (p->name, "/usr/local/include", 18))
++ || (!strncmp (p->name, "/usr/X11R6/include", 18)))
++ warning (OPT_Wpoison_system_directories,
++ "include location \"%s\" is unsafe for "
++ "cross-compilation",
++ p->name);
++ }
++ }
++#endif
+ }
+
+ /* Use given -I paths for #include "..." but not #include <...>, and
+--- a/gcc/doc/gcc.info
++++ b/gcc/doc/gcc.info
+@@ -558,6 +558,7 @@ _Warning Options_
+ -Woverlength-strings -Wpacked -Wpacked-bitfield-compat -Wpadded
+ -Wparentheses -Wpedantic-ms-format -Wno-pedantic-ms-format
+ -Wpointer-arith -Wno-pointer-to-int-cast
++ -Wno-poison-system-directories
+ -Wredundant-decls -Wno-return-local-addr
+ -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar
+ -Wshift-count-negative -Wshift-count-overflow
+@@ -4010,6 +4011,13 @@ compiler warns that an unrecognized option is present.
+ unknown pragmas in system headers--for that, `-Wunknown-pragmas'
+ must also be used.
+
++`-Wno-poison-system-directories'
++ Do not warn for @option{-I} or @option{-L} options using system
++ directories such as @file{/usr/include} when cross compiling. This
++ option is intended for use in chroot environments when such
++ directories contain the correct headers and libraries for the target
++ system rather than the host.
++
+ `-Wtrampolines'
+ Warn about trampolines generated for pointers to nested functions.
+ A trampoline is a small piece of data or code that is created at
diff --git a/src/patchsets/gcc/5.3.0/gentoo/70_all_gcc-5-pr546752.patch b/src/patchsets/gcc/5.3.0/gentoo/70_all_gcc-5-pr546752.patch
new file mode 100644
index 0000000000..6aa41f2620
--- /dev/null
+++ b/src/patchsets/gcc/5.3.0/gentoo/70_all_gcc-5-pr546752.patch
@@ -0,0 +1,459 @@
+https://gcc.gnu.org/PR61929
+https://bugs.gentoo.org/546752
+
+From fc25c6708493bdbf4809f733bc0e68a4ca117ae1 Mon Sep 17 00:00:00 2001
+From: spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Fri, 17 Jul 2015 16:34:21 +0000
+Subject: [PATCH] [graphite] fix pr61929
+
+This fixes bootstrap of GCC with BOOT_CFLAGS="-g -O2 -fgraphite-identity
+-floop-nest-optimize -floop-block -floop-interchange -floop-strip-mine". It
+passes regstrap on amd64-linux. A previous change
+(https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=213816), replaced
+isl_int with isl_val because isl_int would be deprecated. Since isl_val has
+stricter checks, it exposed the bug. In the test case (isl_set_max_val) would
+return infinity which would remain unchecked. We now check if the value
+returned is an integer or not, and bail out if it isn't. The other problem was
+that we were allowing all kinds of data-refs in a scop. Now we discard a scop
+if it has any date-ref other than (ARRAY_REF, MEM_REF, COMPONENT_REF).
+
+ PR middle-end/61929
+ * graphite-dependences.c (add_pdr_constraints): Renamed
+ pdr->extent to pdr->subscript_sizes.
+ * graphite-interchange.c (build_linearized_memory_access): Add
+ back all gcc_assert's that the "isl_int to isl_val conversion"
+ patch has removed. Refactored.
+ (pdr_stride_in_loop): Renamed pdr->extent to pdr->subscript_sizes.
+ * graphite-poly.c (new_poly_dr): Same.
+ (free_poly_dr): Same.
+ * graphite-poly.h (struct poly_dr): Same.
+ * graphite-scop-detection.c (stmt_has_simple_data_refs_p): Ignore
+ all data references other than ARRAY_REF, MEM_REF, and COMPONENT_REF.
+ * graphite-scop-detection.h: Fix space.
+ * graphite-sese-to-poly.c (build_pbb_scattering_polyhedrons): Add
+ back all gcc_assert's removed by a previous patch.
+ (wrap): Remove the_isl_ctx global variable that the same patch has
+ added.
+ (build_loop_iteration_domains): Same.
+ (add_param_constraints): Same.
+ (pdr_add_data_dimensions): Same. Refactored.
+ (build_poly_dr): Renamed extent to subscript_sizes.
+
+testsuite/
+ PR middle-end/61929
+ * gcc.dg/graphite/pr61929.c: New.
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@225942 138bc75d-0d04-0410-961f-82ee72b054a4
+---
+ gcc/ChangeLog | 25 +++++++++++++++
+ gcc/graphite-dependences.c | 4 +--
+ gcc/graphite-interchange.c | 55 +++++++++++++++++----------------
+ gcc/graphite-poly.c | 6 ++--
+ gcc/graphite-poly.h | 2 +-
+ gcc/graphite-scop-detection.c | 22 +++++++++----
+ gcc/graphite-scop-detection.h | 2 +-
+ gcc/graphite-sese-to-poly.c | 54 ++++++++++++++++----------------
+ gcc/testsuite/ChangeLog | 6 ++++
+ gcc/testsuite/gcc.dg/graphite/pr61929.c | 19 ++++++++++++
+ 10 files changed, 128 insertions(+), 67 deletions(-)
+ create mode 100644 gcc/testsuite/gcc.dg/graphite/pr61929.c
+
+diff --git a/gcc/graphite-dependences.c b/gcc/graphite-dependences.c
+index 50fe73e..af18ecb 100644
+--- a/gcc/graphite-dependences.c
++++ b/gcc/graphite-dependences.c
+@@ -88,13 +88,13 @@ constrain_domain (isl_map *map, isl_set *s)
+ return isl_map_intersect_domain (map, s);
+ }
+
+-/* Constrain pdr->accesses with pdr->extent and pbb->domain. */
++/* Constrain pdr->accesses with pdr->subscript_sizes and pbb->domain. */
+
+ static isl_map *
+ add_pdr_constraints (poly_dr_p pdr, poly_bb_p pbb)
+ {
+ isl_map *x = isl_map_intersect_range (isl_map_copy (pdr->accesses),
+- isl_set_copy (pdr->extent));
++ isl_set_copy (pdr->subscript_sizes));
+ x = constrain_domain (x, isl_set_copy (pbb->domain));
+ return x;
+ }
+diff --git a/gcc/graphite-interchange.c b/gcc/graphite-interchange.c
+index aee51a8..03c2c63 100644
+--- a/gcc/graphite-interchange.c
++++ b/gcc/graphite-interchange.c
+@@ -79,37 +79,40 @@ extern "C" {
+ static isl_constraint *
+ build_linearized_memory_access (isl_map *map, poly_dr_p pdr)
+ {
+- isl_constraint *res;
+ isl_local_space *ls = isl_local_space_from_space (isl_map_get_space (map));
+- unsigned offset, nsubs;
+- int i;
+- isl_ctx *ctx;
++ isl_constraint *res = isl_equality_alloc (ls);
++ isl_val *size = isl_val_int_from_ui (isl_map_get_ctx (map), 1);
+
+- isl_val *size, *subsize, *size1;
+-
+- res = isl_equality_alloc (ls);
+- ctx = isl_local_space_get_ctx (ls);
+- size = isl_val_int_from_ui (ctx, 1);
+-
+- nsubs = isl_set_dim (pdr->extent, isl_dim_set);
++ unsigned nsubs = isl_set_dim (pdr->subscript_sizes, isl_dim_set);
+ /* -1 for the already included L dimension. */
+- offset = isl_map_dim (map, isl_dim_out) - 1 - nsubs;
++ unsigned offset = isl_map_dim (map, isl_dim_out) - 1 - nsubs;
+ res = isl_constraint_set_coefficient_si (res, isl_dim_out, offset + nsubs, -1);
+- /* Go through all subscripts from last to first. First dimension
++ /* Go through all subscripts from last to first. The dimension "i=0"
+ is the alias set, ignore it. */
+- for (i = nsubs - 1; i >= 1; i--)
++ for (int i = nsubs - 1; i >= 1; i--)
+ {
+- isl_space *dc;
+- isl_aff *aff;
+-
+- size1 = isl_val_copy (size);
+- res = isl_constraint_set_coefficient_val (res, isl_dim_out, offset + i, size);
+- dc = isl_set_get_space (pdr->extent);
+- aff = isl_aff_zero_on_domain (isl_local_space_from_space (dc));
+- aff = isl_aff_set_coefficient_si (aff, isl_dim_in, i, 1);
+- subsize = isl_set_max_val (pdr->extent, aff);
+- isl_aff_free (aff);
+- size = isl_val_mul (size1, subsize);
++ isl_aff *extract_dim;
++ res = isl_constraint_set_coefficient_val (res, isl_dim_out, offset + i,
++ isl_val_copy (size));
++ isl_space *dc = isl_set_get_space (pdr->subscript_sizes);
++ extract_dim = isl_aff_zero_on_domain (isl_local_space_from_space (dc));
++ extract_dim = isl_aff_set_coefficient_si (extract_dim, isl_dim_in, i, 1);
++ isl_val *max = isl_set_max_val (pdr->subscript_sizes, extract_dim);
++ isl_aff_free (extract_dim);
++
++ /* The result is NULL in case of an error, the optimal value in case there
++ is one, negative infinity or infinity if the problem is unbounded and
++ NaN if the problem is empty. */
++ gcc_assert (max);
++
++ /* When one of the dimensions cannot be computed, we cannot build the size
++ of the array for any outer dimensions. */
++ if (!isl_val_is_int (max))
++ {
++ isl_val_free (max);
++ break;
++ }
++ size = isl_val_mul (size, max);
+ }
+
+ isl_val_free (size);
+@@ -176,7 +179,7 @@ pdr_stride_in_loop (mpz_t stride, graphite_dim_t depth, poly_dr_p pdr)
+
+ /* pdr->accesses: [P1..nb_param,I1..nb_domain]->[a,S1..nb_subscript]
+ ??? [P] not used for PDRs?
+- pdr->extent: [a,S1..nb_subscript]
++ pdr->subscript_sizes: [a,S1..nb_subscript]
+ pbb->domain: [P1..nb_param,I1..nb_domain]
+ pbb->transformed: [P1..nb_param,I1..nb_domain]->[T1..Tnb_sctr]
+ [T] includes local vars (currently unused)
+diff --git a/gcc/graphite-poly.c b/gcc/graphite-poly.c
+index bcd08d8..2eff5a5a 100644
+--- a/gcc/graphite-poly.c
++++ b/gcc/graphite-poly.c
+@@ -270,7 +270,7 @@ apply_poly_transforms (scop_p scop)
+ void
+ new_poly_dr (poly_bb_p pbb, int dr_base_object_set,
+ enum poly_dr_type type, void *cdr, graphite_dim_t nb_subscripts,
+- isl_map *acc, isl_set *extent)
++ isl_map *acc, isl_set *subscript_sizes)
+ {
+ static int id = 0;
+ poly_dr_p pdr = XNEW (struct poly_dr);
+@@ -280,7 +280,7 @@ new_poly_dr (poly_bb_p pbb, int dr_base_object_set,
+ PDR_NB_REFS (pdr) = 1;
+ PDR_PBB (pdr) = pbb;
+ pdr->accesses = acc;
+- pdr->extent = extent;
++ pdr->subscript_sizes = subscript_sizes;
+ PDR_TYPE (pdr) = type;
+ PDR_CDR (pdr) = cdr;
+ PDR_NB_SUBSCRIPTS (pdr) = nb_subscripts;
+@@ -293,7 +293,7 @@ void
+ free_poly_dr (poly_dr_p pdr)
+ {
+ isl_map_free (pdr->accesses);
+- isl_set_free (pdr->extent);
++ isl_set_free (pdr->subscript_sizes);
+ XDELETE (pdr);
+ }
+
+diff --git a/gcc/graphite-poly.h b/gcc/graphite-poly.h
+index 7ffd18e..82e1217 100644
+--- a/gcc/graphite-poly.h
++++ b/gcc/graphite-poly.h
+@@ -177,7 +177,7 @@ struct poly_dr
+
+ In the example, the vector "R C O I L P" is "7 7 3 2 0 1". */
+ isl_map *accesses;
+- isl_set *extent;
++ isl_set *subscript_sizes;
+
+ /* Data reference's base object set number, we must assure 2 pdrs are in the
+ same base object set before dependency checking. */
+diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c
+index 4fb4e02..28de4ab 100644
+--- a/gcc/graphite-scop-detection.c
++++ b/gcc/graphite-scop-detection.c
+@@ -289,7 +289,6 @@ stmt_has_simple_data_refs_p (loop_p outermost_loop ATTRIBUTE_UNUSED,
+ gimple stmt)
+ {
+ data_reference_p dr;
+- unsigned i;
+ int j;
+ bool res = true;
+ vec<data_reference_p> drs = vNULL;
+@@ -302,18 +301,29 @@ stmt_has_simple_data_refs_p (loop_p outermost_loop ATTRIBUTE_UNUSED,
+ stmt, &drs);
+
+ FOR_EACH_VEC_ELT (drs, j, dr)
+- for (i = 0; i < DR_NUM_DIMENSIONS (dr); i++)
+- if (!graphite_can_represent_scev (DR_ACCESS_FN (dr, i)))
++ {
++ int nb_subscripts = DR_NUM_DIMENSIONS (dr);
++ tree ref = DR_REF (dr);
++
++ for (int i = nb_subscripts - 1; i >= 0; i--)
+ {
+- res = false;
+- goto done;
++ if (!graphite_can_represent_scev (DR_ACCESS_FN (dr, i))
++ || (TREE_CODE (ref) != ARRAY_REF
++ && TREE_CODE (ref) != MEM_REF
++ && TREE_CODE (ref) != COMPONENT_REF))
++ {
++ free_data_refs (drs);
++ return false;
++ }
++
++ ref = TREE_OPERAND (ref, 0);
+ }
++ }
+
+ free_data_refs (drs);
+ drs.create (0);
+ }
+
+- done:
+ free_data_refs (drs);
+ return res;
+ }
+diff --git a/gcc/graphite-scop-detection.h b/gcc/graphite-scop-detection.h
+index 8e794c3..4511796 100644
+--- a/gcc/graphite-scop-detection.h
++++ b/gcc/graphite-scop-detection.h
+@@ -23,7 +23,7 @@ along with GCC; see the file COPYING3. If not see
+ #define GCC_GRAPHITE_SCOP_DETECTION_H
+
+ extern void build_scops (vec<scop_p> *);
+-extern void dot_all_scops (vec<scop_p> );
++extern void dot_all_scops (vec<scop_p>);
+ extern void dot_scop (scop_p);
+
+ #endif /* GCC_GRAPHITE_SCOP_DETECTION_H */
+diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
+index aaecab4..1e234fe 100644
+--- a/gcc/graphite-sese-to-poly.c
++++ b/gcc/graphite-sese-to-poly.c
+@@ -497,6 +497,7 @@ build_pbb_scattering_polyhedrons (isl_aff *static_sched,
+ (isl_local_space_from_space (isl_map_get_space (pbb->schedule)));
+
+ val = isl_aff_get_coefficient_val (static_sched, isl_dim_in, i / 2);
++ gcc_assert (val && isl_val_is_int (val));
+
+ val = isl_val_neg (val);
+ c = isl_constraint_set_constant_val (c, val);
+@@ -719,14 +720,12 @@ extract_affine_int (tree e, __isl_take isl_space *space)
+
+ /* Compute pwaff mod 2^width. */
+
+-extern isl_ctx *the_isl_ctx;
+-
+ static isl_pw_aff *
+ wrap (isl_pw_aff *pwaff, unsigned width)
+ {
+ isl_val *mod;
+
+- mod = isl_val_int_from_ui(the_isl_ctx, width);
++ mod = isl_val_int_from_ui (isl_pw_aff_get_ctx (pwaff), width);
+ mod = isl_val_2exp (mod);
+ pwaff = isl_pw_aff_mod_val (pwaff, mod);
+
+@@ -1012,7 +1011,7 @@ build_loop_iteration_domains (scop_p scop, struct loop *loop,
+ (isl_local_space_from_space (isl_space_copy (space)));
+ c = isl_constraint_set_coefficient_si (c, isl_dim_set, pos, -1);
+ tree_int_to_gmp (nb_iters, g);
+- v = isl_val_int_from_gmp (the_isl_ctx, g);
++ v = isl_val_int_from_gmp (scop->ctx, g);
+ c = isl_constraint_set_constant_val (c, v);
+ inner = isl_set_add_constraint (inner, c);
+ }
+@@ -1067,7 +1066,7 @@ build_loop_iteration_domains (scop_p scop, struct loop *loop,
+ c = isl_inequality_alloc
+ (isl_local_space_from_space (isl_space_copy (space)));
+ c = isl_constraint_set_coefficient_si (c, isl_dim_set, pos, -1);
+- v = isl_val_int_from_gmp (the_isl_ctx, g);
++ v = isl_val_int_from_gmp (scop->ctx, g);
+ mpz_clear (g);
+ c = isl_constraint_set_constant_val (c, v);
+ inner = isl_set_add_constraint (inner, c);
+@@ -1335,7 +1334,7 @@ add_param_constraints (scop_p scop, graphite_dim_t p)
+ c = isl_inequality_alloc (isl_local_space_from_space (space));
+ mpz_init (g);
+ tree_int_to_gmp (lb, g);
+- v = isl_val_int_from_gmp (the_isl_ctx, g);
++ v = isl_val_int_from_gmp (scop->ctx, g);
+ v = isl_val_neg (v);
+ mpz_clear (g);
+ c = isl_constraint_set_constant_val (c, v);
+@@ -1355,7 +1354,7 @@ add_param_constraints (scop_p scop, graphite_dim_t p)
+
+ mpz_init (g);
+ tree_int_to_gmp (ub, g);
+- v = isl_val_int_from_gmp (the_isl_ctx, g);
++ v = isl_val_int_from_gmp (scop->ctx, g);
+ mpz_clear (g);
+ c = isl_constraint_set_constant_val (c, v);
+ c = isl_constraint_set_coefficient_si (c, isl_dim_param, p, -1);
+@@ -1491,20 +1490,19 @@ pdr_add_memory_accesses (isl_map *acc, data_reference_p dr, poly_bb_p pbb)
+ domain. */
+
+ static isl_set *
+-pdr_add_data_dimensions (isl_set *extent, scop_p scop, data_reference_p dr)
++pdr_add_data_dimensions (isl_set *subscript_sizes, scop_p scop,
++ data_reference_p dr)
+ {
+ tree ref = DR_REF (dr);
+- int i, nb_subscripts = DR_NUM_DIMENSIONS (dr);
+
+- for (i = nb_subscripts - 1; i >= 0; i--, ref = TREE_OPERAND (ref, 0))
++ int nb_subscripts = DR_NUM_DIMENSIONS (dr);
++ for (int i = nb_subscripts - 1; i >= 0; i--, ref = TREE_OPERAND (ref, 0))
+ {
+- tree low, high;
+-
+ if (TREE_CODE (ref) != ARRAY_REF)
+- break;
++ return subscript_sizes;
+
+- low = array_ref_low_bound (ref);
+- high = array_ref_up_bound (ref);
++ tree low = array_ref_low_bound (ref);
++ tree high = array_ref_up_bound (ref);
+
+ /* XXX The PPL code dealt separately with
+ subscript - low >= 0 and high - subscript >= 0 in case one of
+@@ -1522,10 +1520,10 @@ pdr_add_data_dimensions (isl_set *extent, scop_p scop, data_reference_p dr)
+ isl_aff *aff;
+ isl_set *univ, *lbs, *ubs;
+ isl_pw_aff *index;
+- isl_space *space;
+ isl_set *valid;
+- isl_pw_aff *lb = extract_affine_int (low, isl_set_get_space (extent));
+- isl_pw_aff *ub = extract_affine_int (high, isl_set_get_space (extent));
++ isl_space *space = isl_set_get_space (subscript_sizes);
++ isl_pw_aff *lb = extract_affine_int (low, isl_space_copy (space));
++ isl_pw_aff *ub = extract_affine_int (high, isl_space_copy (space));
+
+ /* high >= 0 */
+ valid = isl_pw_aff_nonneg_set (isl_pw_aff_copy (ub));
+@@ -1533,25 +1531,24 @@ pdr_add_data_dimensions (isl_set *extent, scop_p scop, data_reference_p dr)
+ isl_set_dim (valid, isl_dim_set));
+ scop->context = isl_set_intersect (scop->context, valid);
+
+- space = isl_set_get_space (extent);
+ aff = isl_aff_zero_on_domain (isl_local_space_from_space (space));
+ aff = isl_aff_add_coefficient_si (aff, isl_dim_in, i + 1, 1);
+ univ = isl_set_universe (isl_space_domain (isl_aff_get_space (aff)));
+ index = isl_pw_aff_alloc (univ, aff);
+
+- id = isl_set_get_tuple_id (extent);
++ id = isl_set_get_tuple_id (subscript_sizes);
+ lb = isl_pw_aff_set_tuple_id (lb, isl_dim_in, isl_id_copy (id));
+ ub = isl_pw_aff_set_tuple_id (ub, isl_dim_in, id);
+
+ /* low <= sub_i <= high */
+ lbs = isl_pw_aff_ge_set (isl_pw_aff_copy (index), lb);
+ ubs = isl_pw_aff_le_set (index, ub);
+- extent = isl_set_intersect (extent, lbs);
+- extent = isl_set_intersect (extent, ubs);
++ subscript_sizes = isl_set_intersect (subscript_sizes, lbs);
++ subscript_sizes = isl_set_intersect (subscript_sizes, ubs);
+ }
+ }
+
+- return extent;
++ return subscript_sizes;
+ }
+
+ /* Build data accesses for DR in PBB. */
+@@ -1561,7 +1558,7 @@ build_poly_dr (data_reference_p dr, poly_bb_p pbb)
+ {
+ int dr_base_object_set;
+ isl_map *acc;
+- isl_set *extent;
++ isl_set *subscript_sizes;
+ scop_p scop = PBB_SCOP (pbb);
+
+ {
+@@ -1588,9 +1585,10 @@ build_poly_dr (data_reference_p dr, poly_bb_p pbb)
+ alias_set_num = *(bap->alias_set);
+
+ space = isl_space_set_tuple_id (space, isl_dim_set, id);
+- extent = isl_set_nat_universe (space);
+- extent = isl_set_fix_si (extent, isl_dim_set, 0, alias_set_num);
+- extent = pdr_add_data_dimensions (extent, scop, dr);
++ subscript_sizes = isl_set_nat_universe (space);
++ subscript_sizes = isl_set_fix_si (subscript_sizes, isl_dim_set, 0,
++ alias_set_num);
++ subscript_sizes = pdr_add_data_dimensions (subscript_sizes, scop, dr);
+ }
+
+ gcc_assert (dr->aux);
+@@ -1598,7 +1596,7 @@ build_poly_dr (data_reference_p dr, poly_bb_p pbb)
+
+ new_poly_dr (pbb, dr_base_object_set,
+ DR_IS_READ (dr) ? PDR_READ : PDR_WRITE,
+- dr, DR_NUM_DIMENSIONS (dr), acc, extent);
++ dr, DR_NUM_DIMENSIONS (dr), acc, subscript_sizes);
+ }
+
+ /* Write to FILE the alias graph of data references in DIMACS format. */
+diff --git a/gcc/testsuite/gcc.dg/graphite/pr61929.c b/gcc/testsuite/gcc.dg/graphite/pr61929.c
+new file mode 100644
+index 0000000..9999ebf
+--- /dev/null
++++ b/gcc/testsuite/gcc.dg/graphite/pr61929.c
+@@ -0,0 +1,19 @@
++/* { dg-do compile } */
++/* { dg-options "-O2 -ftree-loop-linear -floop-strip-mine" } */
++
++typedef struct m {
++ char *A;
++ char *B;
++} mystruct;
++mystruct arr[52];
++
++void main () {}
++void generateICE (void)
++{
++ int i;
++ for (i=0; i<52; i++)
++ {
++ arr[i].A = "";
++ arr[i].B = 0;
++ }
++}
+--
+2.4.4
+
diff --git a/src/patchsets/gcc/5.3.0/gentoo/74_all_gcc5_isl-dl.patch b/src/patchsets/gcc/5.3.0/gentoo/74_all_gcc5_isl-dl.patch
new file mode 100644
index 0000000000..899506de9f
--- /dev/null
+++ b/src/patchsets/gcc/5.3.0/gentoo/74_all_gcc5_isl-dl.patch
@@ -0,0 +1,617 @@
+dlopen cloog-isl library rather than link to it directly. This prevents
+cloog upgrades that change the soname from breaking the compiler.
+
+http://pkgs.fedoraproject.org/cgit/gcc.git/tree/gcc5-isl-dl.patch
+
+In FreeBSD dlopen is part of libc so we can't just hardcode -ldl.
+We abuse the existing plugin check logic to pull out that info.
+
+extended by Gentoo to support isl-0.15
+https://bugs.gentoo.org/552278
+
+--- gcc/Makefile.in.jj 2012-12-13 17:09:20.000000000 +0100
++++ gcc/Makefile.in 2012-12-14 11:45:22.585670055 +0100
+@@ -1006,7 +1006,7 @@ BUILD_LIBDEPS= $(BUILD_LIBIBERTY)
+ # and the system's installed libraries.
+ LIBS = @LIBS@ libcommon.a $(CPPLIB) $(LIBINTL) $(LIBICONV) $(LIBBACKTRACE) \
+ $(LIBIBERTY) $(LIBDECNUMBER) $(HOST_LIBS)
+-BACKENDLIBS = $(ISLLIBS) $(GMPLIBS) $(PLUGINLIBS) $(HOST_LIBS) \
++BACKENDLIBS = $(if $(ISLLIBS),@DL_LIB@) $(GMPLIBS) $(PLUGINLIBS) $(HOST_LIBS) \
+ $(ZLIB)
+ # Any system libraries needed just for GNAT.
+ SYSLIBS = @GNAT_LIBEXC@
+@@ -2050,6 +2050,15 @@ $(out_object_file): $(out_file)
+ $(common_out_object_file): $(common_out_file)
+ $(COMPILE) $<
+ $(POSTCOMPILE)
++
++graphite%.o : \
++ ALL_CFLAGS := -O $(filter-out -fkeep-inline-functions, $(ALL_CFLAGS))
++graphite.o : \
++ ALL_CFLAGS := -O $(filter-out -fkeep-inline-functions, $(ALL_CFLAGS))
++graphite%.o : \
++ ALL_CXXFLAGS := -O $(filter-out -fkeep-inline-functions, $(ALL_CXXFLAGS))
++graphite.o : \
++ ALL_CXXFLAGS := -O $(filter-out -fkeep-inline-functions, $(ALL_CXXFLAGS))
+ #
+ # Generate header and source files from the machine description,
+ # and compile them.
+--- gcc/configure
++++ gcc/configure
+@@ -604,6 +604,7 @@ PICFLAG
+ enable_host_shared
+ enable_plugin
+ pluginlibs
++DL_LIB
+ ISLINC
+ ISLLIBS
+ GMPINC
+@@ -28285,6 +28286,7 @@ $as_echo "unable to check" >&6; }
+ fi
+
+ # Check -ldl
++ DL_LIB=
+ saved_LIBS="$LIBS"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5
+ $as_echo_n "checking for library containing dlopen... " >&6; }
+@@ -28344,6 +28346,7 @@ fi
+
+ if test x"$ac_cv_search_dlopen" = x"-ldl"; then
+ pluginlibs="$pluginlibs -ldl"
++ DL_LIB=$ac_cv_search_dlopen
+ fi
+ LIBS="$saved_LIBS"
+
+--- gcc/graphite-poly.h.jj 2012-12-13 11:31:27.000000000 +0100
++++ gcc/graphite-poly.h 2012-12-14 13:41:41.970800726 +0100
+@@ -22,6 +22,493 @@ along with GCC; see the file COPYING3.
+ #ifndef GCC_GRAPHITE_POLY_H
+ #define GCC_GRAPHITE_POLY_H
+
++#include <isl/aff.h>
++#include <isl/constraint.h>
++#include <isl/union_set.h>
++#include <isl/schedule.h>
++#include <isl/ilp.h>
++#include <isl/flow.h>
++#include <isl/options.h>
++#include <isl/ast.h>
++#include <isl/ast_build.h>
++#include <isl/val_gmp.h>
++#include <dlfcn.h>
++#ifdef HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE
++#define DYNSYM_ZERO_DISTANCE DYNSYM (isl_band_member_is_coincident)
++#else
++#define DYNSYM_ZERO_DISTANCE DYNSYM (isl_band_member_is_zero_distance)
++#endif
++#ifdef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS
++#define DYNSYM_FUSE DYNSYM (isl_options_set_schedule_serialize_sccs)
++#else
++#define DYNSYM_FUSE DYNSYM (isl_options_set_schedule_fuse)
++#endif
++#define DYNSYMS \
++ DYNSYM (isl_aff_add_coefficient_si); \
++ DYNSYM (isl_aff_free); \
++ DYNSYM (isl_aff_get_space); \
++ DYNSYM (isl_aff_set_coefficient_si); \
++ DYNSYM (isl_aff_set_constant_si); \
++ DYNSYM (isl_aff_zero_on_domain); \
++ DYNSYM (isl_band_free); \
++ DYNSYM (isl_band_get_children); \
++ DYNSYM (isl_band_get_partial_schedule); \
++ DYNSYM (isl_band_has_children); \
++ DYNSYM (isl_band_list_free); \
++ DYNSYM (isl_band_list_get_band); \
++ DYNSYM (isl_band_list_get_ctx); \
++ DYNSYM (isl_band_list_n_band); \
++ DYNSYM_ZERO_DISTANCE; \
++ DYNSYM (isl_band_n_member); \
++ DYNSYM (isl_basic_map_add_constraint); \
++ DYNSYM (isl_basic_map_project_out); \
++ DYNSYM (isl_basic_map_universe); \
++ DYNSYM (isl_constraint_set_coefficient_si); \
++ DYNSYM (isl_constraint_set_constant_si); \
++ DYNSYM (isl_ctx_alloc); \
++ DYNSYM (isl_ctx_free); \
++ DYNSYM (isl_equality_alloc); \
++ DYNSYM (isl_id_alloc); \
++ DYNSYM (isl_id_copy); \
++ DYNSYM (isl_id_free); \
++ DYNSYM (isl_inequality_alloc); \
++ DYNSYM (isl_local_space_copy); \
++ DYNSYM (isl_local_space_free); \
++ DYNSYM (isl_local_space_from_space); \
++ DYNSYM (isl_local_space_range); \
++ DYNSYM (isl_map_add_constraint); \
++ DYNSYM (isl_map_add_dims); \
++ DYNSYM (isl_map_align_params); \
++ DYNSYM (isl_map_apply_range); \
++ DYNSYM (isl_map_copy); \
++ DYNSYM (isl_map_dim); \
++ DYNSYM (isl_map_dump); \
++ DYNSYM (isl_map_equate); \
++ DYNSYM (isl_map_fix_si); \
++ DYNSYM (isl_map_flat_product); \
++ DYNSYM (isl_map_flat_range_product); \
++ DYNSYM (isl_map_free); \
++ DYNSYM (isl_map_from_basic_map); \
++ DYNSYM (isl_map_from_pw_aff); \
++ DYNSYM (isl_map_from_union_map); \
++ DYNSYM (isl_map_get_ctx); \
++ DYNSYM (isl_map_get_space); \
++ DYNSYM (isl_map_get_tuple_id); \
++ DYNSYM (isl_map_insert_dims); \
++ DYNSYM (isl_map_intersect); \
++ DYNSYM (isl_map_intersect_domain); \
++ DYNSYM (isl_map_intersect_range); \
++ DYNSYM (isl_map_is_empty); \
++ DYNSYM (isl_map_lex_ge); \
++ DYNSYM (isl_map_lex_le); \
++ DYNSYM (isl_map_n_out); \
++ DYNSYM (isl_map_range); \
++ DYNSYM (isl_map_set_tuple_id); \
++ DYNSYM (isl_map_universe); \
++ DYNSYM (isl_options_set_on_error); \
++ DYNSYM_FUSE; \
++ DYNSYM (isl_options_set_schedule_max_constant_term); \
++ DYNSYM (isl_options_set_schedule_maximize_band_depth); \
++ DYNSYM (isl_printer_free); \
++ DYNSYM (isl_printer_print_aff); \
++ DYNSYM (isl_printer_print_constraint); \
++ DYNSYM (isl_printer_print_map); \
++ DYNSYM (isl_printer_print_set); \
++ DYNSYM (isl_printer_to_file); \
++ DYNSYM (isl_pw_aff_add); \
++ DYNSYM (isl_pw_aff_alloc); \
++ DYNSYM (isl_pw_aff_copy); \
++ DYNSYM (isl_pw_aff_eq_set); \
++ DYNSYM (isl_pw_aff_free); \
++ DYNSYM (isl_pw_aff_from_aff); \
++ DYNSYM (isl_pw_aff_get_ctx); \
++ DYNSYM (isl_pw_aff_ge_set); \
++ DYNSYM (isl_pw_aff_gt_set); \
++ DYNSYM (isl_pw_aff_is_cst); \
++ DYNSYM (isl_pw_aff_le_set); \
++ DYNSYM (isl_pw_aff_lt_set); \
++ DYNSYM (isl_pw_aff_mul); \
++ DYNSYM (isl_pw_aff_ne_set); \
++ DYNSYM (isl_pw_aff_nonneg_set); \
++ DYNSYM (isl_pw_aff_set_tuple_id); \
++ DYNSYM (isl_pw_aff_sub); \
++ DYNSYM (isl_pw_aff_zero_set); \
++ DYNSYM (isl_schedule_free); \
++ DYNSYM (isl_schedule_get_band_forest); \
++ DYNSYM (isl_set_add_constraint); \
++ DYNSYM (isl_set_add_dims); \
++ DYNSYM (isl_set_apply); \
++ DYNSYM (isl_set_coalesce); \
++ DYNSYM (isl_set_copy); \
++ DYNSYM (isl_set_dim); \
++ DYNSYM (isl_set_fix_si); \
++ DYNSYM (isl_set_free); \
++ DYNSYM (isl_set_get_space); \
++ DYNSYM (isl_set_get_tuple_id); \
++ DYNSYM (isl_set_intersect); \
++ DYNSYM (isl_set_is_empty); \
++ DYNSYM (isl_set_n_dim); \
++ DYNSYM (isl_set_nat_universe); \
++ DYNSYM (isl_set_project_out); \
++ DYNSYM (isl_set_set_tuple_id); \
++ DYNSYM (isl_set_universe); \
++ DYNSYM (isl_space_add_dims); \
++ DYNSYM (isl_space_alloc); \
++ DYNSYM (isl_space_copy); \
++ DYNSYM (isl_space_dim); \
++ DYNSYM (isl_space_domain); \
++ DYNSYM (isl_space_find_dim_by_id); \
++ DYNSYM (isl_space_free); \
++ DYNSYM (isl_space_from_domain); \
++ DYNSYM (isl_space_get_tuple_id); \
++ DYNSYM (isl_space_params_alloc); \
++ DYNSYM (isl_space_range); \
++ DYNSYM (isl_space_set_alloc); \
++ DYNSYM (isl_space_set_dim_id); \
++ DYNSYM (isl_space_set_tuple_id); \
++ DYNSYM (isl_union_map_add_map); \
++ DYNSYM (isl_union_map_align_params); \
++ DYNSYM (isl_union_map_apply_domain); \
++ DYNSYM (isl_union_map_apply_range); \
++ DYNSYM (isl_union_map_compute_flow); \
++ DYNSYM (isl_union_map_copy); \
++ DYNSYM (isl_union_map_empty); \
++ DYNSYM (isl_union_map_flat_range_product); \
++ DYNSYM (isl_union_map_foreach_map); \
++ DYNSYM (isl_union_map_free); \
++ DYNSYM (isl_union_map_from_map); \
++ DYNSYM (isl_union_map_get_ctx); \
++ DYNSYM (isl_union_map_get_space); \
++ DYNSYM (isl_union_map_gist_domain); \
++ DYNSYM (isl_union_map_gist_range); \
++ DYNSYM (isl_union_map_intersect_domain); \
++ DYNSYM (isl_union_map_is_empty); \
++ DYNSYM (isl_union_map_subtract); \
++ DYNSYM (isl_union_map_union); \
++ DYNSYM (isl_union_set_add_set); \
++ DYNSYM (isl_union_set_compute_schedule); \
++ DYNSYM (isl_union_set_copy); \
++ DYNSYM (isl_union_set_empty); \
++ DYNSYM (isl_union_set_from_set); \
++ DYNSYM (isl_aff_add_constant_val); \
++ DYNSYM (isl_aff_get_coefficient_val); \
++ DYNSYM (isl_aff_get_ctx); \
++ DYNSYM (isl_aff_mod_val); \
++ DYNSYM (isl_ast_build_ast_from_schedule); \
++ DYNSYM (isl_ast_build_free); \
++ DYNSYM (isl_ast_build_from_context); \
++ DYNSYM (isl_ast_build_get_ctx); \
++ DYNSYM (isl_ast_build_get_schedule); \
++ DYNSYM (isl_ast_build_get_schedule_space); \
++ DYNSYM (isl_ast_build_set_before_each_for); \
++ DYNSYM (isl_ast_build_set_options); \
++ DYNSYM (isl_ast_expr_free); \
++ DYNSYM (isl_ast_expr_from_val); \
++ DYNSYM (isl_ast_expr_get_ctx); \
++ DYNSYM (isl_ast_expr_get_id); \
++ DYNSYM (isl_ast_expr_get_op_arg); \
++ DYNSYM (isl_ast_expr_get_op_n_arg); \
++ DYNSYM (isl_ast_expr_get_op_type); \
++ DYNSYM (isl_ast_expr_get_type); \
++ DYNSYM (isl_ast_expr_get_val); \
++ DYNSYM (isl_ast_expr_sub); \
++ DYNSYM (isl_ast_node_block_get_children); \
++ DYNSYM (isl_ast_node_for_get_body); \
++ DYNSYM (isl_ast_node_for_get_cond); \
++ DYNSYM (isl_ast_node_for_get_inc); \
++ DYNSYM (isl_ast_node_for_get_init); \
++ DYNSYM (isl_ast_node_for_get_iterator); \
++ DYNSYM (isl_ast_node_free); \
++ DYNSYM (isl_ast_node_get_annotation); \
++ DYNSYM (isl_ast_node_get_type); \
++ DYNSYM (isl_ast_node_if_get_cond); \
++ DYNSYM (isl_ast_node_if_get_else); \
++ DYNSYM (isl_ast_node_if_get_then); \
++ DYNSYM (isl_ast_node_list_free); \
++ DYNSYM (isl_ast_node_list_get_ast_node); \
++ DYNSYM (isl_ast_node_list_n_ast_node); \
++ DYNSYM (isl_ast_node_user_get_expr); \
++ DYNSYM (isl_constraint_set_coefficient_val); \
++ DYNSYM (isl_constraint_set_constant_val); \
++ DYNSYM (isl_id_get_user); \
++ DYNSYM (isl_local_space_get_ctx); \
++ DYNSYM (isl_map_fix_val); \
++ DYNSYM (isl_options_set_ast_build_atomic_upper_bound); \
++ DYNSYM (isl_printer_print_ast_node); \
++ DYNSYM (isl_printer_print_str); \
++ DYNSYM (isl_printer_set_output_format); \
++ DYNSYM (isl_pw_aff_mod_val); \
++ DYNSYM (isl_schedule_constraints_compute_schedule); \
++ DYNSYM (isl_schedule_constraints_on_domain); \
++ DYNSYM (isl_schedule_constraints_set_coincidence); \
++ DYNSYM (isl_schedule_constraints_set_proximity); \
++ DYNSYM (isl_schedule_constraints_set_validity); \
++ DYNSYM (isl_set_get_dim_id); \
++ DYNSYM (isl_set_max_val); \
++ DYNSYM (isl_set_min_val); \
++ DYNSYM (isl_set_params); \
++ DYNSYM (isl_space_align_params); \
++ DYNSYM (isl_space_map_from_domain_and_range); \
++ DYNSYM (isl_space_set_tuple_name); \
++ DYNSYM (isl_space_wrap); \
++ DYNSYM (isl_union_map_from_domain_and_range); \
++ DYNSYM (isl_union_map_range); \
++ DYNSYM (isl_union_set_union); \
++ DYNSYM (isl_union_set_universe); \
++ DYNSYM (isl_val_2exp); \
++ DYNSYM (isl_val_add_ui); \
++ DYNSYM (isl_val_copy); \
++ DYNSYM (isl_val_free); \
++ DYNSYM (isl_val_get_num_gmp); \
++ DYNSYM (isl_val_int_from_gmp); \
++ DYNSYM (isl_val_int_from_si); \
++ DYNSYM (isl_val_int_from_ui); \
++ DYNSYM (isl_val_is_int); \
++ DYNSYM (isl_val_mul); \
++ DYNSYM (isl_val_neg); \
++ DYNSYM (isl_val_sub);
++
++extern struct isl_pointers_s__
++{
++ bool inited;
++ void *h;
++#define DYNSYM(x) __typeof (x) *p_##x
++ DYNSYMS
++#undef DYNSYM
++} isl_pointers__;
++
++#define isl_aff_add_coefficient_si (*isl_pointers__.p_isl_aff_add_coefficient_si)
++#define isl_aff_free (*isl_pointers__.p_isl_aff_free)
++#define isl_aff_get_space (*isl_pointers__.p_isl_aff_get_space)
++#define isl_aff_set_coefficient_si (*isl_pointers__.p_isl_aff_set_coefficient_si)
++#define isl_aff_set_constant_si (*isl_pointers__.p_isl_aff_set_constant_si)
++#define isl_aff_zero_on_domain (*isl_pointers__.p_isl_aff_zero_on_domain)
++#define isl_band_free (*isl_pointers__.p_isl_band_free)
++#define isl_band_get_children (*isl_pointers__.p_isl_band_get_children)
++#define isl_band_get_partial_schedule (*isl_pointers__.p_isl_band_get_partial_schedule)
++#define isl_band_has_children (*isl_pointers__.p_isl_band_has_children)
++#define isl_band_list_free (*isl_pointers__.p_isl_band_list_free)
++#define isl_band_list_get_band (*isl_pointers__.p_isl_band_list_get_band)
++#define isl_band_list_get_ctx (*isl_pointers__.p_isl_band_list_get_ctx)
++#define isl_band_list_n_band (*isl_pointers__.p_isl_band_list_n_band)
++#ifdef HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE
++#define isl_band_member_is_coincident (*isl_pointers__.p_isl_band_member_is_coincident)
++#else
++#define isl_band_member_is_zero_distance (*isl_pointers__.p_isl_band_member_is_zero_distance)
++#endif
++#define isl_band_n_member (*isl_pointers__.p_isl_band_n_member)
++#define isl_basic_map_add_constraint (*isl_pointers__.p_isl_basic_map_add_constraint)
++#define isl_basic_map_project_out (*isl_pointers__.p_isl_basic_map_project_out)
++#define isl_basic_map_universe (*isl_pointers__.p_isl_basic_map_universe)
++#define isl_constraint_set_coefficient_si (*isl_pointers__.p_isl_constraint_set_coefficient_si)
++#define isl_constraint_set_constant_si (*isl_pointers__.p_isl_constraint_set_constant_si)
++#define isl_ctx_alloc (*isl_pointers__.p_isl_ctx_alloc)
++#define isl_ctx_free (*isl_pointers__.p_isl_ctx_free)
++#define isl_equality_alloc (*isl_pointers__.p_isl_equality_alloc)
++#define isl_id_alloc (*isl_pointers__.p_isl_id_alloc)
++#define isl_id_copy (*isl_pointers__.p_isl_id_copy)
++#define isl_id_free (*isl_pointers__.p_isl_id_free)
++#define isl_inequality_alloc (*isl_pointers__.p_isl_inequality_alloc)
++#define isl_local_space_copy (*isl_pointers__.p_isl_local_space_copy)
++#define isl_local_space_free (*isl_pointers__.p_isl_local_space_free)
++#define isl_local_space_from_space (*isl_pointers__.p_isl_local_space_from_space)
++#define isl_local_space_range (*isl_pointers__.p_isl_local_space_range)
++#define isl_map_add_constraint (*isl_pointers__.p_isl_map_add_constraint)
++#define isl_map_add_dims (*isl_pointers__.p_isl_map_add_dims)
++#define isl_map_align_params (*isl_pointers__.p_isl_map_align_params)
++#define isl_map_apply_range (*isl_pointers__.p_isl_map_apply_range)
++#define isl_map_copy (*isl_pointers__.p_isl_map_copy)
++#define isl_map_dim (*isl_pointers__.p_isl_map_dim)
++#define isl_map_dump (*isl_pointers__.p_isl_map_dump)
++#define isl_map_equate (*isl_pointers__.p_isl_map_equate)
++#define isl_map_fix_si (*isl_pointers__.p_isl_map_fix_si)
++#define isl_map_flat_product (*isl_pointers__.p_isl_map_flat_product)
++#define isl_map_flat_range_product (*isl_pointers__.p_isl_map_flat_range_product)
++#define isl_map_free (*isl_pointers__.p_isl_map_free)
++#define isl_map_from_basic_map (*isl_pointers__.p_isl_map_from_basic_map)
++#define isl_map_from_pw_aff (*isl_pointers__.p_isl_map_from_pw_aff)
++#define isl_map_from_union_map (*isl_pointers__.p_isl_map_from_union_map)
++#define isl_map_get_ctx (*isl_pointers__.p_isl_map_get_ctx)
++#define isl_map_get_space (*isl_pointers__.p_isl_map_get_space)
++#define isl_map_get_tuple_id (*isl_pointers__.p_isl_map_get_tuple_id)
++#define isl_map_insert_dims (*isl_pointers__.p_isl_map_insert_dims)
++#define isl_map_intersect (*isl_pointers__.p_isl_map_intersect)
++#define isl_map_intersect_domain (*isl_pointers__.p_isl_map_intersect_domain)
++#define isl_map_intersect_range (*isl_pointers__.p_isl_map_intersect_range)
++#define isl_map_is_empty (*isl_pointers__.p_isl_map_is_empty)
++#define isl_map_lex_ge (*isl_pointers__.p_isl_map_lex_ge)
++#define isl_map_lex_le (*isl_pointers__.p_isl_map_lex_le)
++#define isl_map_n_out (*isl_pointers__.p_isl_map_n_out)
++#define isl_map_range (*isl_pointers__.p_isl_map_range)
++#define isl_map_set_tuple_id (*isl_pointers__.p_isl_map_set_tuple_id)
++#define isl_map_universe (*isl_pointers__.p_isl_map_universe)
++#define isl_options_set_on_error (*isl_pointers__.p_isl_options_set_on_error)
++#ifdef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS
++#define isl_options_set_schedule_serialize_sccs (*isl_pointers__.p_isl_options_set_schedule_serialize_sccs)
++#else
++#define isl_options_set_schedule_fuse (*isl_pointers__.p_isl_options_set_schedule_fuse)
++#endif
++#define isl_options_set_schedule_max_constant_term (*isl_pointers__.p_isl_options_set_schedule_max_constant_term)
++#define isl_options_set_schedule_maximize_band_depth (*isl_pointers__.p_isl_options_set_schedule_maximize_band_depth)
++#define isl_printer_free (*isl_pointers__.p_isl_printer_free)
++#define isl_printer_print_aff (*isl_pointers__.p_isl_printer_print_aff)
++#define isl_printer_print_constraint (*isl_pointers__.p_isl_printer_print_constraint)
++#define isl_printer_print_map (*isl_pointers__.p_isl_printer_print_map)
++#define isl_printer_print_set (*isl_pointers__.p_isl_printer_print_set)
++#define isl_printer_to_file (*isl_pointers__.p_isl_printer_to_file)
++#define isl_pw_aff_add (*isl_pointers__.p_isl_pw_aff_add)
++#define isl_pw_aff_alloc (*isl_pointers__.p_isl_pw_aff_alloc)
++#define isl_pw_aff_copy (*isl_pointers__.p_isl_pw_aff_copy)
++#define isl_pw_aff_eq_set (*isl_pointers__.p_isl_pw_aff_eq_set)
++#define isl_pw_aff_free (*isl_pointers__.p_isl_pw_aff_free)
++#define isl_pw_aff_from_aff (*isl_pointers__.p_isl_pw_aff_from_aff)
++#define isl_pw_aff_get_ctx (*isl_pointers__.p_isl_pw_aff_get_ctx)
++#define isl_pw_aff_ge_set (*isl_pointers__.p_isl_pw_aff_ge_set)
++#define isl_pw_aff_gt_set (*isl_pointers__.p_isl_pw_aff_gt_set)
++#define isl_pw_aff_is_cst (*isl_pointers__.p_isl_pw_aff_is_cst)
++#define isl_pw_aff_le_set (*isl_pointers__.p_isl_pw_aff_le_set)
++#define isl_pw_aff_lt_set (*isl_pointers__.p_isl_pw_aff_lt_set)
++#define isl_pw_aff_mul (*isl_pointers__.p_isl_pw_aff_mul)
++#define isl_pw_aff_ne_set (*isl_pointers__.p_isl_pw_aff_ne_set)
++#define isl_pw_aff_nonneg_set (*isl_pointers__.p_isl_pw_aff_nonneg_set)
++#define isl_pw_aff_set_tuple_id (*isl_pointers__.p_isl_pw_aff_set_tuple_id)
++#define isl_pw_aff_sub (*isl_pointers__.p_isl_pw_aff_sub)
++#define isl_pw_aff_zero_set (*isl_pointers__.p_isl_pw_aff_zero_set)
++#define isl_schedule_free (*isl_pointers__.p_isl_schedule_free)
++#define isl_schedule_get_band_forest (*isl_pointers__.p_isl_schedule_get_band_forest)
++#define isl_set_add_constraint (*isl_pointers__.p_isl_set_add_constraint)
++#define isl_set_add_dims (*isl_pointers__.p_isl_set_add_dims)
++#define isl_set_apply (*isl_pointers__.p_isl_set_apply)
++#define isl_set_coalesce (*isl_pointers__.p_isl_set_coalesce)
++#define isl_set_copy (*isl_pointers__.p_isl_set_copy)
++#define isl_set_dim (*isl_pointers__.p_isl_set_dim)
++#define isl_set_fix_si (*isl_pointers__.p_isl_set_fix_si)
++#define isl_set_free (*isl_pointers__.p_isl_set_free)
++#define isl_set_get_space (*isl_pointers__.p_isl_set_get_space)
++#define isl_set_get_tuple_id (*isl_pointers__.p_isl_set_get_tuple_id)
++#define isl_set_intersect (*isl_pointers__.p_isl_set_intersect)
++#define isl_set_is_empty (*isl_pointers__.p_isl_set_is_empty)
++#define isl_set_n_dim (*isl_pointers__.p_isl_set_n_dim)
++#define isl_set_nat_universe (*isl_pointers__.p_isl_set_nat_universe)
++#define isl_set_project_out (*isl_pointers__.p_isl_set_project_out)
++#define isl_set_set_tuple_id (*isl_pointers__.p_isl_set_set_tuple_id)
++#define isl_set_universe (*isl_pointers__.p_isl_set_universe)
++#define isl_space_add_dims (*isl_pointers__.p_isl_space_add_dims)
++#define isl_space_alloc (*isl_pointers__.p_isl_space_alloc)
++#define isl_space_copy (*isl_pointers__.p_isl_space_copy)
++#define isl_space_dim (*isl_pointers__.p_isl_space_dim)
++#define isl_space_domain (*isl_pointers__.p_isl_space_domain)
++#define isl_space_find_dim_by_id (*isl_pointers__.p_isl_space_find_dim_by_id)
++#define isl_space_free (*isl_pointers__.p_isl_space_free)
++#define isl_space_from_domain (*isl_pointers__.p_isl_space_from_domain)
++#define isl_space_get_tuple_id (*isl_pointers__.p_isl_space_get_tuple_id)
++#define isl_space_params_alloc (*isl_pointers__.p_isl_space_params_alloc)
++#define isl_space_range (*isl_pointers__.p_isl_space_range)
++#define isl_space_set_alloc (*isl_pointers__.p_isl_space_set_alloc)
++#define isl_space_set_dim_id (*isl_pointers__.p_isl_space_set_dim_id)
++#define isl_space_set_tuple_id (*isl_pointers__.p_isl_space_set_tuple_id)
++#define isl_union_map_add_map (*isl_pointers__.p_isl_union_map_add_map)
++#define isl_union_map_align_params (*isl_pointers__.p_isl_union_map_align_params)
++#define isl_union_map_apply_domain (*isl_pointers__.p_isl_union_map_apply_domain)
++#define isl_union_map_apply_range (*isl_pointers__.p_isl_union_map_apply_range)
++#define isl_union_map_compute_flow (*isl_pointers__.p_isl_union_map_compute_flow)
++#define isl_union_map_copy (*isl_pointers__.p_isl_union_map_copy)
++#define isl_union_map_empty (*isl_pointers__.p_isl_union_map_empty)
++#define isl_union_map_flat_range_product (*isl_pointers__.p_isl_union_map_flat_range_product)
++#define isl_union_map_foreach_map (*isl_pointers__.p_isl_union_map_foreach_map)
++#define isl_union_map_free (*isl_pointers__.p_isl_union_map_free)
++#define isl_union_map_from_map (*isl_pointers__.p_isl_union_map_from_map)
++#define isl_union_map_get_ctx (*isl_pointers__.p_isl_union_map_get_ctx)
++#define isl_union_map_get_space (*isl_pointers__.p_isl_union_map_get_space)
++#define isl_union_map_gist_domain (*isl_pointers__.p_isl_union_map_gist_domain)
++#define isl_union_map_gist_range (*isl_pointers__.p_isl_union_map_gist_range)
++#define isl_union_map_intersect_domain (*isl_pointers__.p_isl_union_map_intersect_domain)
++#define isl_union_map_is_empty (*isl_pointers__.p_isl_union_map_is_empty)
++#define isl_union_map_subtract (*isl_pointers__.p_isl_union_map_subtract)
++#define isl_union_map_union (*isl_pointers__.p_isl_union_map_union)
++#define isl_union_set_add_set (*isl_pointers__.p_isl_union_set_add_set)
++#define isl_union_set_compute_schedule (*isl_pointers__.p_isl_union_set_compute_schedule)
++#define isl_union_set_copy (*isl_pointers__.p_isl_union_set_copy)
++#define isl_union_set_empty (*isl_pointers__.p_isl_union_set_empty)
++#define isl_union_set_from_set (*isl_pointers__.p_isl_union_set_from_set)
++#define isl_aff_add_constant_val (*isl_pointers__.p_isl_aff_add_constant_val)
++#define isl_aff_get_coefficient_val (*isl_pointers__.p_isl_aff_get_coefficient_val)
++#define isl_aff_get_ctx (*isl_pointers__.p_isl_aff_get_ctx)
++#define isl_aff_mod_val (*isl_pointers__.p_isl_aff_mod_val)
++#define isl_ast_build_ast_from_schedule (*isl_pointers__.p_isl_ast_build_ast_from_schedule)
++#define isl_ast_build_free (*isl_pointers__.p_isl_ast_build_free)
++#define isl_ast_build_from_context (*isl_pointers__.p_isl_ast_build_from_context)
++#define isl_ast_build_get_ctx (*isl_pointers__.p_isl_ast_build_get_ctx)
++#define isl_ast_build_get_schedule (*isl_pointers__.p_isl_ast_build_get_schedule)
++#define isl_ast_build_get_schedule_space (*isl_pointers__.p_isl_ast_build_get_schedule_space)
++#define isl_ast_build_set_before_each_for (*isl_pointers__.p_isl_ast_build_set_before_each_for)
++#define isl_ast_build_set_options (*isl_pointers__.p_isl_ast_build_set_options)
++#define isl_ast_expr_free (*isl_pointers__.p_isl_ast_expr_free)
++#define isl_ast_expr_from_val (*isl_pointers__.p_isl_ast_expr_from_val)
++#define isl_ast_expr_get_ctx (*isl_pointers__.p_isl_ast_expr_get_ctx)
++#define isl_ast_expr_get_id (*isl_pointers__.p_isl_ast_expr_get_id)
++#define isl_ast_expr_get_op_arg (*isl_pointers__.p_isl_ast_expr_get_op_arg)
++#define isl_ast_expr_get_op_n_arg (*isl_pointers__.p_isl_ast_expr_get_op_n_arg)
++#define isl_ast_expr_get_op_type (*isl_pointers__.p_isl_ast_expr_get_op_type)
++#define isl_ast_expr_get_type (*isl_pointers__.p_isl_ast_expr_get_type)
++#define isl_ast_expr_get_val (*isl_pointers__.p_isl_ast_expr_get_val)
++#define isl_ast_expr_sub (*isl_pointers__.p_isl_ast_expr_sub)
++#define isl_ast_node_block_get_children (*isl_pointers__.p_isl_ast_node_block_get_children)
++#define isl_ast_node_for_get_body (*isl_pointers__.p_isl_ast_node_for_get_body)
++#define isl_ast_node_for_get_cond (*isl_pointers__.p_isl_ast_node_for_get_cond)
++#define isl_ast_node_for_get_inc (*isl_pointers__.p_isl_ast_node_for_get_inc)
++#define isl_ast_node_for_get_init (*isl_pointers__.p_isl_ast_node_for_get_init)
++#define isl_ast_node_for_get_iterator (*isl_pointers__.p_isl_ast_node_for_get_iterator)
++#define isl_ast_node_free (*isl_pointers__.p_isl_ast_node_free)
++#define isl_ast_node_get_annotation (*isl_pointers__.p_isl_ast_node_get_annotation)
++#define isl_ast_node_get_type (*isl_pointers__.p_isl_ast_node_get_type)
++#define isl_ast_node_if_get_cond (*isl_pointers__.p_isl_ast_node_if_get_cond)
++#define isl_ast_node_if_get_else (*isl_pointers__.p_isl_ast_node_if_get_else)
++#define isl_ast_node_if_get_then (*isl_pointers__.p_isl_ast_node_if_get_then)
++#define isl_ast_node_list_free (*isl_pointers__.p_isl_ast_node_list_free)
++#define isl_ast_node_list_get_ast_node (*isl_pointers__.p_isl_ast_node_list_get_ast_node)
++#define isl_ast_node_list_n_ast_node (*isl_pointers__.p_isl_ast_node_list_n_ast_node)
++#define isl_ast_node_user_get_expr (*isl_pointers__.p_isl_ast_node_user_get_expr)
++#define isl_constraint_set_coefficient_val (*isl_pointers__.p_isl_constraint_set_coefficient_val)
++#define isl_constraint_set_constant_val (*isl_pointers__.p_isl_constraint_set_constant_val)
++#define isl_id_get_user (*isl_pointers__.p_isl_id_get_user)
++#define isl_local_space_get_ctx (*isl_pointers__.p_isl_local_space_get_ctx)
++#define isl_map_fix_val (*isl_pointers__.p_isl_map_fix_val)
++#define isl_options_set_ast_build_atomic_upper_bound (*isl_pointers__.p_isl_options_set_ast_build_atomic_upper_bound)
++#define isl_printer_print_ast_node (*isl_pointers__.p_isl_printer_print_ast_node)
++#define isl_printer_print_str (*isl_pointers__.p_isl_printer_print_str)
++#define isl_printer_set_output_format (*isl_pointers__.p_isl_printer_set_output_format)
++#define isl_pw_aff_mod_val (*isl_pointers__.p_isl_pw_aff_mod_val)
++#define isl_schedule_constraints_compute_schedule (*isl_pointers__.p_isl_schedule_constraints_compute_schedule)
++#define isl_schedule_constraints_on_domain (*isl_pointers__.p_isl_schedule_constraints_on_domain)
++#define isl_schedule_constraints_set_coincidence (*isl_pointers__.p_isl_schedule_constraints_set_coincidence)
++#define isl_schedule_constraints_set_proximity (*isl_pointers__.p_isl_schedule_constraints_set_proximity)
++#define isl_schedule_constraints_set_validity (*isl_pointers__.p_isl_schedule_constraints_set_validity)
++#define isl_set_get_dim_id (*isl_pointers__.p_isl_set_get_dim_id)
++#define isl_set_max_val (*isl_pointers__.p_isl_set_max_val)
++#define isl_set_min_val (*isl_pointers__.p_isl_set_min_val)
++#define isl_set_params (*isl_pointers__.p_isl_set_params)
++#define isl_space_align_params (*isl_pointers__.p_isl_space_align_params)
++#define isl_space_map_from_domain_and_range (*isl_pointers__.p_isl_space_map_from_domain_and_range)
++#define isl_space_set_tuple_name (*isl_pointers__.p_isl_space_set_tuple_name)
++#define isl_space_wrap (*isl_pointers__.p_isl_space_wrap)
++#define isl_union_map_from_domain_and_range (*isl_pointers__.p_isl_union_map_from_domain_and_range)
++#define isl_union_map_range (*isl_pointers__.p_isl_union_map_range)
++#define isl_union_set_union (*isl_pointers__.p_isl_union_set_union)
++#define isl_union_set_universe (*isl_pointers__.p_isl_union_set_universe)
++#define isl_val_2exp (*isl_pointers__.p_isl_val_2exp)
++#define isl_val_add_ui (*isl_pointers__.p_isl_val_add_ui)
++#define isl_val_copy (*isl_pointers__.p_isl_val_copy)
++#define isl_val_free (*isl_pointers__.p_isl_val_free)
++#define isl_val_get_num_gmp (*isl_pointers__.p_isl_val_get_num_gmp)
++#define isl_val_int_from_gmp (*isl_pointers__.p_isl_val_int_from_gmp)
++#define isl_val_int_from_si (*isl_pointers__.p_isl_val_int_from_si)
++#define isl_val_int_from_ui (*isl_pointers__.p_isl_val_int_from_ui)
++#define isl_val_is_int (*isl_pointers__.p_isl_val_is_int)
++#define isl_val_mul (*isl_pointers__.p_isl_val_mul)
++#define isl_val_neg (*isl_pointers__.p_isl_val_neg)
++#define isl_val_sub (*isl_pointers__.p_isl_val_sub)
++
+ typedef struct poly_dr *poly_dr_p;
+
+ typedef struct poly_bb *poly_bb_p;
+--- gcc/graphite.c.jj 2012-12-13 11:31:00.000000000 +0100
++++ gcc/graphite.c 2012-12-14 13:40:44.155136961 +0100
+@@ -90,6 +90,38 @@ along with GCC; see the file COPYING3.
+ #include "graphite-isl-ast-to-gimple.h"
+ #include "graphite-sese-to-poly.h"
+
++__typeof (isl_pointers__) isl_pointers__;
++
++static bool
++init_isl_pointers (void)
++{
++ void *h;
++
++ if (isl_pointers__.inited)
++ return isl_pointers__.h != NULL;
++#ifdef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS
++ h = dlopen ("libisl.so.15", RTLD_LAZY);
++#else
++ h = dlopen ("libisl.so.13", RTLD_LAZY);
++#endif
++ isl_pointers__.h = h;
++ if (h == NULL)
++ return false;
++#define DYNSYM(x) \
++ do \
++ { \
++ union { __typeof (isl_pointers__.p_##x) p; void *q; } u; \
++ u.q = dlsym (h, #x); \
++ if (u.q == NULL) \
++ return false; \
++ isl_pointers__.p_##x = u.p; \
++ } \
++ while (0)
++ DYNSYMS
++#undef DYNSYM
++ return true;
++}
++
+ /* Print global statistics to FILE. */
+
+ static void
+@@ -285,6 +313,15 @@ graphite_transform_loops (void)
+ if (parallelized_function_p (cfun->decl))
+ return;
+
++ if (number_of_loops (cfun) <= 1)
++ return;
++
++ if (!init_isl_pointers ())
++ {
++ sorry ("Graphite loop optimizations cannot be used");
++ return;
++ }
++
+ ctx = isl_ctx_alloc ();
+ isl_options_set_on_error (ctx, ISL_ON_ERROR_ABORT);
+ if (!graphite_initialize (ctx))
diff --git a/src/patchsets/gcc/5.3.0/gentoo/77_all_gcc-5-pr65958.patch b/src/patchsets/gcc/5.3.0/gentoo/77_all_gcc-5-pr65958.patch
new file mode 100644
index 0000000000..61d9c27dd4
--- /dev/null
+++ b/src/patchsets/gcc/5.3.0/gentoo/77_all_gcc-5-pr65958.patch
@@ -0,0 +1,215 @@
+https://bugs.gentoo.org/518598
+https://gcc.gnu.org/PR65958
+
+fix alloca behavior with vla's for all arches
+
+From 6ad0a0bc2db129994d44470b070e91d9584f0132 Mon Sep 17 00:00:00 2001
+From: ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Fri, 4 Dec 2015 11:57:15 +0000
+Subject: [PATCH]
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@231260 138bc75d-0d04-0410-961f-82ee72b054a4
+---
+ gcc/ChangeLog | 15 +++++++++++++++
+ gcc/doc/extend.texi | 4 +---
+ gcc/doc/generic.texi | 14 +++++++++-----
+ gcc/gimplify.c | 38 ++++++++++++++++++++++++++++----------
+ gcc/testsuite/ChangeLog | 4 ++++
+ gcc/testsuite/gcc.dg/vla-24.c | 31 +++++++++++++++++++++++++++++++
+ 6 files changed, 88 insertions(+), 18 deletions(-)
+ create mode 100644 gcc/testsuite/gcc.dg/vla-24.c
+
+2015-12-04 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR middle-end/65958
+ * gimplify.c (struct gimplify_ctx): Turn boolean fields into 1-bit
+ fields, add keep_stack and reorder them.
+ (gimplify_bind_expr): Save gimplify_ctxp->keep_stack on entry then
+ set it to false. Do not insert a stack save/restore pair if it has
+ been set to true by the gimplification of the statements.
+ Restore it to the saved value on exit if it is still false.
+ (gimplify_vla_decl): Do not set gimplify_ctxp->save_stack here.
+ (gimplify_call_expr) <BUILT_IN_ALLOCA[_WITH_ALIGN]>: New case. Set
+ either save_stack or keep_stack depending on CALL_ALLOCA_FOR_VAR_P.
+ * doc/extend.texi (Variable Length): Document new behavior.
+ * doc/generic.texi (Blocks): Document new handling of VLAs.
+
+diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
+index 63fce0f..6a5e2b8 100644
+--- a/gcc/doc/extend.texi
++++ b/gcc/doc/extend.texi
+@@ -1658,9 +1658,7 @@ variable-length arrays are more elegant.
+ There are other differences between these two methods. Space allocated
+ with @code{alloca} exists until the containing @emph{function} returns.
+ The space for a variable-length array is deallocated as soon as the array
+-name's scope ends. (If you use both variable-length arrays and
+-@code{alloca} in the same function, deallocation of a variable-length array
+-also deallocates anything more recently allocated with @code{alloca}.)
++name's scope ends, unless you also use @code{alloca} in this scope.
+
+ You can also use variable-length arrays as arguments to functions:
+
+diff --git a/gcc/doc/generic.texi b/gcc/doc/generic.texi
+index bbafad9..f6b4397 100644
+--- a/gcc/doc/generic.texi
++++ b/gcc/doc/generic.texi
+@@ -1950,11 +1950,15 @@ this initialization replaces the @code{DECL_STMT}. These variables
+ will never require cleanups. The scope of these variables is just the
+ body
+
+-Variable-length arrays (VLAs) complicate this process, as their
+-size often refers to variables initialized earlier in the block.
+-To handle this, we currently split the block at that point, and
+-move the VLA into a new, inner @code{BIND_EXPR}. This strategy
+-may change in the future.
++Variable-length arrays (VLAs) complicate this process, as their size
++often refers to variables initialized earlier in the block and their
++initialization involves an explicit stack allocation. To handle this,
++we add an indirection and replace them with a pointer to stack space
++allocated by means of @code{alloca}. In most cases, we also arrange
++for this space to be reclaimed when the enclosing @code{BIND_EXPR} is
++exited, the exception to this being when there is an explicit call to
++@code{alloca} in the source code, in which case the stack is left
++depressed on exit of the @code{BIND_EXPR}.
+
+ A C++ program will usually contain more @code{BIND_EXPR}s than
+ there are syntactic blocks in the source code, since several C++
+diff --git a/gcc/gimplify.c b/gcc/gimplify.c
+index 7146a01..80c6bf2 100644
+--- a/gcc/gimplify.c
++++ b/gcc/gimplify.c
+@@ -155,10 +155,11 @@ struct gimplify_ctx
+ hash_table<gimplify_hasher> *temp_htab;
+
+ int conditions;
+- bool save_stack;
+- bool into_ssa;
+- bool allow_rhs_cond_expr;
+- bool in_cleanup_point_expr;
++ unsigned into_ssa : 1;
++ unsigned allow_rhs_cond_expr : 1;
++ unsigned in_cleanup_point_expr : 1;
++ unsigned keep_stack : 1;
++ unsigned save_stack : 1;
+ };
+
+ struct gimplify_omp_ctx
+@@ -1080,6 +1081,7 @@ static enum gimplify_status
+ gimplify_bind_expr (tree *expr_p, gimple_seq *pre_p)
+ {
+ tree bind_expr = *expr_p;
++ bool old_keep_stack = gimplify_ctxp->keep_stack;
+ bool old_save_stack = gimplify_ctxp->save_stack;
+ tree t;
+ gbind *bind_stmt;
+@@ -1129,9 +1131,10 @@ gimplify_bind_expr (tree *expr_p, gimple_seq *pre_p)
+ }
+
+ bind_stmt = gimple_build_bind (BIND_EXPR_VARS (bind_expr), NULL,
+- BIND_EXPR_BLOCK (bind_expr));
++ BIND_EXPR_BLOCK (bind_expr));
+ gimple_push_bind_expr (bind_stmt);
+
++ gimplify_ctxp->keep_stack = false;
+ gimplify_ctxp->save_stack = false;
+
+ /* Gimplify the body into the GIMPLE_BIND tuple's body. */
+@@ -1154,7 +1157,10 @@ gimplify_bind_expr (tree *expr_p, gimple_seq *pre_p)
+
+ cleanup = NULL;
+ stack_save = NULL;
+- if (gimplify_ctxp->save_stack)
++
++ /* If the code both contains VLAs and calls alloca, then we cannot reclaim
++ the stack space allocated to the VLAs. */
++ if (gimplify_ctxp->save_stack && !gimplify_ctxp->keep_stack)
+ {
+ gcall *stack_restore;
+
+@@ -1236,7 +1242,11 @@ gimplify_bind_expr (tree *expr_p, gimple_seq *pre_p)
+ gimple_bind_set_body (bind_stmt, new_body);
+ }
+
++ /* keep_stack propagates all the way up to the outermost BIND_EXPR. */
++ if (!gimplify_ctxp->keep_stack)
++ gimplify_ctxp->keep_stack = old_keep_stack;
+ gimplify_ctxp->save_stack = old_save_stack;
++
+ gimple_pop_bind_expr ();
+
+ gimplify_seq_add_stmt (pre_p, bind_stmt);
+@@ -1393,10 +1403,6 @@ gimplify_vla_decl (tree decl, gimple_seq *seq_p)
+ t = build2 (MODIFY_EXPR, TREE_TYPE (addr), addr, t);
+
+ gimplify_and_add (t, seq_p);
+-
+- /* Indicate that we need to restore the stack level when the
+- enclosing BIND_EXPR is exited. */
+- gimplify_ctxp->save_stack = true;
+ }
+
+ /* A helper function to be called via walk_tree. Mark all labels under *TP
+@@ -2377,6 +2383,18 @@ gimplify_call_expr (tree *expr_p, gimple_seq *pre_p, bool want_value)
+ && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL)
+ switch (DECL_FUNCTION_CODE (fndecl))
+ {
++ case BUILT_IN_ALLOCA:
++ case BUILT_IN_ALLOCA_WITH_ALIGN:
++ /* If the call has been built for a variable-sized object, then we
++ want to restore the stack level when the enclosing BIND_EXPR is
++ exited to reclaim the allocated space; otherwise, we precisely
++ need to do the opposite and preserve the latest stack level. */
++ if (CALL_ALLOCA_FOR_VAR_P (*expr_p))
++ gimplify_ctxp->save_stack = true;
++ else
++ gimplify_ctxp->keep_stack = true;
++ break;
++
+ case BUILT_IN_VA_START:
+ {
+ builtin_va_start_p = TRUE;
+
+2015-12-04 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc.dg/vla-24.c: New test.
+
+diff --git a/gcc/testsuite/gcc.dg/vla-24.c b/gcc/testsuite/gcc.dg/vla-24.c
+new file mode 100644
+index 0000000..5bd5fed
+--- /dev/null
++++ b/gcc/testsuite/gcc.dg/vla-24.c
+@@ -0,0 +1,31 @@
++/* PR middle-end/65958 */
++
++/* { dg-do run } */
++/* { dg-options "-std=gnu99" } */
++
++extern void abort (void);
++
++int foo (int n)
++{
++ char *p, *q;
++
++ if (1)
++ {
++ char i[n];
++ p = __builtin_alloca (8);
++ p[0] = 1;
++ }
++
++ q = __builtin_alloca (64);
++ __builtin_memset (q, 0, 64);
++
++ return !p[0];
++}
++
++int main (void)
++{
++ if (foo (48) != 0)
++ abort ();
++
++ return 0;
++}
+--
+2.6.2
+
diff --git a/src/patchsets/gcc/5.3.0/gentoo/85_all_gcc5-aarch64-pr65689.patch b/src/patchsets/gcc/5.3.0/gentoo/85_all_gcc5-aarch64-pr65689.patch
new file mode 100644
index 0000000000..d4358ea698
--- /dev/null
+++ b/src/patchsets/gcc/5.3.0/gentoo/85_all_gcc5-aarch64-pr65689.patch
@@ -0,0 +1,233 @@
+https://gcc.gnu.org/PR65689
+
+2015-04-17 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/65689
+ * genpreds.c (struct constraint_data): Add maybe_allows_reg and
+ maybe_allows_mem bitfields.
+ (maybe_allows_none_start, maybe_allows_none_end,
+ maybe_allows_reg_start, maybe_allows_reg_end, maybe_allows_mem_start,
+ maybe_allows_mem_end): New variables.
+ (compute_maybe_allows): New function.
+ (add_constraint): Use it to initialize maybe_allows_reg and
+ maybe_allows_mem fields.
+ (choose_enum_order): Sort the non-is_register/is_const_int/is_memory/
+ is_address constraints such that those that allow neither mem nor
+ reg come first, then those that only allow reg but not mem, then
+ those that only allow mem but not reg, then the rest.
+ (write_allows_reg_mem_function): New function.
+ (write_tm_preds_h): Call it.
+ * stmt.c (parse_output_constraint, parse_input_constraint): Use
+ the generated insn_extra_constraint_allows_reg_mem function
+ instead of always setting *allows_reg = true; *allows_mem = true;
+ for unknown extra constraints.
+
+ * gcc.target/aarch64/c-output-template-4.c: New test.
+
+--- gcc/genpreds.c.jj 2015-04-08 18:23:50.643556230 +0200
++++ gcc/genpreds.c 2015-04-17 17:44:23.097650110 +0200
+@@ -640,12 +640,14 @@ struct constraint_data
+ const char *regclass; /* for register constraints */
+ rtx exp; /* for other constraints */
+ unsigned int lineno; /* line of definition */
+- unsigned int is_register : 1;
+- unsigned int is_const_int : 1;
+- unsigned int is_const_dbl : 1;
+- unsigned int is_extra : 1;
+- unsigned int is_memory : 1;
+- unsigned int is_address : 1;
++ unsigned int is_register : 1;
++ unsigned int is_const_int : 1;
++ unsigned int is_const_dbl : 1;
++ unsigned int is_extra : 1;
++ unsigned int is_memory : 1;
++ unsigned int is_address : 1;
++ unsigned int maybe_allows_reg : 1;
++ unsigned int maybe_allows_mem : 1;
+ };
+
+ /* Overview of all constraints beginning with a given letter. */
+@@ -691,6 +693,9 @@ static unsigned int satisfied_start;
+ static unsigned int const_int_start, const_int_end;
+ static unsigned int memory_start, memory_end;
+ static unsigned int address_start, address_end;
++static unsigned int maybe_allows_none_start, maybe_allows_none_end;
++static unsigned int maybe_allows_reg_start, maybe_allows_reg_end;
++static unsigned int maybe_allows_mem_start, maybe_allows_mem_end;
+
+ /* Convert NAME, which contains angle brackets and/or underscores, to
+ a string that can be used as part of a C identifier. The string
+@@ -711,6 +716,34 @@ mangle (const char *name)
+ return XOBFINISH (rtl_obstack, const char *);
+ }
+
++/* Return a bitmask, bit 1 if EXP maybe allows a REG/SUBREG, 2 if EXP
++ maybe allows a MEM. Bits should be clear only when we are sure it
++ will not allow a REG/SUBREG or a MEM. */
++static int
++compute_maybe_allows (rtx exp)
++{
++ switch (GET_CODE (exp))
++ {
++ case IF_THEN_ELSE:
++ /* Conservative answer is like IOR, of the THEN and ELSE branches. */
++ return compute_maybe_allows (XEXP (exp, 1))
++ | compute_maybe_allows (XEXP (exp, 2));
++ case AND:
++ return compute_maybe_allows (XEXP (exp, 0))
++ & compute_maybe_allows (XEXP (exp, 1));
++ case IOR:
++ return compute_maybe_allows (XEXP (exp, 0))
++ | compute_maybe_allows (XEXP (exp, 1));
++ case MATCH_CODE:
++ if (*XSTR (exp, 1) == '\0')
++ return (strstr (XSTR (exp, 0), "reg") != NULL ? 1 : 0)
++ | (strstr (XSTR (exp, 0), "mem") != NULL ? 2 : 0);
++ /* FALLTHRU */
++ default:
++ return 3;
++ }
++}
++
+ /* Add one constraint, of any sort, to the tables. NAME is its name;
+ REGCLASS is the register class, if any; EXP is the expression to
+ test, if any; IS_MEMORY and IS_ADDRESS indicate memory and address
+@@ -866,6 +899,11 @@ add_constraint (const char *name, const
+ c->is_extra = !(regclass || is_const_int || is_const_dbl);
+ c->is_memory = is_memory;
+ c->is_address = is_address;
++ int maybe_allows = 3;
++ if (exp)
++ maybe_allows = compute_maybe_allows (exp);
++ c->maybe_allows_reg = (maybe_allows & 1) != 0;
++ c->maybe_allows_mem = (maybe_allows & 2) != 0;
+
+ c->next_this_letter = *slot;
+ *slot = c;
+@@ -940,8 +978,30 @@ choose_enum_order (void)
+ enum_order[next++] = c;
+ address_end = next;
+
++ maybe_allows_none_start = next;
++ FOR_ALL_CONSTRAINTS (c)
++ if (!c->is_register && !c->is_const_int && !c->is_memory && !c->is_address
++ && !c->maybe_allows_reg && !c->maybe_allows_mem)
++ enum_order[next++] = c;
++ maybe_allows_none_end = next;
++
++ maybe_allows_reg_start = next;
++ FOR_ALL_CONSTRAINTS (c)
++ if (!c->is_register && !c->is_const_int && !c->is_memory && !c->is_address
++ && c->maybe_allows_reg && !c->maybe_allows_mem)
++ enum_order[next++] = c;
++ maybe_allows_reg_end = next;
++
++ maybe_allows_mem_start = next;
++ FOR_ALL_CONSTRAINTS (c)
++ if (!c->is_register && !c->is_const_int && !c->is_memory && !c->is_address
++ && !c->maybe_allows_reg && c->maybe_allows_mem)
++ enum_order[next++] = c;
++ maybe_allows_mem_end = next;
++
+ FOR_ALL_CONSTRAINTS (c)
+- if (!c->is_register && !c->is_const_int && !c->is_memory && !c->is_address)
++ if (!c->is_register && !c->is_const_int && !c->is_memory && !c->is_address
++ && c->maybe_allows_reg && c->maybe_allows_mem)
+ enum_order[next++] = c;
+ gcc_assert (next == num_constraints);
+ }
+@@ -1229,6 +1289,41 @@ write_range_function (const char *name,
+ "}\n\n", name);
+ }
+
++/* Write a definition for insn_extra_constraint_allows_reg_mem function. */
++static void
++write_allows_reg_mem_function (void)
++{
++ printf ("static inline void\n"
++ "insn_extra_constraint_allows_reg_mem (enum constraint_num c,\n"
++ "\t\t\t\t bool *allows_reg, bool *allows_mem)\n"
++ "{\n");
++ if (maybe_allows_none_start != maybe_allows_none_end)
++ printf (" if (c >= CONSTRAINT_%s && c <= CONSTRAINT_%s)\n"
++ " return;\n",
++ enum_order[maybe_allows_none_start]->c_name,
++ enum_order[maybe_allows_none_end - 1]->c_name);
++ if (maybe_allows_reg_start != maybe_allows_reg_end)
++ printf (" if (c >= CONSTRAINT_%s && c <= CONSTRAINT_%s)\n"
++ " {\n"
++ " *allows_reg = true;\n"
++ " return;\n"
++ " }\n",
++ enum_order[maybe_allows_reg_start]->c_name,
++ enum_order[maybe_allows_reg_end - 1]->c_name);
++ if (maybe_allows_mem_start != maybe_allows_mem_end)
++ printf (" if (c >= CONSTRAINT_%s && c <= CONSTRAINT_%s)\n"
++ " {\n"
++ " *allows_mem = true;\n"
++ " return;\n"
++ " }\n",
++ enum_order[maybe_allows_mem_start]->c_name,
++ enum_order[maybe_allows_mem_end - 1]->c_name);
++ printf (" (void) c;\n"
++ " *allows_reg = true;\n"
++ " *allows_mem = true;\n"
++ "}\n\n");
++}
++
+ /* VEC is a list of key/value pairs, with the keys being lower bounds
+ of a range. Output a decision tree that handles the keys covered by
+ [VEC[START], VEC[END]), returning FALLBACK for keys lower then VEC[START]'s.
+@@ -1326,6 +1421,7 @@ write_tm_preds_h (void)
+ memory_start, memory_end);
+ write_range_function ("insn_extra_address_constraint",
+ address_start, address_end);
++ write_allows_reg_mem_function ();
+
+ if (constraint_max_namelen > 1)
+ {
+--- gcc/stmt.c.jj 2015-04-08 18:23:50.660555956 +0200
++++ gcc/stmt.c 2015-04-17 17:36:50.623044548 +0200
+@@ -342,13 +342,7 @@ parse_output_constraint (const char **co
+ else if (insn_extra_memory_constraint (cn))
+ *allows_mem = true;
+ else
+- {
+- /* Otherwise we can't assume anything about the nature of
+- the constraint except that it isn't purely registers.
+- Treat it like "g" and hope for the best. */
+- *allows_reg = true;
+- *allows_mem = true;
+- }
++ insn_extra_constraint_allows_reg_mem (cn, allows_reg, allows_mem);
+ break;
+ }
+
+@@ -465,13 +459,7 @@ parse_input_constraint (const char **con
+ else if (insn_extra_memory_constraint (cn))
+ *allows_mem = true;
+ else
+- {
+- /* Otherwise we can't assume anything about the nature of
+- the constraint except that it isn't purely registers.
+- Treat it like "g" and hope for the best. */
+- *allows_reg = true;
+- *allows_mem = true;
+- }
++ insn_extra_constraint_allows_reg_mem (cn, allows_reg, allows_mem);
+ break;
+ }
+
+--- gcc/testsuite/gcc.target/aarch64/c-output-template-4.c.jj 2015-04-17 17:48:27.588654584 +0200
++++ gcc/testsuite/gcc.target/aarch64/c-output-template-4.c 2015-04-17 17:48:22.149743468 +0200
+@@ -0,0 +1,10 @@
++/* { dg-do compile } */
++/* { dg-options "-O0" } */
++
++void
++test (void)
++{
++ __asm__ ("@ %c0" : : "S" (&test + 4));
++}
++
++/* { dg-final { scan-assembler "@ test\\+4" } } */
diff --git a/src/patchsets/gcc/5.3.0/gentoo/90_all_pr55930-dependency-tracking.patch b/src/patchsets/gcc/5.3.0/gentoo/90_all_pr55930-dependency-tracking.patch
new file mode 100644
index 0000000000..a8743e08c4
--- /dev/null
+++ b/src/patchsets/gcc/5.3.0/gentoo/90_all_pr55930-dependency-tracking.patch
@@ -0,0 +1,18 @@
+libatomic build failure if configured with --disable-dependency-tracking
+load_n.c:115:1: fatal error: opening dependency file .deps/load_1_.lo.Ppo: No such file or directory
+
+https://bugs.gentoo.org/463463
+http://gcc.gnu.org/PR55930
+
+--- a/libatomic/Makefile.in
++++ b/libatomic/Makefile.in
+@@ -298,7 +298,8 @@ PAT_N = $(word 2,$(PAT_SPLIT))
+ PAT_S = $(word 3,$(PAT_SPLIT))
+ IFUNC_DEF = -DIFUNC_ALT=$(PAT_S)
+ IFUNC_OPT = $(word $(PAT_S),$(IFUNC_OPTIONS))
+-M_DEPS = -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo
++@AMDEP_TRUE@M_DEPS = -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo
++@AMDEP_FALSE@M_DEPS =
+ M_SIZE = -DN=$(PAT_N)
+ M_IFUNC = $(if $(PAT_S),$(IFUNC_DEF) $(IFUNC_OPT))
+ M_FILE = $(PAT_BASE)_n.c
diff --git a/src/patchsets/gcc/5.3.0/gentoo/README.history b/src/patchsets/gcc/5.3.0/gentoo/README.history
new file mode 100644
index 0000000000..10231a6cf1
--- /dev/null
+++ b/src/patchsets/gcc/5.3.0/gentoo/README.history
@@ -0,0 +1,24 @@
+1.0 05 Dec 2015
+ + 05_all_gcc-spec-env.patch
+ + 09_all_default-ssp.patch
+ + 10_all_default-fortify-source.patch
+ + 11_all_default-warn-format-security.patch
+ + 12_all_default-warn-trampolines.patch
+ + 20_all_msgfmt-libstdc++-link.patch
+ + 25_all_alpha-mieee-default.patch
+ + 26_all_alpha-asm-mcpu.patch
+ + 29_all_arm_armv4t-default.patch
+ + 34_all_ia64_note.GNU-stack.patch
+ + 34_all_libjava-classpath-locale-sort.patch
+ + 38_all_sh_pr24836_all-archs.patch
+ + 42_all_superh_default-multilib.patch
+ + 50_all_libiberty-asprintf.patch
+ + 51_all_libiberty-pic.patch
+ + 52_all_netbsd-Bsymbolic.patch
+ + 53_all_libitm-no-fortify-source.patch
+ + 67_all_gcc-poison-system-directories.patch
+ + 70_all_gcc-5-pr546752.patch
+ + 74_all_gcc5_isl-dl.patch
+ + 77_all_gcc-5-pr65958.patch
+ + 85_all_gcc5-aarch64-pr65689.patch
+ + 90_all_pr55930-dependency-tracking.patch
diff --git a/src/patchsets/gcc/5.3.0/pie/01_all_gcc53_configure.patch b/src/patchsets/gcc/5.3.0/pie/01_all_gcc53_configure.patch
new file mode 100644
index 0000000000..a32a69d823
--- /dev/null
+++ b/src/patchsets/gcc/5.3.0/pie/01_all_gcc53_configure.patch
@@ -0,0 +1,156 @@
+2013-12-30 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/configure.ac Add --enable-esp and define ENABLE_ESP.
+ Check if we support crtbeginP and define ENABLE_CRTBEGINP.
+ * gcc/configure Regenerated
+
+
+--- a/gcc/configure.ac
++++ b/gcc/configure.ac
+@@ -5130,6 +5130,55 @@ if test x"${LINKER_HASH_STYLE}" != x; th
+ [The linker hash style])
+ fi
+
++# --------------
++# Esp checks
++# --------------
++
++# Check whether --enable-esp was given and target have the support.
++AC_ARG_ENABLE([esp],
++[AS_HELP_STRING([--enable-esp],
++ [Enable Stack protector and Position independent executable as
++ default if we have suppot for it when compiling
++ and link with -z now as default.
++ Linux targets supported i*86, x86_64, x32,
++ powerpc, powerpc64, ia64, arm and mips.])],
++ enable_esp=$enableval,
++ enable_esp=no)
++if test "$enable_esp" = yes; then
++ AC_MSG_CHECKING([if $target support esp])
++ case "$target" in
++ i?86*-*-linux* | x86_64-*-linux* | powerpc*-*-linux* | mips-*-linux* | arm*-*-linux* | ia64-*-linux*)
++ AC_DEFINE([ENABLE_ESP], [1],
++ [Define if your target support esp and you have enable it.])
++ ;;
++ *)
++ enable_esp=no
++ ;;
++ esac
++AC_MSG_RESULT($enable_esp)
++fi
++AC_SUBST([enable_esp])
++
++enable_crtbeginP=no
++if test "$enable_esp" = yes; then
++ AC_MSG_CHECKING([checking for crtbeginP.o support])
++ if test "$enable_esp" = yes; then
++ case "$target" in
++ ia64*-*-linux*)
++ ;;
++ *-*-linux*)
++ if test "x$gcc_cv_ld_pie" = xyes -a "x$lt_cv_prog_compiler_static_works" = xyes; then
++ enable_crtbeginP=yes
++ AC_DEFINE([ENABLE_CRTBEGINP], [1],
++ [Define if your compiler will support crtbeginP.])
++ fi
++ ;;
++ esac
++ fi
++ AC_MSG_RESULT($enable_crtbeginP)
++fi
++AC_SUBST([enable_crtbeginP])
++
+ # Configure the subdirectories
+ # AC_CONFIG_SUBDIRS($subdirs)
+
+--- a/gcc/configure
++++ b/gcc/configure
+@@ -600,6 +600,8 @@ ac_includes_default="\
+
+ ac_subst_vars='LTLIBOBJS
+ LIBOBJS
++enable_crtbeginP
++enable_esp
+ PICFLAG
+ enable_host_shared
+ enable_plugin
+@@ -938,6 +940,7 @@ enable_host_shared
+ enable_libquadmath_support
+ with_linker_hash_style
+ with_diagnostics_color
++enable_esp
+ '
+ ac_precious_vars='build_alias
+ host_alias
+@@ -1674,6 +1677,11 @@ Optional Features:
+ --enable-host-shared build host code as shared libraries
+ --disable-libquadmath-support
+ disable libquadmath support for Fortran
++ --enable-esp Enable Stack protector and Position independent
++ executable as default if we have suppot for it when
++ compiling and link with -z now as default. Linux
++ targets supported i*86, x86_64, x32, powerpc,
++ powerpc64, ia64, arm and mips.
+
+ Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+@@ -28657,6 +28665,59 @@ cat > gcc-driver-name.h <<EOF
+ #define GCC_DRIVER_NAME "${target_noncanonical}-gcc-${gcc_BASEVER}${exeext}"
+ EOF
+
++# --------------
++# Esp checks
++# --------------
++
++# Check whether --enable-esp was given and target have the support.
++# Check whether --enable-esp was given.
++if test "${enable_esp+set}" = set; then :
++ enableval=$enable_esp; enable_esp=$enableval
++else
++ enable_esp=no
++fi
++
++if test "$enable_esp" = yes; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $target support esp" >&5
++$as_echo_n "checking if $target support esp... " >&6; }
++ case "$target" in
++ i?86*-*-linux* | x86_64-*-linux* | powerpc*-*-linux* | mips-*-linux* | arm*-*-linux* | ia64-*-linux*)
++
++$as_echo "#define ENABLE_ESP 1" >>confdefs.h
++
++ ;;
++ *)
++ enable_esp=no
++ ;;
++ esac
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_esp" >&5
++$as_echo "$enable_esp" >&6; }
++fi
++
++
++enable_crtbeginP=no
++if test "$enable_esp" = yes; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking checking for crtbeginP.o support" >&5
++$as_echo_n "checking checking for crtbeginP.o support... " >&6; }
++ if test "$enable_esp" = yes; then
++ case "$target" in
++ ia64*-*-linux*)
++ ;;
++ *-*-linux*)
++ if test "x$gcc_cv_ld_pie" = xyes -a "x$lt_cv_prog_compiler_static_works" = xyes; then
++ enable_crtbeginP=yes
++
++$as_echo "#define ENABLE_CRTBEGINP 1" >>confdefs.h
++
++ fi
++ ;;
++ esac
++ fi
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_crtbeginP" >&5
++$as_echo "$enable_crtbeginP" >&6; }
++fi
++
++
+ # Configure the subdirectories
+ # AC_CONFIG_SUBDIRS($subdirs)
+
diff --git a/src/patchsets/gcc/5.3.0/pie/02_all_gcc48_config.in.patch b/src/patchsets/gcc/5.3.0/pie/02_all_gcc48_config.in.patch
new file mode 100644
index 0000000000..3b4747b6bd
--- /dev/null
+++ b/src/patchsets/gcc/5.3.0/pie/02_all_gcc48_config.in.patch
@@ -0,0 +1,32 @@
+2013-02-13 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/config.in Add ENABLE_CRTBEGINP, ENABLE_ESP
+
+--- gcc/config.in 2009-04-21 11:08:08.000000000 +0200
++++ gcc/config.in 2009-05-12 00:10:08.000000000 +0200
+@@ -46,6 +46,12 @@
+ #endif
+
+
++/* Define to 1 to enable crtbeginP.o. */
++#ifndef USED_FOR_TARGET
++#undef ENABLE_CRTBEGINP
++#endif
++
++
+ /* Define to 1 to specify that we are using the BID decimal floating point
+ format instead of DPD */
+ #ifndef USED_FOR_TARGET
+@@ -65,6 +65,12 @@
+ #endif
+
+
++/* Define to 1 to enable esp. */
++#ifndef USED_FOR_TARGET
++#undef ENABLE_ESP
++#endif
++
++
+ /* Define to 1 to enable fixed-point arithmetic extension to C. */
+ #ifndef USED_FOR_TARGET
+ #undef ENABLE_FIXED_POINT
diff --git a/src/patchsets/gcc/5.3.0/pie/03_all_gcc51_Makefile.in.patch b/src/patchsets/gcc/5.3.0/pie/03_all_gcc51_Makefile.in.patch
new file mode 100644
index 0000000000..6aac099c58
--- /dev/null
+++ b/src/patchsets/gcc/5.3.0/pie/03_all_gcc51_Makefile.in.patch
@@ -0,0 +1,106 @@
+2015-04-23 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/Makefile.in Add -fno-PIE. to ALL_CFLAGS and
+ ALL_CXXFLAGS if enable_esp yes.
+ Echo enable_esp and enable_crtbeginP to tmp-libgcc.mvars.
+ * libgcc/Makefile.in Add crtbeginP.o to EXTRA_PARTS if enable_crtbeginP yes
+ We add new file crtbeginP.o if enable_crtbeginP yes
+ Add -fno-PIE. to CRTSTUFF_CFLAGS.
+ Disable -fstack-check
+
+--- a/gcc/Makefile.in 2011-11-09 02:20:14.000000000 +0100
++++ b/gcc/Makefile.in 2011-12-24 22:28:08.864804375 +0100
+@@ -247,6 +247,14 @@ LINKER_FLAGS = $(CFLAGS)
+ endif
+ endif
+
++# We don't want to compile the compiler with -fPIE, it make PCH fail.
++enable_esp = @enable_esp@
++ifeq ($(enable_esp),yes)
++ESP_NOPIE_CFLAGS = -fno-PIE
++else
++ESP_NOPIE_CFLAGS=
++endif
++
+ # -------------------------------------------
+ # Programs which operate on the build machine
+ # -------------------------------------------
+@@ -974,12 +982,13 @@ INTERNAL_CFLAGS = -DIN_GCC @CROSS@
+
+ # This is the variable actually used when we compile. If you change this,
+ # you probably want to update BUILD_CFLAGS in configure.ac
+-ALL_CFLAGS = $(T_CFLAGS) $(CFLAGS-$@) \
++ALL_CFLAGS = $(ESP_NOPIE_CFLAGS) $(T_CFLAGS) $(CFLAGS-$@) \
+ $(CFLAGS) $(INTERNAL_CFLAGS) $(COVERAGE_FLAGS) $(WARN_CFLAGS) @DEFS@
+
+ # The C++ version.
+-ALL_CXXFLAGS = $(T_CFLAGS) $(CFLAGS-$@) $(CXXFLAGS) $(INTERNAL_CFLAGS) \
+- $(COVERAGE_FLAGS) $(NOEXCEPTION_FLAGS) $(WARN_CXXFLAGS) @DEFS@
++ALL_CXXFLAGS = $(ESP_NOPIE_CFLAGS) $(T_CFLAGS) $(CFLAGS-$@) $(CXXFLAGS) \
++ $(INTERNAL_CFLAGS) $(COVERAGE_FLAGS) $(NOEXCEPTION_FLAGS) \
++ $(WARN_CXXFLAGS) @DEFS@
+
+ # Likewise. Put INCLUDES at the beginning: this way, if some autoconf macro
+ # puts -I options in CPPFLAGS, our include files in the srcdir will always
+@@ -1814,6 +1823,8 @@ libgcc.mvars: config.status Makefile spe
+ echo GCC_CFLAGS = '$(GCC_CFLAGS)' >> tmp-libgcc.mvars
+ echo INHIBIT_LIBC_CFLAGS = '$(INHIBIT_LIBC_CFLAGS)' >> tmp-libgcc.mvars
+ echo TARGET_SYSTEM_ROOT = '$(TARGET_SYSTEM_ROOT)' >> tmp-libgcc.mvars
++ echo enable_esp = '$(enable_esp)' >> tmp-libgcc.mvars
++ echo enable_crtbeginP = '@enable_crtbeginP@' >> tmp-libgcc.mvars
+
+ mv tmp-libgcc.mvars libgcc.mvars
+
+--- a/libgcc/Makefile.in 2011-11-22 04:01:02.000000000 +0100
++++ b/libgcc/Makefile.in 2011-12-25 15:18:22.449610631 +0100
+@@ -219,6 +219,17 @@ else
+ DECNUMINC =
+ endif
+
++ifeq ($(enable_esp),yes)
++ESP_NOPIE_CFLAGS = -fno-PIE
++else
++ESP_NOPIE_CFLAGS=
++endif
++
++# We add crtbeginP.o to the EXTRA_PARTS list if enable_crtbeginP = yes
++ifeq ($(enable_crtbeginP),yes)
++EXTRA_PARTS += crtbeginP.o
++endif
++
+ # Options to use when compiling libgcc2.a.
+ #
+ LIBGCC2_DEBUG_CFLAGS = -g
+@@ -225,7 +225,7 @@ endif
+ LIBGCC2_DEBUG_CFLAGS = -g
+ LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) $(HOST_LIBGCC2_CFLAGS) \
+ $(LIBGCC2_DEBUG_CFLAGS) -DIN_LIBGCC2 \
+- -fbuilding-libgcc -fno-stack-protector \
++ -fbuilding-libgcc -fno-stack-protector -fstack-check=no \
+ $(INHIBIT_LIBC_CFLAGS)
+
+ # Additional options to use when compiling libgcc2.a.
+@@ -279,7 +290,7 @@ INTERNAL_CFLAGS = $(CFLAGS) $(LIBGCC2_CF
+ -finhibit-size-directive -fno-inline -fno-exceptions \
+ -fno-zero-initialized-in-bss -fno-toplevel-reorder -fno-tree-vectorize \
+ -fbuilding-libgcc -fno-stack-protector $(FORCE_EXPLICIT_EH_REGISTRY) \
+- $(INHIBIT_LIBC_CFLAGS)
++ $(ESP_NOPIE_CFLAGS) -fstack-check=no $(INHIBIT_LIBC_CFLAGS)
+
+ # Extra flags to use when compiling crt{begin,end}.o.
+ CRTSTUFF_T_CFLAGS =
+@@ -966,6 +977,13 @@ crtendS$(objext): $(srcdir)/crtstuff.c
+ # This is a version of crtbegin for -static links.
+ crtbeginT$(objext): $(srcdir)/crtstuff.c
+ $(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< -DCRT_BEGIN -DCRTSTUFFT_O
++
++# This is a version of crtbegin for -static -fPIE links.
++ifeq ($(enable_crtbeginP),yes)
++crtbeginP$(objext): $(srcdir)/crtstuff.c
++ $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) \
++ -c $< -DCRT_BEGIN -DCRTSTUFFT_O -DCRTSTUFFS_O
++endif
+
+ ifeq ($(enable_vtable_verify),yes)
+ # These are used in vtable verification; see comments in source files for
+ \ No newline at end of file
diff --git a/src/patchsets/gcc/5.3.0/pie/05_all_gcc48_gcc.c.patch b/src/patchsets/gcc/5.3.0/pie/05_all_gcc48_gcc.c.patch
new file mode 100644
index 0000000000..ddfcafd6e9
--- /dev/null
+++ b/src/patchsets/gcc/5.3.0/pie/05_all_gcc48_gcc.c.patch
@@ -0,0 +1,25 @@
+2014-01-01 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/gcc.c include esp.h
+ static const char *cc1_spec We set that in esp.h if ENABLE_ESP.
+
+--- gcc/gcc.c 2010-01-21 10:29:30.000000000 -0500
++++ gcc/gcc.c 2010-01-29 23:29:16.000000000 -0500
+@@ -44,6 +44,7 @@
+ #include "opts.h"
+ #include "params.h"
+ #include "vec.h"
++#include "config/esp.h" /* for --enable-esp support */
+ #include "filenames.h"
+
+ /* By default there is no special suffix for target executables. */
+@@ -822,7 +823,9 @@
+
+ static const char *asm_debug;
+ static const char *cpp_spec = CPP_SPEC;
++#ifndef ENABLE_ESP
+ static const char *cc1_spec = CC1_SPEC CC1_SSP_DEFAULT_SPEC;
++#endif
+ static const char *cc1plus_spec = CC1PLUS_SPEC;
+ static const char *link_gcc_c_sequence_spec = LINK_GCC_C_SEQUENCE_SPEC;
+ static const char *link_ssp_spec = LINK_SSP_SPEC;
diff --git a/src/patchsets/gcc/5.3.0/pie/16_all_gcc47_nopie_option.patch b/src/patchsets/gcc/5.3.0/pie/16_all_gcc47_nopie_option.patch
new file mode 100644
index 0000000000..ed9a961d76
--- /dev/null
+++ b/src/patchsets/gcc/5.3.0/pie/16_all_gcc47_nopie_option.patch
@@ -0,0 +1,16 @@
+2012-01-24 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/common.opt Add -nopie
+
+--- a/gcc/common.opt 2011-11-23 19:51:17.000000000 +0100
++++ b//gcc/common.opt 2012-01-24 16:56:24.302224357 +0100
+@@ -2280,6 +2280,9 @@ Driver
+ nodefaultlibs
+ Driver
+
++nopie
++Driver
++
+ nostartfiles
+ Driver
+
diff --git a/src/patchsets/gcc/5.3.0/pie/20_all_gcc49_config_crtbeginp.patch b/src/patchsets/gcc/5.3.0/pie/20_all_gcc49_config_crtbeginp.patch
new file mode 100644
index 0000000000..4bd5c18189
--- /dev/null
+++ b/src/patchsets/gcc/5.3.0/pie/20_all_gcc49_config_crtbeginp.patch
@@ -0,0 +1,40 @@
+2014-04-23 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/config/gnu-user.h If ENABLE_CRTBEGINP, -static and -pie use crtbegineP.o.
+ * gcc/config/rs6000/sysv4.h If ENABLE_CRTBEGINP, -static and -pie use crtbegineP.o.
+
+--- gcc/config/gnu-user.h 2014-01-02 23:23:26.000000000 +0100
++++ gcc/config/gnu-user.h 2014-04-23 00:55:06.390265454 +0200
+@@ -40,7 +40,15 @@ see the files COPYING3 and COPYING.RUNTI
+ provides part of the support for getting C++ file-scope static
+ object constructed before entering `main'. */
+
+-#if defined HAVE_LD_PIE
++#if defined (HAVE_LD_PIE) && defined (ENABLE_CRTBEGINP)
++#define GNU_USER_TARGET_STARTFILE_SPEC \
++ "%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
++ crti.o%s %{static:%{pie:crtbeginP.o%s;:crtbeginT.o%s}; \
++ shared|pie:crtbeginS.o%s;:crtbegin.o%s} \
++ %{fvtable-verify=none:%s; \
++ fvtable-verify=preinit:vtv_start_preinit.o%s; \
++ fvtable-verify=std:vtv_start.o%s}"
++#elif defined (HAVE_LD_PIE) && ! defined (ENABLE_CRTBEGINP)
+ #define GNU_USER_TARGET_STARTFILE_SPEC \
+ "%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
+ crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s} \
+--- gcc/config/rs6000/sysv4.h 2009-04-10 01:23:07.000000000 +0200
++++ gcc/config/rs6000/sysv4.h 2009-09-08 04:41:50.000000000 +0200
+@@ -883,7 +883,12 @@
+ %{!mnewlib: %{pthread:-lpthread} %{shared:-lc} \
+ %{!shared: %{profile:-lc_p} %{!profile:-lc}}}"
+
+-#ifdef HAVE_LD_PIE
++#if defined (HAVE_LD_PIE) && defined (ENABLE_CRTBEGINP)
++#define STARTFILE_LINUX_SPEC "\
++%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
++%{mnewlib:ecrti.o%s;:crti.o%s} \
++%{static:%{pie:crtbeginP.o%s;:crtbeginT.o%s}} %{!static:%{shared|pie:crtbeginS.o%s;:crtbegin.o%s}}"
++#elif defined (HAVE_LD_PIE) && ! defined (ENABLE_CRTBEGINP)
+ #define STARTFILE_LINUX_SPEC "\
+ %{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
+ %{mnewlib:ecrti.o%s;:crti.o%s} \
diff --git a/src/patchsets/gcc/5.3.0/pie/24_all_gcc49_invoke.texi.patch b/src/patchsets/gcc/5.3.0/pie/24_all_gcc49_invoke.texi.patch
new file mode 100644
index 0000000000..cdda379d68
--- /dev/null
+++ b/src/patchsets/gcc/5.3.0/pie/24_all_gcc49_invoke.texi.patch
@@ -0,0 +1,44 @@
+2014-04-24 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/doc/invoke.texi Add NOTES about -fstack-protector-all, -pie and
+ -fPIE/-fpie when --enable-esp is enable, this options is on by default.
+
+--- gcc/doc/invoke.texi 2009-04-01 09:18:47.000000000 +0200
++++ gcc/doc/invoke.texi 2009-06-18 14:08:38.000000000 +0200
+@@ -9233,6 +9245,11 @@ If a guard check fails, an error message
+ @opindex fstack-protector-all
+ Like @option{-fstack-protector} except that all functions are protected.
+
++NOTE: When --enable-esp, this option is enabled by default
++for C, C++, ObjC, and ObjC++ if neither @option{-fno-stack-protector},
++@option{-nostdlib}, @option{-ffreestanding}, @option{-fstack-protector},
++@option{-fstack-protector-strong} or @option{-fstack-protector-all} are found.
++
+ @item -fstack-protector-strong
+ @opindex fstack-protector-strong
+ Like @option{-fstack-protector} but includes additional functions to
+@@ -7960,6 +7965,12 @@
+ used for compilation (@option{-fpie}, @option{-fPIE},
+ or model suboptions) when you specify this linker option.
+
++NOTE: When --enable-esp, this option is enabled by default
++for C, C++, ObjC, and ObjC++ if neither @option{-fno-pie} or @option{-fno-PIE}
++or @option{-fno-pic} or @option{-fno-PIC} or @option{-nostdlib} or
++@option{-nostartfiles} or @option{-shared} or @option{-pg} or @option{-p}
++are found.
++
+ @item -rdynamic
+ @opindex rdynamic
+ Pass the flag @option{-export-dynamic} to the ELF linker, on targets
+@@ -15889,6 +15910,11 @@
+ @code{__pie__} and @code{__PIE__}. The macros have the value 1
+ for @option{-fpie} and 2 for @option{-fPIE}.
+
++NOTE: When --enable-esp, this option is enabled by default
++for C, C++, ObjC, and ObjC++ if neither @option{-fno-pie} or @option{-fno-PIE}
++or @option{-fno-pic} or @option{-fno-PIC} or @option{-nostdlib} or
++@option{-nostartfiles} or @option{-shared} are found.
++
+ @item -fno-jump-tables
+ @opindex fno-jump-tables
+ Do not use jump tables for switch statements even where it would be
diff --git a/src/patchsets/gcc/5.3.0/pie/33_all_gcc48_config_rs6000.patch b/src/patchsets/gcc/5.3.0/pie/33_all_gcc48_config_rs6000.patch
new file mode 100644
index 0000000000..1d080cf8fa
--- /dev/null
+++ b/src/patchsets/gcc/5.3.0/pie/33_all_gcc48_config_rs6000.patch
@@ -0,0 +1,34 @@
+2014-08-07 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/config/rs6000/sysv4.h (DRIVER_SELF_SPECS): Add ESP_DRIVER_SELF_SPEC.
+ (SUBTARGET_EXTRA_SPECS): Add ESP_EXTRA_SPECS.
+
+--- a/gcc/config/rs6000/sysv4.h 2013-01-10 21:38:27.000000000 +0100
++++ b/gcc/config/rs6000/sysv4.h 2013-03-26 01:30:33.257003189 +0100
+@@ -627,8 +627,13 @@ extern int fixuplabelno;
+
+ #define LINK_OS_DEFAULT_SPEC ""
+
++#ifdef ENABLE_ESP
++#define DRIVER_SELF_SPECS "%{mfpu=none: %<mfpu=* \
++ %<msingle-float %<mdouble-float}", ESP_DRIVER_SELF_SPEC
++#else
+ #define DRIVER_SELF_SPECS "%{mfpu=none: %<mfpu=* \
+ %<msingle-float %<mdouble-float}"
++#endif
+
+ /* Override rs6000.h definition. */
+ #undef CPP_SPEC
+@@ -933,7 +938,11 @@ ncrtn.o%s"
+ { "cpp_os_openbsd", CPP_OS_OPENBSD_SPEC }, \
+ { "cpp_os_default", CPP_OS_DEFAULT_SPEC }, \
+ { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER }, \
+- SUBSUBTARGET_EXTRA_SPECS
++ SUBSUBTARGET_EXTRA_SPECS ESP_EXTRA_SPECS
++
++#ifndef ENABLE_ESP
++#define ESP_EXTRA_SPECS
++#endif
+
+ #define SUBSUBTARGET_EXTRA_SPECS
+
diff --git a/src/patchsets/gcc/5.3.0/pie/34_all_gcc51_config_i386.patch b/src/patchsets/gcc/5.3.0/pie/34_all_gcc51_config_i386.patch
new file mode 100644
index 0000000000..b57011d54d
--- /dev/null
+++ b/src/patchsets/gcc/5.3.0/pie/34_all_gcc51_config_i386.patch
@@ -0,0 +1,56 @@
+2015-04-23 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/config/i386/gnu-user-common.h (DRIVER_SELF_SPECS): Add ESP_DRIVER_SELF_SPEC.
+ * gcc/config/i386/gnu-user.h (SUBTARGET_EXTRA_SPECS): Add ESP_EXTRA_SPECS.
+ * gcc/config/i386/i386.h (SUBTARGET_EXTRA_SPECS): Add ESP_EXTRA_SPECS.
+
+--- a/gcc/config/i386/gnu-user-common.h 2013-01-10 21:38:27.000000000 +0100
++++ b/gcc/config/i386/gnu-user-common.h 2013-02-14 00:51:44.689637605 +0100
+@@ -70,3 +70,7 @@ along with GCC; see the file COPYING3.
+ #if HAVE_GAS_CFI_PERSONALITY_DIRECTIVE
+ #define TARGET_CAN_SPLIT_STACK
+ #endif
++
++#ifdef ENABLE_ESP
++#define DRIVER_SELF_SPECS ESP_DRIVER_SELF_SPEC
++#endif
+--- a/gcc/config/i386/gnu-user.h 2011-05-05 14:32:50.000000000 +0200
++++ b/gcc/config/i386/gnu-user.h 2012-07-09 14:28:38.726289455 +0200
+@@ -93,9 +93,16 @@ along with GCC; see the file COPYING3.
+ "--32 %{!mno-sse2avx:%{mavx:-msse2avx}} %{msse2avx:%{!mavx:-msse2avx}}"
+
+ #undef SUBTARGET_EXTRA_SPECS
++#ifdef ENABLE_ESP
+ #define SUBTARGET_EXTRA_SPECS \
+ { "link_emulation", GNU_USER_LINK_EMULATION },\
+- { "dynamic_linker", GNU_USER_DYNAMIC_LINKER }
++ { "dynamic_linker", GNU_USER_DYNAMIC_LINKER }, \
++ ESP_EXTRA_SPECS
++#else
++#define SUBTARGET_EXTRA_SPECS \
++ { "link_emulation", GNU_USER_LINK_EMULATION },\
++ { "dynamic_linker", GNU_USER_DYNAMIC_LINKER }
++#endif
+
+ #undef LINK_SPEC
+ #define LINK_SPEC "-m %(link_emulation) %{shared:-shared} \
+--- a/gcc/config/i386/i386.h 2011-11-24 23:11:12.000000000 +0100
++++ b/gcc/config/i386/i386.h 2012-07-09 14:21:24.575276517 +0200
+@@ -617,13 +617,16 @@ enum target_cpu_default
+ Do not define this macro if it does not need to do anything. */
+
+ #ifndef SUBTARGET_EXTRA_SPECS
++#ifdef ENABLE_ESP
++#define SUBTARGET_EXTRA_SPECS ESP_EXTRA_SPECS
++#else
+ #define SUBTARGET_EXTRA_SPECS
+ #endif
++#endif
+
+ #define EXTRA_SPECS \
+ { "cc1_cpu", CC1_CPU_SPEC }, \
+ SUBTARGET_EXTRA_SPECS
+-
+
+ /* Set the value of FLT_EVAL_METHOD in float.h. When using only the
+ FPU, assume that the fpcw is set to extended precision; when using
diff --git a/src/patchsets/gcc/5.3.0/pie/35_all_gcc51_config_arm.patch b/src/patchsets/gcc/5.3.0/pie/35_all_gcc51_config_arm.patch
new file mode 100644
index 0000000000..815d74af9e
--- /dev/null
+++ b/src/patchsets/gcc/5.3.0/pie/35_all_gcc51_config_arm.patch
@@ -0,0 +1,37 @@
+2015-04-26 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/config/arm/arm.h (DRIVER_SELF_SPECS): Add ESP_DRIVER_SELF_SPEC.
+ * gcc/config/arm/elf.h (SUBSUBTARGET_EXTRA_SPECS): Add ESP_EXTRA_SPECS.
+
+--- a/gcc/config/arm/arm.h 2013-01-15 17:17:28.000000000 +0100
++++ b/gcc/config/arm/arm.h 2013-02-18 22:45:18.327284928 +0100
+@@ -2326,6 +2326,14 @@ extern const char *host_detect_local_cpu
+ # define EXTRA_SPEC_FUNCTIONS BIG_LITTLE_CPU_SPEC_FUNCTIONS
+ #endif
+
+-#define DRIVER_SELF_SPECS MCPU_MTUNE_NATIVE_SPECS
++#ifdef ENABLE_ESP
++# define DRIVER_SELF_SPECS \
++ MCPU_MTUNE_NATIVE_SPECS, \
++ ESP_DRIVER_SELF_SPEC
++/* https://bugs.gentoo.org/518598 */
++# define ESP_NO_STACK_CHECK 1
++#else
++# define DRIVER_SELF_SPECS MCPU_MTUNE_NATIVE_SPECS
++#endif
+ #define TARGET_SUPPORTS_WIDE_INT 1
+ #endif /* ! GCC_ARM_H */
+--- a/gcc/config/arm/elf.h 2013-01-10 21:38:27.000000000 +0100
++++ b/gcc/config/arm/elf.h 2013-05-19 02:15:49.595855825 +0200
+@@ -49,7 +49,11 @@
+ #endif
+
+ #undef SUBSUBTARGET_EXTRA_SPECS
++#ifdef ENABLE_ESP
++#define SUBSUBTARGET_EXTRA_SPECS ESP_EXTRA_SPECS
++#else
+ #define SUBSUBTARGET_EXTRA_SPECS
++#endif
+
+ #ifndef ASM_SPEC
+ #define ASM_SPEC "\
diff --git a/src/patchsets/gcc/5.3.0/pie/36_all_gcc51_config_mips.patch b/src/patchsets/gcc/5.3.0/pie/36_all_gcc51_config_mips.patch
new file mode 100644
index 0000000000..5646261533
--- /dev/null
+++ b/src/patchsets/gcc/5.3.0/pie/36_all_gcc51_config_mips.patch
@@ -0,0 +1,43 @@
+2013-04-01 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/config/mips/gnu-user.h (DRIVER_SELF_SPECS): Add ESP_DRIVER_SELF_SPEC.
+ * gcc/config/mips/mips.h (SUBTARGET_EXTRA_SPECS): Add ESP_EXTRA_SPECS.
+
+--- a/gcc/config/mips/gnu-user.h 2013-01-10 21:38:27.000000000 +0100
++++ b/gcc/config/mips/gnu-user.h 2013-03-10 22:37:33.743176388 +0100
+@@ -125,9 +125,17 @@ extern const char *host_detect_local_cpu
+ "%{!mabi=*: -" MULTILIB_ABI_DEFAULT "}"
+
+ #undef DRIVER_SELF_SPECS
++#ifdef ENABLE_ESP
+ #define DRIVER_SELF_SPECS \
+ MIPS_ISA_LEVEL_SPEC, \
+ BASE_DRIVER_SELF_SPECS, \
++ ESP_DRIVER_SELF_SPEC, \
+ LINUX_DRIVER_SELF_SPECS
++#else
++#define DRIVER_SELF_SPECS \
++ MIPS_ISA_LEVEL_SPEC, \
++ BASE_DRIVER_SELF_SPECS, \
++ LINUX_DRIVER_SELF_SPECS
++#endif
+
+ /* Similar to standard Linux, but adding -ffast-math support. */
+ #undef GNU_USER_TARGET_MATHFILE_SPEC
+--- a/gcc/config/mips/mips.h 2013-01-10 21:38:27.000000000 +0100
++++ b/gcc/config/mips/mips.h 2013-03-24 16:59:01.474513910 +0100
+@@ -1197,9 +1197,13 @@ struct mips_cpu_info {
+ SUBTARGET_EXTRA_SPECS
+
+ #ifndef SUBTARGET_EXTRA_SPECS
++#ifdef ENABLE_ESP
++#define SUBTARGET_EXTRA_SPECS ESP_EXTRA_SPECS
++#else
+ #define SUBTARGET_EXTRA_SPECS
+ #endif
+-
++#endif
++
+ #define DBX_DEBUGGING_INFO 1 /* generate stabs (OSF/rose) */
+ #define DWARF2_DEBUGGING_INFO 1 /* dwarf2 debugging info */
+
diff --git a/src/patchsets/gcc/5.3.0/pie/37_all_gcc48_config_ia64.patch b/src/patchsets/gcc/5.3.0/pie/37_all_gcc48_config_ia64.patch
new file mode 100644
index 0000000000..ba71922740
--- /dev/null
+++ b/src/patchsets/gcc/5.3.0/pie/37_all_gcc48_config_ia64.patch
@@ -0,0 +1,30 @@
+2013-06-03 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/config/ia64/linux.h Define DRIVER_SELF_SPECS ESP_DRIVER_SELF_SPEC.
+ * gcc/config/ia64/ia64.h (SUBTARGET_EXTRA_SPECS): Add ESP_EXTRA_SPECS.
+
+--- a/gcc/config/ia64/linux.h 2013-01-10 21:38:27.000000000 +0100
++++ b/gcc/config/ia64/linux.h 2013-03-16 22:50:10.363049291 +0100
+@@ -88,3 +88,7 @@ do { \
+
+ /* Define this to be nonzero if static stack checking is supported. */
+ #define STACK_CHECK_STATIC_BUILTIN 1
++
++#ifdef ENABLE_ESP
++#define DRIVER_SELF_SPECS ESP_DRIVER_SELF_SPEC
++#endif
+--- a/gcc/config/ia64/ia64.h 2013-01-10 21:38:27.000000000 +0100
++++ b/gcc/config/ia64/ia64.h 2013-03-26 02:03:21.052061828 +0100
+@@ -41,8 +41,12 @@ do { \
+ } while (0)
+
+ #ifndef SUBTARGET_EXTRA_SPECS
++#ifdef ENABLE_ESP
++#define SUBTARGET_EXTRA_SPECS ESP_EXTRA_SPECS
++#else
+ #define SUBTARGET_EXTRA_SPECS
+ #endif
++#endif
+
+ #define EXTRA_SPECS \
+ { "asm_extra", ASM_EXTRA_SPEC }, \
diff --git a/src/patchsets/gcc/5.3.0/pie/40_all_gcc49_config_esp.patch b/src/patchsets/gcc/5.3.0/pie/40_all_gcc49_config_esp.patch
new file mode 100644
index 0000000000..16cc2b4d1e
--- /dev/null
+++ b/src/patchsets/gcc/5.3.0/pie/40_all_gcc49_config_esp.patch
@@ -0,0 +1,140 @@
+2014-05-12 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/esp.h New file to support --enable-esp
+ Version 20140512.1
+
+--- gcc/config/esp.h 2010-04-09 16:14:00.000000000 +0200
++++ gcc/config/esp.h 2012-06-23 01:00:31.248348491 +0200
+@@ -0,0 +1,132 @@
++/* License terms see GNU GENERAL PUBLIC LICENSE Version 3.
++ * Version 20140512.1
++ * Magnus Granberg (Zorry) <zorry@gentoo.org> */
++#ifndef GCC_ESP_H
++#define GCC_ESP_H
++
++/* This file will add -fstack-protector-all, -fstack-check, -fPIE, -pie and -z now
++ as default if the defines and the spec allow it.
++ Added a hack for gcc-specs-* in toolchain-funcs.eclass and _filter-hardened in flag-o-matic.eclass
++ to support older hardened GCC patches and we don't need to change the code on gcc-specs-* and _filter-hardened.
++ This will add some unsupported upstream commands options as -nopie and -nonow.
++ -D__KERNEL__ is added so we don't have -fPIE, -pie and -fstack-protector-all and -fstack-check when building kernels.
++ ESP_CC1_SPEC is added to CC1_SPEC.
++ ESP_CC1_STRICT_OVERFLOW_SPEC is added so we don't disable the strict-overflow check.
++ ESP_LINK_PIE_CHECK_SPEC check for -pie, -p, -pg, -profile and -static.
++ ENABLE_CRTBEGINP add support for crtbeginP.o, build -static with -fPIE or -fpie.
++*/
++#ifdef ENABLE_ESP
++
++ /* Hack to support gcc-specs-* in toolchain-funcs.eclass and _filter-hardened in flag-o-matic.eclass */
++ #define ESP_CC1_SPEC " %(esp_cc1_ssp) %(esp_cc1_pie) %(esp_cc1_strict_overflow)"
++ #if defined ( EFAULT_SSP ) || defined ( EFAULT_PIE_SSP )
++ #define ESP_CC1_SSP_SPEC "%{!fno-stack-protector: %{!fno-stack-protector-all: %{!fno-stack-check: }}}"
++ #else
++ #define ESP_CC1_SSP_SPEC ""
++ #endif
++ #if defined ( EFAULT_PIE ) || defined ( EFAULT_PIE_SSP )
++ #define ESP_CC1_PIE_SPEC "%{!nopie: }"
++ #else
++ #define ESP_CC1_PIE_SPEC ""
++ #endif
++ #define ESP_CC1_STRICT_OVERFLOW_SPEC "%{!fstrict-overflow:%{!fno-strict-overflow: -fno-strict-overflow}}"
++
++ /* ESP_LINK_SPEC is added to LINK_PIE_SPEC if esp is enable
++ -z now will be added if we don't have -vanilla spec. We do a -pie incompatible check
++ Don't remove the specs in the end */
++ #define ESP_LINK_SPEC "%(esp_link_now) %(esp_link_pie_check) "
++ #define ESP_LINK_NOW_SPEC "%{!nonow:-z now}"
++
++ /* We use ESP_DRIVER_SELF_SPEC to add pie and ssp command-line options. */
++ #define ESP_DRIVER_SELF_SPEC "%{D__KERNEL__:;:%{!nopie:%(esp_options_pie) \
++ %(esp_link_pie)} %(esp_options_ssp) }"
++
++ /* This will add -fstack-protector-all if we don't have -nostdlib -nodefaultlibs -fno-stack-protector -fstack-protector
++ -fstack-protector-all and we have EFAULT_SSP or EFAULT_PIE_SSP defined. */
++ #if defined ( EFAULT_SSP ) || defined ( EFAULT_PIE_SSP )
++ #ifdef ESP_NO_STACK_CHECK
++ #define ESP_OPTIONS_STACK_CHECK_SPEC
++ #else
++ #define ESP_OPTIONS_STACK_CHECK_SPEC "%{fstack-check|fstack-check=*:;: -fstack-check}"
++ #endif
++ #define ESP_OPTIONS_SSP_SPEC \
++ "%{nostdlib|ffreestanding|fno-stack-protector|fstack-protector| \
++ fstack-protector-all|fstack-protector-strong:;:-fstack-protector-all} " \
++ ESP_OPTIONS_STACK_CHECK_SPEC
++ #else
++ #define ESP_OPTIONS_SSP_SPEC ""
++ #endif
++
++ /* If EFAULT_PIE or EFAULT_PIE_SSP is defined we will add -fPIE -pie */
++ #if defined ( EFAULT_PIE ) || defined ( EFAULT_PIE_SSP )
++
++ /* This will add -fPIE if we don't have -pie -fpic -fPIC -fpie -fPIE -fno-pic -fno-PIC -fno-pie -fno-PIE -shared -static
++ -nostdlib -nostartfiles. */
++ /* With ENABLE_CRTBEGINP we don't need to check for -static */
++ #ifdef ENABLE_CRTBEGINP
++ #define ESP_OPTIONS_PIE_SPEC \
++ "%{!pie: %{!fpic:%{!fPIC:%{!fpie:%{!fPIE: %{!fno-pic:%{!fno-PIC:%{!fno-pie:%{!fno-PIE: \
++ %{!shared: %{!nostdlib: %{!nostartfiles:-fPIE}} } }}}} }}}} }"
++ #else
++ #define ESP_OPTIONS_PIE_SPEC \
++ "%{!pie: %{!fpic:%{!fPIC:%{!fpie:%{!fPIE: %{!fno-pic:%{!fno-PIC:%{!fno-pie:%{!fno-PIE: \
++ %{!shared: %{!static: %{!nostdlib: %{!nostartfiles:-fPIE}} } }}}} }}}} }}"
++ #endif
++
++ /* This will add -pie if we don't have -pie -A -fno-pic -fno-PIC -fno-pie -fno-PIE -shared -static -r -nostdlib
++ -nostartfiles */
++ /* With ENABLE_CRTBEGINP we don't need to check for -static
++ and we add -pie only to get the start and endfiles. -pie will not go to the linker. */
++ #ifdef ENABLE_CRTBEGINP
++ #define ESP_LINK_PIE_SPEC \
++ "%{!pie:%{!A:%{!fno-pie:%{!fno-PIE:%{!fno-pic:%{!fno-PIC:%{!shared:%{!r: \
++ %{!nostdlib:%{!nostartfiles:-pie}}}}}}}}}}"
++ #else
++ #define ESP_LINK_PIE_SPEC \
++ "%{!pie:%{!A:%{!fno-pie:%{!fno-PIE:%{!fno-pic:%{!fno-PIC:%{!shared:%{!static:%{!r: \
++ %{!nostdlib:%{!nostartfiles:-pie}}}}}}}}}}}"
++ #endif
++
++ /* This will check if -pie is set when (-static) -pg -p -profile. If set it will make gcc print out
++ "-pie and (static)|pg|p|profile are incompatible when linking" */
++ /* With ENABLE_CRTBEGINP we don't need to check for -static */
++ #ifdef ENABLE_CRTBEGINP
++ #define ESP_LINK_PIE_CHECK_SPEC \
++ "%{pie:%{pg|p|profile:%e-pie and -pg|p|profile are incompatible when linking}}"
++ #else
++ #define ESP_LINK_PIE_CHECK_SPEC \
++ "%{pie:%{static|pg|p|profile:%e-pie and -static|pg|p|profile are incompatible when linking}}"
++ #endif
++
++ /* We don't pass -pie to the linker when -static. */
++ #ifdef ENABLE_CRTBEGINP
++ #define LINK_PIE_SPEC "%{!static:%{pie:-pie}} %(esp_link)"
++ #else
++ #define LINK_PIE_SPEC "%{pie:-pie} %(esp_link)"
++ #endif
++
++ #else
++ #define ESP_OPTIONS_PIE_SPEC ""
++ #define ESP_LINK_PIE_CHECK_SPEC ""
++ #define ESP_LINK_PIE_SPEC ""
++ #define LINK_PIE_SPEC "%{pie:-pie} %(esp_link)"
++ #endif
++
++ /* We add extra spec name's to the EXTRA_SPECS list */
++ #define ESP_EXTRA_SPECS \
++ { "esp_cc1", ESP_CC1_SPEC }, \
++ { "esp_cc1_pie", ESP_CC1_PIE_SPEC }, \
++ { "esp_cc1_ssp", ESP_CC1_SSP_SPEC }, \
++ { "esp_cc1_strict_overflow", ESP_CC1_STRICT_OVERFLOW_SPEC }, \
++ { "esp_link", ESP_LINK_SPEC }, \
++ { "esp_link_now", ESP_LINK_NOW_SPEC }, \
++ { "esp_link_pie", ESP_LINK_PIE_SPEC }, \
++ { "esp_link_pie_check", ESP_LINK_PIE_CHECK_SPEC }, \
++ { "esp_driver_self", ESP_DRIVER_SELF_SPEC }, \
++ { "esp_options_pie", ESP_OPTIONS_PIE_SPEC }, \
++ { "esp_options_ssp", ESP_OPTIONS_SSP_SPEC }
++
++ static const char *cc1_spec = CC1_SPEC ESP_CC1_SPEC;
++
++#endif
++#endif /* End GCC_ESP_H */
diff --git a/src/patchsets/gcc/5.3.0/pie/README b/src/patchsets/gcc/5.3.0/pie/README
new file mode 100644
index 0000000000..ddef624b66
--- /dev/null
+++ b/src/patchsets/gcc/5.3.0/pie/README
@@ -0,0 +1,19 @@
+This work started with bugs #94325 #100689 #106222 #149292 #149649 and the overlay on http://overlays.gentoo.org/dev/kevquinn.
+By Kevin K. Quinn, Peter S. Mazinger, Natanael Copa, Alexander Gabert, Solar, PaX Team, Mike Frysinger and mentor.
+
+The work stalled. Some threads on the Gentoo forum started to do their own fixes to get it working.
+Xake started the thread where most of the new work was done: "How long until hardened and toolchain will produce a hardened gcc4?"
+http://forums.gentoo.org/viewtopic-t-668885.html. I joined the thread and started to code.
+
+We started with the pieworld code from kevquinn's overlay. The PIE and minispecs part hit the tree later on.
+With GCC 4.4.0 I was willing to do some code cleanup, use built-in specs and add it as --enable-esp in the
+configure command line. On GCC 4.8.0 we use DRIVER_SELF_SPECS for the specs.
+From Gcc 4.9.0 it will have -fstack-protector-strong on as default.
+
+Thank you all:
+Kevin K. Quinn, Peter S. Mazinger, Natanael Copa, Alexander Gabert, Solar, PaX Team, Mike Frysinger, Xake, Dwokfur,
+KernelOfTruth, SteveL, nixnut, Hopeless, forsaken1, XioXous, obrut<-, mv, qjim, Tommy[D], Genewb, radegand,
+unk, neuron, alexxy, hellboi64, likewhoa, g0rg0n, costel78, polsas, 7v5w7go9ub0o, uberpinguin, Naib, cilly,
+bonsaikitten, kerframil, agaffney, Gordon Malm, blueness, Matthias Klose, Kees Cook, mentor, Anarchy,
+devurandom and everyone else for helping to test, suggestions, fixes and anything else we have missed.
+/2014-05-12 Magnus Grenberg (Zorry) <zorry@gentoo.org>
diff --git a/src/patchsets/gcc/5.3.0/pie/README.Changelog b/src/patchsets/gcc/5.3.0/pie/README.Changelog
new file mode 100644
index 0000000000..613ecc1540
--- /dev/null
+++ b/src/patchsets/gcc/5.3.0/pie/README.Changelog
@@ -0,0 +1,442 @@
+0.6.5 Mike Frysinger <vapier@gentoo.org>
+
+ * gcc/doc/invoke.texi: Clean up typos/grammar.
+
+0.6.4 Mike Frysinger <vapier@gentoo.org>
+
+ #518598
+ * gcc/config/arm/elf.h (ESP_NO_STACK_CHECK): Define.
+ * gcc/config/esp.h (ESP_OPTIONS_SSP_SPEC): Do not add -fstack-check
+ when ESP_NO_STACK_CHECK is defined.
+
+0.6.3 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/configure Regenerated
+ * gcc/config/i386/gnu-user-common.h Bumped for 5.1.0 release
+ * gcc/config/arm/arm.h Bumped for 5.1.0 release
+ * gcc/config/mips/gnu-user.h Bumped for 5.1.0 release
+ * gcc/config/mips/gnu-user64.h Remove
+ * libgcc/Makefile.in Bumped for 5.1.0 release
+
+0.6.2 Magnus Granberg <zorry@gentoo.org>
+
+ #528690
+ * libgcc/Makefile.in Disable -fstack-check
+
+0.6.1 Magnus Granberg <zorry@gentoo.org>
+
+ #528968
+ * gcc/config/rs6000/sysv4.h typo ESP_DRIVER_SELF_SPEC
+
+0.6.0 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/configure Regenerated
+ * gcc/config/esp.h. Bumped for 4.9.0 release
+ * gcc/config/gnu-user.h Bumped for 4.9.0 release
+ * gcc/doc/invoke.texi Bumped for 4.9.0 release
+ * libgcc/Makefile.in Bumped for 4.9.0 release
+
+0.5.9 Magnus Granberg <zorry@gentoo.org>
+
+ * configure.ac Remove
+ * configure Remove
+ * Makefile.in -fno-stack-protector moved to gentoo gcc patchset.
+ * gcc/gcc.c Update cc1_spec define
+ * gcc/doc/invoke.texi And note on ssp-all for --enable-esp and -ffreestanding
+
+0.5.8 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/config/rs6000/linux64 (ASM_SPEC32): Allready applay.
+
+0.5.7 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/config/esp.h Add -fstack-check as default.
+
+0.5.6 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/config/ia64/linux.h Change ESP_DRIVER_SELF_SPECS To ESP_DRIVER_SELF_SPEC
+ * gcc/config/arm/elf.h (SUBSUBTARGET_EXTRA_SPECS): Add ESP_EXTRA_SPECS.
+
+0.5.5 Magnus Granberg <zorry@gentoo.org>
+
+ * configure.ac Add mips
+ * configure Regenerated
+ * gcc/configure.ac Clean up the checksand add mips.
+ * gcc/configure Regenerated
+ * gcc/config.in Remove ENABLE_ESP_SSP
+ * gcc/Makefile.in Bumped for 4.8.0 release
+ * gcc/gcc.c Remove ESP_EXTRA_SPECS and
+ ESP_COMMAND_OPTIONS_SPEC
+ * gcc/config/rs6000/sysv4.h Add ESP_DRIVER_SELF_SPEC
+ and ESP_EXTRA_SPECS
+ * gcc/config/i386/gnu-user-common.h Add ESP_DRIVER_SELF_SPEC
+ * gcc/config/i386/gnu-user.h Add ESP_DRIVER_SELF_SPEC
+ * gcc/config/i386/i386.h Add ESP_DRIVER_SELF_SPEC
+ * gcc/config/arm/arm.h Add ESP_DRIVER_SELF_SPEC and
+ ESP_EXTRA_SPECS
+ * gcc/config/mips/gnu-user.h Add ESP_DRIVER_SELF_SPEC
+ * gcc/config/mips/gnu-user64.h Add ESP_DRIVER_SELF_SPEC
+ * gcc/config/mips/mips.h Add ESP_EXTRA_SPECS
+ * gcc/config/ia64/linux.h Add ESP_DRIVER_SELF_SPECS
+ * gcc/config/ia64/ia64.h Add ESP_EXTRA_SPECS
+ * gcc/config/esp.h Bump for ESP_DRIVER_SELF_SPEC support
+
+0.5.4 Magnus Granberg <zorry@gentoo.org>
+
+ #436924
+ * configure.ac Add --enable-esp. Add -fno-stack-protector
+ to stage1_cflags.
+ * gcc/configure.ac Add --enable-esp and check if SSP works.
+ Define ENABLE_ESP ENABLE_ESP_SSP.
+ Check if we support crtbeginP and define ENABLE_CRTBEGINP.
+ * gcc/configure Fix a typo
+
+0.5.3 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/configure Clean up the checks and added
+ check for uclibc ssp support.
+ * gcc/config.in Add define for ENABLE_ESP_SSP
+ * gcc/esp.h Check for ENABLE_ESP_SSP
+
+0.5.2 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/common.opt Add -nopie
+
+0.5.1 Magnus Granberg <zorry@gentoo.org>
+
+ * configure Bumped for 4.7.0 release
+ * gcc/configure Bumped for 4.7.0 release and
+ added some checks.
+ * gcc/Makefile Bumped for 4.7.0 release
+ * gcc/gcc.c Bumped for 4.7.0 release
+ * libgcc/Makefile Bumped for 4.7.0 release
+
+0.5.0 Magnus Granberg <zorry@gentoo.org>
+
+ #393321
+ * gcc/Makefile.in Rename crtbeginTS.o to crtbeginP.o
+ * gcc/config/gnu-user.h Rename crtbeginTS.o to crtbeginP.o
+ * gcc/config/rs6000/sysv4.h Rename crtbeginTS.o to crtbeginP.o
+ * gcc/esp.h Rename crtbeginTS.o to crtbeginP.o
+ * gcc/configure Rename crtbeginTS.o to crtbeginP.o
+ * gcc/config.in Rename crtbeginTS.o to crtbeginP.o
+ * libgcc/Makefile.in Rename crtbeginTS.o to crtbeginP.o
+
+0.4.9 Magnus Granberg <zorry@gentoo.org>
+
+ #380823
+ * gcc/Makefile.in added ESP_NOPIE_CFLAGS to ALL_CXXFLAGS
+
+0.4.8 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/objc/lang-specs.h Bumped for gcc 4.6.0 release
+ * gcc/objcp/lang-specs.h Bumped for gcc 4.6.0 release
+ * gcc/cp/lang-specs.h Bumped for gcc 4.6.0 release
+
+0.4.7 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/gcc.c Add %(esp_options) and %(esp_cpp_options)
+ * gcc/esp.h Use the esp.h patch from gcc-4.4 patchset
+ * gcc/config/rs6000/linux64.h Bumed for >2011-02-26 snapshot
+ * gcc/objc/lang-specs.h Add %(esp_options)
+ * gcc/objcp/lang-specs.h Add %(esp_options)
+ * gcc/cp/lang-specs.h Add %(esp_options)
+ * gcc/config/gnu-user.h Add crtbeginTS.o support
+
+0.4.6 Magnus Granberg <zorry@gentoo.org>
+
+ * Makefile.in Bumped for gcc 4.6
+ * gcc/Makefile.in Bumped for gcc 4.6
+ added ESP_NOPIE_CFLAGS to ALL_CFLAGS
+ remove any ESP_NOSSP_CFLAGS
+ remove any ESP_NOPIE_CFLAGS from crt* when not needed
+ * gcc/gcc.c Bumped for gcc 4.6
+ moved espf_options_ssp to espf_command_options_spec
+ * gcc/esp.h Added espf_options_ssp to espf_cc1_command_spec
+ * gcc/config/rs6000/linux64.h Bumped for gcc 4.6
+ * gcc/config/linux.h Bumped for gcc 4.6
+
+0.4.5 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/config/rs6000/sysv4.h Fix a typo in the static spec rules
+
+0.4.4 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/esp.h Renamed ESP_CC1_STRICT_SPEC to ESP_CC1_STRICT_OVERFLOW_SPEC
+ Renamed ESP_OPTIONS_PIE_CHECK_SPEC to ESP_LINK_PIE_CHECK_SPEC
+
+0.4.3 Magnus Granberg <zorry@gentoo.org>
+
+ #299061 b.g.o
+ * gcc/gcc.c removed the pie incompatible specs rule call
+ * gcc/esp.h Move the -pie incompatible check to esp_link
+ remove the -shared incompatible check
+
+0.4.2 Magnus granberg <zorry@gentoo.org>
+
+ * configure remove the changes from 0.4.1
+ * Makefile.in remove the changes from 0.4.1 remove -fstack-protector check.
+ * gcc/configure remove the changes from 0.4.1
+ * gcc/config.in remove the changes from 0.4.1 remove HAVE_GCC_SSP
+ * gcc/Makefile remove the changes from 0.4.1
+ * gcc/esp.h change HAVE_GCC_LD_PIE to (EFAULT_PIE || EFAULT_PIE_SSP)
+ change HAVE_GCC_SSP to (EFAULT_SSP || EFAULT_PIE_SSP)
+ * libmudflap/Makefiles.in remove the changes from 0.4.1
+
+0.4.1 Magnus Granberg <zorry@gentoo.org>
+
+ *configure removed check for --enable-esp removed enable_esp
+ added check for --enable-esp=(no|all|nopie|nossp). added enable_esp_set
+ *Makefile.in renamed enable_esp to enable_esp_set
+ *gcc/configure removed check for --enable-esp removed enable_esp
+ added check for --enable-esp=(no|all|nopie|nossp). added enable_esp_set
+ added a -fPIE -pie check. change AC_COMPILE_IFELSE to AC_LINK_IFELSE in the
+ -fstack-protector check.
+ * gcc/config.in Added HAVE_GCC_LD_PIE
+ *gcc/Makefile.in renamed enable_esp to enable_esp_set
+ *gcc/esp.h Renamed HAVE_LD_PIE to HAVE_GCC_LD_PIE
+ Added HAVE_GCC_LD_PIE to #define ESP_CC1_PIE_SPEC. Move ESP_COMMAND_OPTIONS_SPEC
+ * libmudflap/Makefiles.in In enable_esp change ifeq to ifdef.
+
+ #293843 b.g.o
+ *gcc/esp.h Added -nonow to the -z now specs.
+
+0.4.0 Anthony G. Basile <basile@opensource.dyc.edu>
+
+ rename espf to esp and change espf-patchset to piepatchset
+
+0.3.9 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/configure Added check for TLS on the target in the SSP check.
+
+ #149292 b.g.o
+ * gcc/config/i386/linux.h Removed uclibc don't support TLS on stack-protector
+ * gcc/config/i386/linux64.h Removed uclibc don't support TLS on stack-protector
+ * gcc/config/rs6000/linux.h Removed uclibc don't support TLS on stack-protector
+ * gcc/config/i386/linux.h Removed uclibc don't support TLS on stack-protector
+ * gcc/config/sparc/linux.h Removed uclibc don't support TLS on stack-protector
+ * gcc/config/sparc/linux64.h Removed uclibc don't support TLS on stack-protector
+
+0.3.8 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/configure Redone the -fstack-protector check.
+ * gcc/config.in Added HAVE_GCC_SSP
+ * gcc/gcc.c Removed code for espf_link_spec in X
+ * gcc/espf.h Added ifdef HAVE_GCC_SSP, change code for espf_link_spec and link_pie_spec
+
+0.3.7_beta Anthony G. Basile <basile@opensource.dyc.edu>
+
+ * gcc/configure Check if -fstack-protector is supported by gcc on ARCH
+ Updated AC_SUBST enable_espf
+ * gcc/Makefile.in Remove the fix for $(out_object_file): ix86_split_to_parts() stack smashing attack b.g.o #149292.
+ * gcc/gcc.c Updaded the .c .cc compiler specs.
+
+0.3.6 Magnus Granberg <zorry@ume.nu>
+
+ * configure Check --enable-espf change ppc* to powerpc*, powerpc64 and add ia64.
+ * gcc/configure Don't check for -z,relro on ia64. Disable crtbeginTS for ia64.
+ * gcc/espf.h ia64 don't support -fstack-protector*
+
+0.3.5 Maguns Granberg <zorry@ume.nu>
+
+ * gcc/espf.h Change the specs for crtbegin.TS.o.
+ * gcc/gcc.c Rename espf_cc1_options to espf_options_pie_check.
+ * gcc/config/linux.h Fix typos ENABLE_CRTBEGINS to ENABLE_CRTBEGINTS
+ * gcc/config/rs6000/linux64.h ASM_SPEC32: %{fpic:-K PIC} %{fPIC:-K PIC} to
+ %{fpic|fPIC|fpie|fPIE:-K PIC}
+
+0.3.4 Magnus Granberg <zorry@ume.nu>
+
+ * gcc/configure Add crtbeginTS.o support.
+ * gcc/Makefile.in Add crtbeginTS.o support.
+ * gcc/gcc.c Add espf_cc1_options.
+ * gcc/espf.h Added espf_cc1_options, crtbeginTS.o support,
+ espf_cc1_options and espf_cc1_strictoverflow.
+ * gcc/config.in Add crtbeginTS.o support.
+ * gcc/config/linux.h Add crtbeginTS.o support.
+ * gcc/config/rs6000/sysv4.h Add crtbeginTS.o support.
+ * gcc/doc/invoke.texi Add NOTES about -fstack-protector-all,
+ -pie and -fPIE.
+ * libgcc/Makefile.in Add crtbeginTS.o support.
+
+0.3.3 Magnus Granberg <zorry@ume.nu>
+
+ * gcc/opts.c change #ifdef ENABLE_ESPF to #ifndef ENABLE_ESPF
+
+0.3.2 Magnus Granberg <zorry@ume.nu>
+
+ * gcc/opts.c disable flag_delete_null_pointer_checks >= -O2
+ * gcc/espf.h add ESPF_CC1_SSP_SPEC and ESPF_CC1_PIE_SPEC to fix bugs on -vanilla spec
+
+ #149292 b.g.o
+ * gcc/config/i386/linux.h uclibc don't support TLS on stack-protector
+ * gcc/config/i386/linux64.h uclibc don't support TLS on stack-protector
+ * gcc/config/rs6000/linux.h uclibc don't support TLS on stack-protector
+ * gcc/config/i386/linux.h uclibc don't support TLS on stack-protector
+ * gcc/config/sparc/linux.h uclibc don't support TLS on stack-protector
+ * gcc/config/sparc/linux64.h uclibc don't support TLS on stack-protector
+
+0.3.1 Magnus Granberg <zorry@ume.nu>
+
+ * gcc/cp/Make-lang.in cc1plus: pch test fail when cc1plus is compile with -fPIE.
+ * gcc/configure fix --enable-espf when USE"-hardened"
+
+4.4.1-espf-0.3.0 Magnus Granberg <zorry@ume.nu>
+
+ * gcc/espf.h add ESPF_LINK_SPEC ESPF_LINK_NOW_SPEC
+ * gcc/gcc.c move do_self_spec (espf_command_options_spec)
+ do_spec_1() add espf_link_spec
+
+0.3.0 Magnus Granberg <zorry@ume.nu>
+
+ * gcc/objc/lang-specs.h Add %(espf_options)
+ * gcc/objcp/lang-specs.h Add %(espf_options)
+ * gcc/cp/lang-specs.h Add %(espf_options)
+ * gcc/config.in removed ENABLE_LIBSSP
+ * Makefile.in We add -fno-stack-protector to
+ BOOT_CFLAGS, LIBCFLAGS and LIBCXXFLAGS
+ cc1: pch.exp test fail when cc1 is compile with -fPIE
+ * libmudflap/Makefiles.in Add -fno-stack-protector -U_FORTIFY_SOURCE
+ to AM_CFLAGS
+ * configure add --enable-espf
+ add -fno-stack-protector to stage1_cflags
+ add targes ppc* arm sparc*
+ * gcc/configure change code for check --enable-espf
+ * libmudflap/configure add enable_espf
+ * gcc/espf.h ESPF_CC1_OPTIONS_SPEC renamed to ESPF_OPTIONS_SPEC
+ add ESPF_CPP_OPTIONS_SPEC ESPF_COMMAND_OPTIONS_SPEC
+ ESPF_CC1_OPTIONS_SSP_SPEC renamed to ESPF_OPTIONS_SSP_SPEC
+ ESPF_COMPILER_COMMAND_PIE_SPEC renamed to ESPF_OPTIONS_PIE_SPEC
+ ESPF_LINK_COMMAND_PIE_SPEC renamed to ESPF_LINK_PIE_SPEC
+ add !p !pg to ESPF_LINK_PIE_SPEC
+ removed ESPF_LINK_SPEC ESPF_CC1_OPTIONS_PIE_INCOMPATIBLE_SPEC
+ * gcc/gcc.c cpp_options add %(espf_cpp_options)
+ compiler spec add %(espf_options)
+ change code for ESPF_EXTRA_SPECS
+ process_command(): Check for lazy, or now
+ do_spec_1(): Add -z now and -z relro
+ main() add do_self_spec (espf_command_options_spec)
+ removed do_self_spec (espf_cc1_command_spec) do_self_spec (espf_link_command_spec)
+
+0.2.9 Magnus Granberg <zorry@ume.nu>
+
+ * gcc/espf.h add ESPF_COMPILER_COMMAND_PIE_SPEC
+ add ESPF_LINK_COMMAND_PIE_SPEC
+ change ESPF_COMPILER_COMMAND_SPEC ESPF_LINK_COMMAND_SPEC
+
+0.2.8 Magnus Granberg <zorry@ume.nu>
+
+ * gcc/configure removed check crtbeginTS.o
+ * gcc/espf.h added notes
+ add ESPF_CC1_SPEC
+ removed ESPF_CPP_UNIQUE_OPTIONS espf_override_options()
+ * gcc/gcc.c cc1_spec Set it to CC1_SPEC if ! ENABLE_ESPF
+ * gcc/toplev.c removed ESPF_OVERRIDE_OPTIONS
+
+0.2.7 Magnus Granberg <zorry@ume.nu>
+
+ * gcc/opts.c (decode_options): Remove flag_strict_overflow as opt2
+ * gcc/config.in removed HAVE_CRTBEGINTS
+ * gcc/Makefile removed crtbeginTS.o
+ * libgcc/Makefile.in removed crtbeginTS.o
+ * gcc/config/i386/i386.h removed espf_override_options ESPF_EXTRA_SPECS
+ * gcc/config/linux.h remoevd crtbeginTS.o
+ * gcc/espf.h ESPF_CC1_OPTIONS_PIE_SPEC renamed to ESPF_CC1_COMMAND_SPEC
+ * gcc/gcc.c add ESPF_EXTRA_SPECS
+ main() add do_self_spec (espf_cc1_command_spec)
+
+0.2.6 Magnus Granberg <zorry@ume.nu>
+
+ * gcc/config/i386/i386.h add espf_override_options() to OVERRIDE_OPTIONS
+ * gcc/espf.h add espf_override_options()
+ * gcc/toplev.c add ESPF_OVERRIDE_OPTIONS
+
+0.2.5 Magnus Granberg <zorry@ume.nu>
+
+ * gcc/config/i386/i386.h removed espf_cc1
+ * gcc/config/i386/linux.h removed espf_cc1 %(crtend_gen)
+ * gcc/config/i386/x86-64.h removed espf_cc1 %(crtend_gen)
+ * gcc/config/linux.h removed espf_cc1 %(crtfile_gen)
+ %(crtbegin_t_gen) %(crtend_gen)
+ add crtbeginTS.o
+ * gcc/config.in removed TARGET_LIBC_PROVIDES_PIE
+ add HAVE_CRTBEGINTS
+ * gcc/Makefile.in add ESPF_NOPIE_CFLAGS ESPF_NOSSP_CFLAGS to
+ CRTSTUFF_T_CFLAGS
+ add ESPF_NOSSP_CFLAGS to CRTSTUFF_T_CFLAGS_S
+ * espf.h ESPF_CC1_SPEC renamed to ESPF_CC1_OPTIONS_SPEC
+ add ESPF_LINK_SPEC
+ ESPF_CC1_SSP_SPEC renamed to ESPF_CC1_OPTIONS_SSP_SPEC
+ ESPF_CC1_PIE_SPEC renamed to ESPF_CC1_OPTIONS_PIE_SPEC
+ ESPF_CC1_OPTIONS_SPEC renamed to ESPF_CC1_OPTIONS_PIE_INCOMPATIBLE_SPEC
+ LINK_PIE_SPEC renamed to ESPF_LINK_COMMAND_SPEC
+ removed ESPF_CC1_STRICT_SPEC CRTFILE_GEN_SPEC CRTBEGIN_GEN_SPEC
+ CRTBEGIN_T_GEN_SPEC CRTEND_GEN_SPEC
+ * gcc/configure remove TARGET_LIBC_PROVIDES_PIE
+ define HAVE_CRTBEGINTS
+ * gcc/gcc.c LINK_COMMAND_SPEC add %(espf_link)
+ main() add do_self_spec (espf_link_command_spec)
+
+0.2.4 Magnus Granberg <zorry@ume.nu>
+
+ libgcc/Makefile.in clean specs
+
+0.2.3 Magnus Granberg <zorry@ume.nu>
+
+ *gcc/espf.h add ESPF_CC1_STRICT_SPEC
+
+0.2.2 Magnus Granberg <zorry@ume.nu>
+
+ * gcc/config/i386/i386.h Add espf_cc1
+ Add ESPF_EXTRA_SPECS
+ * gcc/config/i386/linux.h Add espf_cc1
+ * gcc/config/i386/x86-64.h Add espf_cc1
+ * gcc/config/linux.h Add espf_cc1
+ * gcc/Makefile.in add crtbeginTS.o to EXTRA_PARTS list
+ * libgcc/Makefile.in add crtbeginTS.o to EXTRA_PARTS list
+ * gcc/configure add define ENABLE_LIBSSP
+ * gcc/gcc.c %(fortify_default) renamed to %(espf_cpp_unique_options)
+ %(pie_incompatible) renamed to %(espf_cc1_options)
+ removed ESPF_EXTRA_SPECS
+ * gcc/espf.h ESPF_DEFAULT_SPEC renamed to ESPF_CC1_SPEC
+ SSP_DEFAULT_SPEC renamed to ESPF_CC1_SSP_SPEC
+ FORTIFY_DEFAULT_SPEC renamed to ESPF_CPP_UNIQUE_OPTIONS
+ PIE_DEFAULT_SPEC renamed to ESPF_CC1_PIE_SPEC
+ PIE_INCOMPATIBLE_SPEC renamed to ESPF_CC1_OPTIONS_SPEC
+ add new CRTFILE_GEN_SPEC CRTBEGIN_T_GEN_SPEC CRTEND_GEN_SPEC if !
+ TARGET_LIBC_PROVIDES_PIE
+
+4.4.0-espf-0.2.1 Magnus Granberg <zorry@ume.nu>
+
+ * gcc/gcc.c include: espf.h
+ cc1_spec = CC1_SPEC if not ENABLE_ESPF
+ cpp_unique_options add %(fortify_default)
+ cc1_options add %(pie_incompatible)
+ EXTRA_SPECS add ESPF_EXTRA_SPECS
+ * libgcc/Makefile.in add crtbeginTs.o
+ gcc/Makefile.in add ESPF_NOPIE_CFLAGS and ESPF_NOSSP_CFLAGS
+ LIBGCC2_CFLAGS add ESPF_NOSSP_CFLAGS
+ CRTSTUFF_CFLAGS add ESPF_NOPIE_CFLAGS and ESPF_NOSSP_CFLAGS
+ crtbegin* add crtbeginTS
+ $(out_object_file): ix86_split_to_parts() stack smashing attack b.g.o #149292
+ * libgcc/configure add enable_espf
+ * gcc/config/linux.h add %(crtfile_gen) %(crtbegin_t_gen) %(crtend_gen)
+ * gcc/config/i386/linux.h add %(crtend_gen)
+ * gcc/config/i386/linux64.h add %(crtend_gen)
+ * gcc/config.gcc extra_parts add crtbeginTS.o
+ * libgcc/config.host extra_parts add crtbeginTS.o
+ * gcc/configure check -z relro
+ check -z now
+ check FORTIFY_SOURCES level 2
+ check Scrt1.o
+ check --enable-espf
+ check crtbeginTS.o
+ * gcc/espf.h new file
+ * gcc/varasm.c (decl_tls_model): Check flag_pic instead of flag_shlib
+ * gcc/config.in add ENABLE_LIBSSP
+ add ENABLE_ESPF
+ add TARGET_LIBC_PROVIDES_FORTIFY2
+ add TARGET_LIBC_PROVIDES_PIE
+ * configure define ENABLE_LIBSSP
+
+gcc-4.3.3-piepatches-v10.2.1
diff --git a/src/patchsets/gcc/5.3.0/pie/README.history b/src/patchsets/gcc/5.3.0/pie/README.history
new file mode 100644
index 0000000000..ef23f52fd4
--- /dev/null
+++ b/src/patchsets/gcc/5.3.0/pie/README.history
@@ -0,0 +1,363 @@
+0.6.5 27 Oct 2015
+ U 24_all_gcc49_invoke.texi.patch
+0.6.4 29 Aug 2015
+ U 35_all_gcc51_config_arm.patch
+ U 40_all_gcc49_config_esp.patch
+0.6.3 26 Apr 2015
+ + 01_all_gcc51_configure.patch
+ - 01_all_gcc49_configure.patch
+ + 03_all_gcc51_Makefile.in.patch
+ - 03_all_gcc49_Makefile.in.patch
+ + 34_all_gcc51_config_i386.patch
+ - 34_all_gcc48_config_i386.patch
+ + 35_all_gcc51_config_arm.patch
+ + 35_all_gcc48_config_arm.patch
+ + 36_all_gcc51_config_mips.patch
+ + 36_all_gcc48_config_mips.patch
+0.6.2 5 Jan 2015
+ U 03_all_gcc49_Makefile.in.patch
+0.6.1 07 Jun 2014
+ U 33_all_gcc48_config_rs6000.patch
+0.6.0 12 May 2014
+ + 01_all_gcc49_configure.patch
+ - 01_all_gcc48_configure.patch
+ + 03_all_gcc49_Makefile.in.patch
+ - 03_all_gcc48_Makefile.in.patch
+ + 20_all_gcc49_config_crtbeginp.patch
+ - 20_all_gcc46_config_crtbeginp.patch
+ + 24_all_gcc49_invoke.texi.patch
+ - 24_all_gcc48_invoke.texi.patch
+ +35_all_gcc49_config_esp.h.patch
+ - 35_all_gcc48_config_esp.h.patch
+ U README
+0.5.9 4 Jan 2014
+ U 01_all_gcc48_configure.patch
+ U 03_all_gcc48_Makefile.in.patch
+ U 05_all_gcc48_gcc.c.patch
+ - 24_all_gcc44_invoke.texi.patch
+ + 24_all_gcc48_invoke.texi.patch
+ U README
+0.5.8 11 Nov 2013
+ U 33_all_gcc48_config_rs6000.patch
+0.5.7 10 Jul 2013
+ U 35_all_gcc48_config_esp.h.patch
+ - 15_all_gcc44_decl-tls-model.patch
+0.5.6 03 Jun 2013
+ U 35_all_gcc48_config_arm.patch
+ U 37_all_gcc48_config_ia64.patch
+0.5.5 31 Mar 2013
+ - 01_all_gcc47_configure.patch
+ + 01_all_gcc48_configure.patch
+ - 02_all_gcc47_config.in.patch
+ + 02_all_gcc48_config.in.patch
+ - 03_all_gcc47_Makefile.in.patch
+ + 03_all_gcc48_Makefile.in.patch
+ - 05_all_gcc47_gcc.c.patch
+ + 05_all_gcc48_gcc.c.patch
+ - 33_all_gcc46_config_rs6000_linux64.h.patch
+ + 33_all_gcc48_config_rs6000.patch
+ - 34_all_gcc47_config_all_gnu_user.patch
+ + 34_all_gcc48_config_i386.patch
+ + 35_all_gcc48_config_arm.patch
+ + 36_all_gcc48_config_mips.patch
+ + 37_all_gcc48_config_ia64.patch
+ - 35_all_gcc47_config_esp.h.patch
+ - 35_all_gcc48_config_esp.h.patch
+ U README
+0.5.4 02 Oct 2012
+ U 01_all_gcc47_configure.patch
+ + 01_all_gcc47_configure.ac.patch
+0.5.3 06 Apr 2012
+ U 01_all_gcc47_configure.patch
+ + 02_all_gcc47_config.in.patch
+ - 02_all_gcc45_config.in.patch
+ + 06_all_gcc46_esp.h.patch
+ - 06_all_gcc45_esp.h.patch
+0.5.2 24 Jan 2012
+ + 16_all_gcc47_nopie_option.patch
+0.5.1 17 Jan 2012
+ + 01_all_gcc47_configure.patch
+ - 10_all_gcc45_configure.patch
+ + 03_all_gcc47_Makefile.in.patch
+ - 12_all_gcc46_Makefile.in.patch
+ + 02_all_gcc45_config.in.patch
+ - 11_all_gcc45_config.in.patch
+ + 05_all_gcc46_gcc.c.patch
+ - 20_all_gcc46_gcc.c.patch
+ + 06_all_gcc45_esp.h.patch
+ - 30_all_gcc45_esp.h.patch
+ + 10_all_gcc46_default-ssp.patch
+ - 22_all_gcc46-default-ssp.patch
+ + 15_all_gcc44_decl-tls-model.patch
+ - 21_all_gcc44_decl-tls-model.patch
+ + 20_all_gcc46_config_crtbeginp.patch
+ - 35_all_gcc46_config_crtbegints.patch
+ + 24_all_gcc44_invoke.texi.patch
+ + 60_all_gcc44_invoke.texi.patch
+0.5.0 07 Dec 2011
+ + 35_all_gcc46_config_crtbeginp.patch
+ - 35_all_gcc46_config_crtbegints.patch
+ U 10_all_gcc45_configure.patch
+ U 12_all_gcc46_Makefile.in.patch
+ + 11_all_gcc45_config.in.patch
+ - 11_all_gcc44_config.in.patch
+ + 30_all_gcc45_esp.h.patch
+ - 30_all_gcc44_esp.h.patch
+0.4.9 09 Nov 2011
+ U 12_all_gcc46_Makefile.in.patch
+0.4.8 26 Mar 2011
+ U 22_all_gcc46-default-ssp.patch
+0.4.7 05 Mar 2011
+ U 20_all_gcc46_gcc.c.patch
+ + 22_all_gcc46-default-ssp.patch
+ - 30_all_gcc46_esp.h.patch
+ + 30_all_gcc44_esp.h.patch
+ U 33_all_gcc46_config_rs6000_linux64.h.patch
+ U 35_all_gcc46_config_crtbegints.patch
+0.4.6 07 Jan 2011
+ + 12_all_gcc46_Makefile.in.patch
+ - 12_all_gcc44_Makefile.in.patch
+ + 20_all_gcc46_gcc.c.patch
+ - 20_all_gcc44_gcc.c.patch
+ + 30_all_gcc46_esp.h.patch
+ - 30_all_gcc44_esp.h.patch
+ + 33_all_gcc46_config_rs6000_linux64.h.patch
+ - 33_all_gcc45_config_rs6000_linux64.h.patch
+ + 35_all_gcc46_config_crtbegints.patch
+ - 35_all_gcc44_config_crtbegints.patch
+ - 40_all_gcc44_obj_lang-specs.h.patch
+ - 40_all_gcc44_objp_lang-specs.h.patch
+ - 40_all_gcc44_cp_lang-specs.h.patch
+0.4.5 18 Jun 2010
+ U 35_all_gcc44_config_crtbegints.patch
+0.4.4 26 May 2010
+ U 30_all_gcc44_esp.h.patch
+0.4.3 26 May 2010
+ U 20_all_gcc44_gcc.c.patch
+ U 30_all_gcc44_esp.h.patch
+0.4.2 24 May 2010
+ U 10_all_gcc44_configure.patch
+ U 12_all_gcc44_Makefile.in.patch
+ U 11_all_gcc44_config.in.patch
+ U 30_all_gcc44_esp.h.patch
+0.4.1 29 Apr 2010
+ U 10_all_gcc45_configure.patch
+ U 12_all_gcc45_Makefile.in.patch
+ U 11_all_gcc44_config.in.patch
+ U 30_all_gcc44_esp.h.patch
+
+0.4.0 19 Apr 2010
+ U 10_all_gcc45_configure.patch
+ U 12_all_gcc45_Makefile.in.patch
+ U 11_all_gcc44_config.in.patch
+ U 20_all_gcc45_gcc.c.patch
+ - 30_all_gcc44_espf.h.patch
+ + 30_all_gcc44_esp.h.patch
+
+0.3.9 14 Apr 2010
+ U 10_all_gcc45_configure.patch
+ - 50_all_gcc44_no_ssp_tls_uclibc.patch
+ U 33_all_gcc45_config_rs6000_linux64.h.patch
+
+0.3.8 10 Apr 2010
+ 10_all_gcc44_configure.patch
+ 11_all_gcc44_config.in.patch
+ 20_all_gcc44_gcc.c.patch
+ 30_all_gcc44_espf.h.patch
+
+0.3.7 10 Feb 2010
+ 20_all_gcc44_gcc.c.patch
+ 30_all_gcc44_espf.h.patch
+ 10_all_gcc44_configure.patch
+
+0.3.6 23 Dec 2009
+ - 10_all_gcc44_configure.patch
+ + 10_all_gcc44_configure.patch
+ - 30_all_gcc44_espf.h.patch
+ + 30_all_gcc44_espf.h.patch
+ - README.Changelog
+ + README.Changelog
+ - README.history
+ + README.history
+ - README
+ + README
+
+0.3.5 24 Sep 2009
+ - 30_all_gcc44_espf.h.patch
+ + 30_all_gcc44_espf.h.patch
+ - 35_all_gcc44_config_crtbegints.patch
+ + 35_all_gcc44_config_crtbegints.patch
+ + 33_all_gcc44_config_rs6000_linux64.h.patch
+ - README.Changelog
+ + README.Changelog
+ - README.history
+ + README.history
+ + README.Gentoo.patches
+
+0.3.4 11 Sep 2009
+ - 10_all_gcc44_configure.patch
+ + 10_all_gcc44_configure.patch
+ - 11_all_gcc44_config.in.patch
+ + 11_all_gcc44_config.in.patch
+ - 12_all_gcc44_Makefile.in.patch
+ + 12_all_gcc44_Makefile.in.patch
+ - 20_all_gcc44_gcc.c.patch
+ + 20_all_gcc44_gcc.c.patch
+ - 23_all_gcc44_opts.c.patch
+ - 30_all_gcc44_espf.h.patch
+ + 30_all_gcc44_espf.h.patch
+ + 35_all_gcc44_config_crtbegints.patch
+ + 60_all_gcc44_invoke.texi.patch
+ - README.Changelog
+ + README.Changelog
+ - README.history
+ + README.history
+ - README
+ + README
+
+0.3.3 14 Aug 2009
+ - 23_all_gcc44_opts.c.patch
+ + 23_all_gcc44_opts.c.patch
+
+0.3.2 09 Aug 2009
+ + 50_all_gcc44_no_ssp_tls_uclibc.patch
+ + README.Changelog
+ + README.history
+ - 23_all_gcc44_opts.c.patch
+ + 23_all_gcc44_opts.c.patch
+ - 30_all_gcc44-espf.h.patch
+ + 30_all_gcc44-espf.h.patch
+
+0.3.1 23 Jul 2009
+ - 10_all_gcc44_configure.patch
+ + 10_all_gcc44_configure.patch
+
+0.3.0 23 Jul 2009
+ - 10_all_gcc44_configure.patch
+ + 10_all_gcc44_configure.patch
+ - 11_all_gcc44_config.in.patch
+ + 11_all_gcc44_config.in.patch
+ - 12_all_gcc44_Makefile.in.patch
+ + 12_all_gcc44_Makefile.in.patch
+ - 20_all_gcc44_gcc.c.patch
+ + 20_all_gcc44_gcc.c.patch
+ + 40_all_gcc44_obj_lang-specs.h.patch
+ + 40_all_gcc44_objp_lang-specs.h.patch
+ + 40_all_gcc44_cp_lang-specs.h.patch
+ - 50_all_gcc44_gentoo_v20090614.1.patch
+ - 30_all_gcc44-espf.h.patch
+ + 30_all_gcc44-espf.h.patch
+
+0.2.9 14 Jun 2009
+ - 12_all_gcc44_Makefile.in.patch
+ + 12_all_gcc44_Makefile.in.patch
+ - 30_all_gcc44-espf.h.patch
+ + 30_all_gcc44-espf.h.patch
+ - 50_all_gcc44_gentoo_v20090612.2.patch
+ + 50_all_gcc44_gentoo_v20090614.1.patch
+
+0.2.8 12 Jun 2009
+ - 10_all_gcc44_configure.patch
+ + 10_all_gcc44_configure.patch
+ - 11_all_gcc44_config.in.patch
+ + 11_all_gcc44_config.in.patch
+ - 12_all_gcc44_Makefile.in.patch
+ + 12_all_gcc44_Makefile.in.patch
+ - 22_all_gcc44-toplev.c.patch
+ - 25_all_gcc44-espf.h.patch
+ + 30_all_gcc44-espf.h.patch
+ + 50_all_gcc44_gentoo_v20090612.2.patch
+
+0.2.7 29 May 2009
+ - 11_all_gcc44_config.in.patch
+ + 11_all_gcc44_config.in.patch
+ - 12_all_gcc44_Makefile.in.patch
+ + 12_all_gcc44_Makefile.in.patch
+ - 20_all_gcc44_gcc.c.patch
+ + 20_all_gcc44_gcc.c.patch
+ + 23_all_gcc44_opts.c.patch
+ - 25_all_gcc44-espf.h.patch
+ + 25_all_gcc44-espf.h.patch
+ - 30_all_gcc44-config-defaul-linux.patch
+
+0.2.6 28 May 2009
+ + 22_all_gcc44-toplev.c.patch
+ - 25_all_gcc44-espf.h.patch
+ + 25_all_gcc44-espf.h.patch
+ - 30_all_gcc44-config-defaul-linux.patch
+ + 30_all_gcc44-config-defaul-linux.patch
+
+0.2.5 27 May 2009
+ - 10_all_gcc44_configure.patch
+ + 10_all_gcc44_configure.patch
+ - 12_all_gcc44_Makefile.in.patch
+ + 12_all_gcc44_Makefile.in.patch
+ - 20_all_gcc44_gcc.c.patch
+ + 20_all_gcc44_gcc.c.patch
+ - 25_all_gcc44-espf.h.patch
+ + 25_all_gcc44-espf.h.patch
+ - 30_all_gcc44-config-defaul-linux.patch
+ + 30_all_gcc44-config-defaul-linux.patch
+ - 40_all_gcc44-gentoo.patch
+
+0.2.4 08 May 2009
+ - 12_all_gcc44_Makefile.in.patch
+ + 12_all_gcc44_Makefile.in.patch
+
+0.2.3 08 May 2009
+ - 20_all_gcc44_gcc.c.patch
+ + 20_all_gcc44_gcc.c.patch
+ - 40_all_gcc44-gentoo.patch
+ + 40_all_gcc44-gentoo.patch
+
+0.2.2 04 May 2009
+ + 10_all_gcc44_configure.patch
+ + 11_all_gcc44_config.in.patch
+ + 12_all_gcc44_Makefile.in.patch
+ + 20_all_gcc44_gcc.c.patch
+ + 21_all_gcc44_decl-tls-model.patch
+ + 25_all_gcc44-espf.h.patch
+ + 30_all_gcc44-config-defaul-linux.patch
+ + 40_all_gcc44-gentoo.patch
+ - 01_all_gcc44-configure.patch
+ - 10_all_gcc44-gcc_configure.patch
+ - 11_all_gcc44-gcc_config.in.patch
+ - 12_all_gcc44-gcc_config.gcc.patch
+ - 13_all_gcc44-gcc_Makefile.in.patch
+ - 15_all_gcc44-libgcc_config.host.patch
+ - 16_all_gcc44-libgcc_configure.patch
+ - 17_all_gcc44-libgcc_Makefile.in.patch
+ - 21_all_gcc44-gcc_espf.h.patch
+ - 22_all_gcc44-gcc_gcc.c.patch
+ - 23_all_gcc44-gcc_varasm.c.patch
+ - 30_all_gcc44-add-crt-start-endfiles-linux.patch
+
+0.2.1 28 Apr 2009
+ + 01_all_gcc44-configure.patch
+ + 10_all_gcc44-gcc_configure.patch
+ + 11_all_gcc44-gcc_config.in.patch
+ + 12_all_gcc44-gcc_config.gcc.patch
+ + 13_all_gcc44-gcc_Makefile.in.patch
+ + 15_all_gcc44-libgcc_config.host.patch
+ + 16_all_gcc44-libgcc_configure.patch
+ + 17_all_gcc44-libgcc_Makefile.in.patch
+ + 21_all_gcc44-gcc_espf.h.patch
+ + 22_all_gcc44-gcc_gcc.c.patch
+ + 23_all_gcc44-gcc_varasm.c.patch
+ + 30_all_gcc44-add-crt-start-endfiles-linux.patch
+ - 00_all_gcc4.4-cvs-incompat.patch
+ - 05_all_gcc4.4-compile-no-ssp.patch
+ - 10_all_gcc4.4-hardened-minispecs-support.patch
+ - 11_all_gcc4.4-decl-tls-model.patch
+ - 12_all_gcc4.4-fortify-minispecs-support.patch
+ - 20-all_gcc4.4-default-crt-start-endfile.patch
+ - 30-all_gcc4.4-crtbeginTS-fno-PIE.patch
+
+0.1.0 16 Apr 2009
+ + 00_all_gcc4.4-cvs-incompat.patch
+ + 05_all_gcc4.4-compile-no-ssp.patch
+ + 10_all_gcc4.4-hardened-minispecs-support.patch
+ + 11_all_gcc4.4-decl-tls-model.patch
+ + 12_all_gcc4.4-fortify-minispecs-support.patch
+ + 20-all_gcc4.4-default-crt-start-endfile.patch
+ + 30-all_gcc4.4-crtbeginTS-fno-PIE.patch
diff --git a/src/patchsets/gcc/5.3.0/uclibc/90_all_100-uclibc-conf.patch b/src/patchsets/gcc/5.3.0/uclibc/90_all_100-uclibc-conf.patch
new file mode 100644
index 0000000000..3460f9e505
--- /dev/null
+++ b/src/patchsets/gcc/5.3.0/uclibc/90_all_100-uclibc-conf.patch
@@ -0,0 +1,33 @@
+--- gcc/contrib/regression/objs-gcc.sh
++++ gcc/contrib/regression/objs-gcc.sh
+@@ -105,6 +105,10 @@
+ then
+ make all-gdb all-dejagnu all-ld || exit 1
+ make install-gdb install-dejagnu install-ld || exit 1
++elif [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-uclibc ]
++ then
++ make all-gdb all-dejagnu all-ld || exit 1
++ make install-gdb install-dejagnu install-ld || exit 1
+ elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then
+ make bootstrap || exit 1
+ make install || exit 1
+--- gcc/libjava/classpath/ltconfig
++++ gcc/libjava/classpath/ltconfig
+@@ -603,7 +603,7 @@
+
+ # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
+ case $host_os in
+-linux-gnu*) ;;
++linux-gnu*|linux-uclibc*) ;;
+ linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
+ esac
+
+@@ -1251,7 +1251,7 @@
+ ;;
+
+ # This must be Linux ELF.
+-linux-gnu*)
++linux*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
diff --git a/src/patchsets/gcc/5.3.0/uclibc/90_all_301-missing-execinfo_h.patch b/src/patchsets/gcc/5.3.0/uclibc/90_all_301-missing-execinfo_h.patch
new file mode 100644
index 0000000000..0e2092f3fb
--- /dev/null
+++ b/src/patchsets/gcc/5.3.0/uclibc/90_all_301-missing-execinfo_h.patch
@@ -0,0 +1,11 @@
+--- gcc-4.0.0/boehm-gc/include/gc.h-orig 2005-04-28 22:28:57.000000000 -0500
++++ gcc-4.0.0/boehm-gc/include/gc.h 2005-04-28 22:30:38.000000000 -0500
+@@ -500,7 +500,7 @@
+ #ifdef __linux__
+ # include <features.h>
+ # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \
+- && !defined(__ia64__)
++ && !defined(__ia64__) && !defined(__UCLIBC__)
+ # ifndef GC_HAVE_BUILTIN_BACKTRACE
+ # define GC_HAVE_BUILTIN_BACKTRACE
+ # endif
diff --git a/src/patchsets/gcc/5.3.0/uclibc/90_all_302-c99-snprintf.patch b/src/patchsets/gcc/5.3.0/uclibc/90_all_302-c99-snprintf.patch
new file mode 100644
index 0000000000..ba51a0e1d4
--- /dev/null
+++ b/src/patchsets/gcc/5.3.0/uclibc/90_all_302-c99-snprintf.patch
@@ -0,0 +1,13 @@
+Index: gcc-4.3.0/libstdc++-v3/include/c_global/cstdio
+===================================================================
+--- gcc-4.3.0/libstdc++-v3/include/c_global/cstdio (revision 129202)
++++ gcc-4.3.0/libstdc++-v3/include/c_global/cstdio (working copy)
+@@ -144,7 +144,7 @@
+
+ _GLIBCXX_END_NAMESPACE
+
+-#if _GLIBCXX_USE_C99
++#if _GLIBCXX_USE_C99 || defined __UCLIBC__
+
+ #undef snprintf
+ #undef vfscanf