glibc-no-pie.patch 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. diff -ruNp glibc-2.19.old/config.make.in glibc-2.19/config.make.in
  2. --- glibc-2.19.old/config.make.in 2018-08-24 13:30:14.939687483 -0700
  3. +++ glibc-2.19/config.make.in 2018-08-24 13:57:37.098712466 -0700
  4. @@ -83,6 +83,7 @@ nss-crypt = @libc_cv_nss_crypt@
  5. # Configuration options.
  6. build-shared = @shared@
  7. build-pic-default= @libc_cv_pic_default@
  8. +build-pie-default= @libc_cv_pie_default@
  9. build-profile = @profile@
  10. build-static-nss = @static_nss@
  11. add-ons = @add_ons@
  12. diff -ruNp glibc-2.19.old/configure glibc-2.19/configure
  13. --- glibc-2.19.old/configure 2018-08-24 13:30:15.335684965 -0700
  14. +++ glibc-2.19/configure 2018-08-24 14:09:29.444245054 -0700
  15. @@ -577,6 +577,7 @@ DEFINES
  16. static_nss
  17. profile
  18. libc_cv_pic_default
  19. +libc_cv_pie_default
  20. shared
  21. static
  22. ldd_rewrite_script
  23. @@ -7475,7 +7476,24 @@ $as_echo "$libc_cv_pic_default" >&6; }
  24. -
  25. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -fPIE is default" >&5
  26. +$as_echo_n "checking whether -fPIE is default... " >&6; }
  27. +if ${libc_cv_pie_default+:} false; then :
  28. + $as_echo_n "(cached) " >&6
  29. +else
  30. + libc_cv_pie_default=yes
  31. +cat > conftest.c <<EOF
  32. +#if defined __PIE__ || defined __pie__ || defined PIE || defined pie
  33. +# error PIE is default.
  34. +#endif
  35. +EOF
  36. +if eval "${CC-cc} -S conftest.c 2>&5 1>&5"; then
  37. + libc_cv_pie_default=no
  38. +fi
  39. +rm -f conftest.*
  40. +fi
  41. +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_pie_default" >&5
  42. +$as_echo "$libc_cv_pie_default" >&6; }
  43. diff -ruNp glibc-2.19.old/configure.ac glibc-2.19/configure.ac
  44. --- glibc-2.19.old/configure.ac 2018-08-24 13:30:14.939687483 -0700
  45. +++ glibc-2.19/configure.ac 2018-08-24 14:01:45.041985550 -0700
  46. @@ -2160,6 +2160,19 @@ fi
  47. rm -f conftest.*])
  48. AC_SUBST(libc_cv_pic_default)
  49. +AC_CACHE_CHECK([whether -fPIE is default], libc_cv_pie_default,
  50. +[libc_cv_pie_default=yes
  51. +cat > conftest.c <<EOF
  52. +#if defined __PIE__ || defined __pie__ || defined PIE || defined pie
  53. +# error PIE is default.
  54. +#endif
  55. +EOF
  56. +if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
  57. + libc_cv_pie_default=no
  58. +fi
  59. +rm -f conftest.*])
  60. +AC_SUBST(libc_cv_pie_default)
  61. +
  62. AC_SUBST(profile)
  63. AC_SUBST(static_nss)
  64. diff -ruNp glibc-2.19.old/Makeconfig glibc-2.19/Makeconfig
  65. --- glibc-2.19.old/Makeconfig 2018-08-24 13:30:15.331684992 -0700
  66. +++ glibc-2.19/Makeconfig 2018-08-24 14:09:01.436358826 -0700
  67. @@ -424,6 +424,9 @@ ifndef +link-static
  68. endif
  69. # Commands for linking programs with the C library.
  70. ifndef +link
  71. +ifeq (yes,$(build-pie-default))
  72. +LDFLAGS += -no-pie
  73. +endif
  74. ifeq (yes,$(build-shared))
  75. +link-before-libc = $(CC) -nostdlib -nostartfiles -o $@ \
  76. $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \