1
0
mirror of https://github.com/pmmp/musl-cross-make.git synced 2024-11-24 10:46:11 +00:00
musl-cross-make/patches/gcc-4.2.1/0006-defaultpie.diff
Rich Felker 06a1f34243 add support for gcc 4.2.1 (last gplv2 version)
patch set consists of:

0001 full musl libc target support
0002 fixes for wrong optimizations of weak defs/aliases
0003 various sh breakage in configure scripts
0005 static pie support
0006 --enable-default-pie support
0008 fix for cross compiling bug in build system
0009 fix for wrong default div strategy for sh2 (missing libgcc code)
0010 fix failure to build on modern host gcc due to gnu-inline
0011 fix sh & alpha bootstrap failures before libc is built
0012 fix broken local-exec TLS with -fPIE on sh
2015-11-06 06:23:54 +00:00

40 lines
1.0 KiB
Diff

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"
+ ;;
+esac
+
t=
all_defaults="abi cpu arch tune schedule float mode fpu divide"
for option in $all_defaults
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 41d17a5..b9bbcb6 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -846,8 +846,16 @@ static const char *const multilib_defaults_raw[] = MULTILIB_DEFAULTS;
#define GOMP_SELF_SPECS "%{fopenmp: -pthread}"
#endif
+#ifndef PIE_SELF_SPECS
+#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[] = {
- DRIVER_SELF_SPECS, GOMP_SELF_SPECS
+ DRIVER_SELF_SPECS, GOMP_SELF_SPECS, PIE_SELF_SPECS
};
#ifndef OPTION_DEFAULT_SPECS