0006-defaultpie.diff 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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"
  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. diff --git a/gcc/gcc.c b/gcc/gcc.c
  18. index 41d17a5..b9bbcb6 100644
  19. --- a/gcc/gcc.c
  20. +++ b/gcc/gcc.c
  21. @@ -846,8 +846,16 @@ static const char *const multilib_defaults_raw[] = MULTILIB_DEFAULTS;
  22. #define GOMP_SELF_SPECS "%{fopenmp: -pthread}"
  23. #endif
  24. +#ifndef PIE_SELF_SPECS
  25. +#ifdef ENABLE_DEFAULT_PIE
  26. +#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}"
  27. +#else
  28. +#define PIE_SELF_SPECS ""
  29. +#endif
  30. +#endif
  31. +
  32. static const char *const driver_self_specs[] = {
  33. - DRIVER_SELF_SPECS, GOMP_SELF_SPECS
  34. + DRIVER_SELF_SPECS, GOMP_SELF_SPECS, PIE_SELF_SPECS
  35. };
  36. #ifndef OPTION_DEFAULT_SPECS