0006-defaultpie.diff 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. diff --git a/gcc/config.gcc b/gcc/config.gcc
  2. index 3779369..a6d95ca 100644
  3. --- a/gcc/config.gcc
  4. +++ b/gcc/config.gcc
  5. @@ -3101,6 +3101,12 @@ case ${target} in
  6. ;;
  7. esac
  8. +case "x${enable_default_pie}" in
  9. +xyes)
  10. + tm_defines="${tm_defines} ENABLE_DEFAULT_PIE=1"
  11. + ;;
  12. +esac
  13. +
  14. t=
  15. all_defaults="abi cpu arch tune schedule float mode fpu divide"
  16. for option in $all_defaults
  17. --- gcc-5.2.0.orig/gcc/gcc.c 2015-03-10 09:37:41.000000000 +0000
  18. +++ gcc-5.2.0/gcc/gcc.c 2015-08-25 07:47:12.895060530 +0000
  19. @@ -1012,10 +1012,19 @@
  20. #define CILK_SELF_SPECS "%{fcilkplus: -pthread}"
  21. #endif
  22. +/* Default to PIE */
  23. +#ifndef PIE_SELF_SPECS
  24. +#ifdef ENABLE_DEFAULT_PIE
  25. +#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}"
  26. +#else
  27. +#define PIE_SELF_SPECS ""
  28. +#endif
  29. +#endif
  30. +
  31. static const char *const driver_self_specs[] = {
  32. "%{fdump-final-insns:-fdump-final-insns=.} %<fdump-final-insns",
  33. DRIVER_SELF_SPECS, CONFIGURE_SPECS, GOMP_SELF_SPECS, GTM_SELF_SPECS,
  34. - CILK_SELF_SPECS
  35. + CILK_SELF_SPECS, PIE_SELF_SPECS
  36. };
  37. #ifndef OPTION_DEFAULT_SPECS