diff --git a/config.mak.dist b/config.mak.dist index abe3fd5..5e26fe7 100644 --- a/config.mak.dist +++ b/config.mak.dist @@ -15,3 +15,7 @@ GCC_VER = 5.2.0 # GCC_CONFIG += --with-cpu=mj2 # GCC_CONFIG += --enable-fdpic + +# Options for using (plain, non-FDPIC) ELF on NOMMU targets + +# GCC_CONFIG += --enable-default-pie diff --git a/patches/gcc-5.2.0/0006-defaultpie.diff b/patches/gcc-5.2.0/0006-defaultpie.diff index 421b98b..b040441 100644 --- a/patches/gcc-5.2.0/0006-defaultpie.diff +++ b/patches/gcc-5.2.0/0006-defaultpie.diff @@ -1,12 +1,33 @@ +diff --git a/gcc/config.gcc b/gcc/config.gcc +index 3779369..a6d95ca 100644 +--- a/gcc/config.gcc ++++ b/gcc/config.gcc +@@ -3101,6 +3101,12 @@ case ${target} in + ;; + esac + ++case "x${enable_default_pie}" in ++xyes) ++ tm_defines="${tm_defines} ENABLE_DEFAULT_PIE=1" ++ ;; ++esac ++ + t= + all_defaults="abi cpu arch tune schedule float mode fpu divide" + for option in $all_defaults --- gcc-5.2.0.orig/gcc/gcc.c 2015-03-10 09:37:41.000000000 +0000 +++ gcc-5.2.0/gcc/gcc.c 2015-08-25 07:47:12.895060530 +0000 -@@ -1012,10 +1012,15 @@ +@@ -1012,10 +1012,19 @@ #define CILK_SELF_SPECS "%{fcilkplus: -pthread}" #endif +/* Default to PIE */ +#ifndef PIE_SELF_SPECS -+#define PIE_SELF_SPECS "%{shared|pie|r|nostdlib|nopie:;:-pie} %{fpic|fPIC|fpie|fPIE|fno-pic|fno-PIC|fno-pie|fno-PIE|D__KERNEL__:;:-fPIE}" ++#ifdef ENABLE_DEFAULT_PIE ++#define PIE_SELF_SPECS "%{shared|pie|r|nostdlib|nopie|no-pie:;:-pie} %{fpic|fPIC|fpie|fPIE|fno-pic|fno-PIC|fno-pie|fno-PIE|D__KERNEL__:;:-fPIE}" ++#else ++#define PIE_SELF_SPECS "" ++#endif +#endif + static const char *const driver_self_specs[] = {