Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 1 | From 9815bd97561c778ee0bc0c17f245e88e66570111 Mon Sep 17 00:00:00 2001 |
| 2 | From: sandra <sandra@138bc75d-0d04-0410-961f-82ee72b054a4> |
| 3 | Date: Wed, 1 Nov 2017 02:14:19 +0000 |
| 4 | Subject: [PATCH] 2017-10-31 Sandra Loosemore <sandra@codesourcery.com> |
| 5 | |
| 6 | gcc/ |
| 7 | * configure.ac (--enable-libssp): New. |
| 8 | (gcc_cv_libc_provides_ssp): Check for explicit setting before |
| 9 | trying to determine target-specific default. Adjust indentation. |
| 10 | * configure: Regenerated. |
| 11 | * doc/install.texi (Configuration): Expand --disable-libssp |
| 12 | documentation. |
| 13 | |
| 14 | |
| 15 | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@254288 138bc75d-0d04-0410-961f-82ee72b054a4 |
| 16 | --- |
| 17 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 18 | Upstream-Status: Backport [https://patchwork.ozlabs.org/patch/823049/] |
| 19 | |
| 20 | gcc/ChangeLog | 9 +++++++++ |
| 21 | gcc/configure | 26 +++++++++++++++++++++++--- |
| 22 | gcc/configure.ac | 24 ++++++++++++++++++++---- |
| 23 | gcc/doc/install.texi | 3 ++- |
| 24 | 4 files changed, 54 insertions(+), 8 deletions(-) |
| 25 | |
| 26 | Index: gcc-7.3.0/gcc/configure.ac |
| 27 | =================================================================== |
| 28 | --- gcc-7.3.0.orig/gcc/configure.ac |
| 29 | +++ gcc-7.3.0/gcc/configure.ac |
| 30 | @@ -5719,10 +5719,25 @@ if test x$gcc_cv_solaris_crts = xyes; th |
| 31 | [Define if the system-provided CRTs are present on Solaris.]) |
| 32 | fi |
| 33 | |
| 34 | +AC_ARG_ENABLE(libssp, |
| 35 | +[AS_HELP_STRING([--enable-libssp], [enable linking against libssp])], |
| 36 | +[case "${enableval}" in |
| 37 | + yes|no) |
| 38 | + ;; |
| 39 | + *) |
| 40 | + AC_MSG_ERROR([unknown libssp setting $enableval]) |
| 41 | + ;; |
| 42 | +esac], []) |
| 43 | + |
| 44 | # Test for stack protector support in target C library. |
| 45 | AC_CACHE_CHECK(__stack_chk_fail in target C library, |
| 46 | - gcc_cv_libc_provides_ssp, |
| 47 | - [gcc_cv_libc_provides_ssp=no |
| 48 | + gcc_cv_libc_provides_ssp, |
| 49 | + [gcc_cv_libc_provides_ssp=no |
| 50 | + if test "x$enable_libssp" = "xno"; then |
| 51 | + gcc_cv_libc_provides_ssp=yes |
| 52 | + elif test "x$enable_libssp" = "xyes"; then |
| 53 | + gcc_cv_libc_provides_ssp=no |
| 54 | + else |
| 55 | case "$target" in |
| 56 | *-*-musl*) |
| 57 | # All versions of musl provide stack protector |
| 58 | @@ -5759,8 +5774,9 @@ AC_CACHE_CHECK(__stack_chk_fail in targe |
| 59 | AC_CHECK_FUNC(__stack_chk_fail,[gcc_cv_libc_provides_ssp=yes], |
| 60 | [echo "no __stack_chk_fail on this target"]) |
| 61 | ;; |
| 62 | - *) gcc_cv_libc_provides_ssp=no ;; |
| 63 | - esac]) |
| 64 | + *) gcc_cv_libc_provides_ssp=no ;; |
| 65 | + esac |
| 66 | + fi]) |
| 67 | |
| 68 | if test x$gcc_cv_libc_provides_ssp = xyes; then |
| 69 | AC_DEFINE(TARGET_LIBC_PROVIDES_SSP, 1, |
| 70 | Index: gcc-7.3.0/gcc/doc/install.texi |
| 71 | =================================================================== |
| 72 | --- gcc-7.3.0.orig/gcc/doc/install.texi |
| 73 | +++ gcc-7.3.0/gcc/doc/install.texi |
| 74 | @@ -1658,7 +1658,8 @@ not be built. |
| 75 | |
| 76 | @item --disable-libssp |
| 77 | Specify that the run-time libraries for stack smashing protection |
| 78 | -should not be built. |
| 79 | +should not be built or linked against. On many targets library support |
| 80 | +is provided by the C library instead. |
| 81 | |
| 82 | @item --disable-libquadmath |
| 83 | Specify that the GCC quad-precision math library should not be built. |
| 84 | Index: gcc-7.3.0/gcc/configure |
| 85 | =================================================================== |
| 86 | --- gcc-7.3.0.orig/gcc/configure |
| 87 | +++ gcc-7.3.0/gcc/configure |
| 88 | @@ -940,6 +940,7 @@ enable_fix_cortex_a53_843419 |
| 89 | with_glibc_version |
| 90 | enable_gnu_unique_object |
| 91 | enable_linker_build_id |
| 92 | +enable_libssp |
| 93 | enable_default_ssp |
| 94 | with_long_double_128 |
| 95 | with_gc |
| 96 | @@ -1679,6 +1680,7 @@ Optional Features: |
| 97 | extension on glibc systems |
| 98 | --enable-linker-build-id |
| 99 | compiler will always pass --build-id to linker |
| 100 | + --enable-libssp enable linking against libssp |
| 101 | --enable-default-ssp enable Stack Smashing Protection as default |
| 102 | --enable-maintainer-mode |
| 103 | enable make rules and dependencies not useful (and |
| 104 | @@ -18450,7 +18452,7 @@ else |
| 105 | lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 |
| 106 | lt_status=$lt_dlunknown |
| 107 | cat > conftest.$ac_ext <<_LT_EOF |
| 108 | -#line 18436 "configure" |
| 109 | +#line 18455 "configure" |
| 110 | #include "confdefs.h" |
| 111 | |
| 112 | #if HAVE_DLFCN_H |
| 113 | @@ -18556,7 +18558,7 @@ else |
| 114 | lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 |
| 115 | lt_status=$lt_dlunknown |
| 116 | cat > conftest.$ac_ext <<_LT_EOF |
| 117 | -#line 18542 "configure" |
| 118 | +#line 18561 "configure" |
| 119 | #include "confdefs.h" |
| 120 | |
| 121 | #if HAVE_DLFCN_H |
| 122 | @@ -25234,6 +25236,7 @@ $as_echo "#define HAVE_AS_SPARC5_VIS4 1" |
| 123 | |
| 124 | fi |
| 125 | |
| 126 | + |
| 127 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for SPARC6 instructions" >&5 |
| 128 | $as_echo_n "checking assembler for SPARC6 instructions... " >&6; } |
| 129 | if test "${gcc_cv_as_sparc_sparc6+set}" = set; then : |
| 130 | @@ -25270,6 +25273,7 @@ $as_echo "#define HAVE_AS_SPARC6 1" >>co |
| 131 | |
| 132 | fi |
| 133 | |
| 134 | + |
| 135 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for LEON instructions" >&5 |
| 136 | $as_echo_n "checking assembler for LEON instructions... " >&6; } |
| 137 | if test "${gcc_cv_as_sparc_leon+set}" = set; then : |
| 138 | @@ -28947,6 +28951,18 @@ $as_echo "#define HAVE_SOLARIS_CRTS 1" > |
| 139 | |
| 140 | fi |
| 141 | |
| 142 | +# Check whether --enable-libssp was given. |
| 143 | +if test "${enable_libssp+set}" = set; then : |
| 144 | + enableval=$enable_libssp; case "${enableval}" in |
| 145 | + yes|no) |
| 146 | + ;; |
| 147 | + *) |
| 148 | + as_fn_error "unknown libssp setting $enableval" "$LINENO" 5 |
| 149 | + ;; |
| 150 | +esac |
| 151 | +fi |
| 152 | + |
| 153 | + |
| 154 | # Test for stack protector support in target C library. |
| 155 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking __stack_chk_fail in target C library" >&5 |
| 156 | $as_echo_n "checking __stack_chk_fail in target C library... " >&6; } |
| 157 | @@ -28954,6 +28970,11 @@ if test "${gcc_cv_libc_provides_ssp+set} |
| 158 | $as_echo_n "(cached) " >&6 |
| 159 | else |
| 160 | gcc_cv_libc_provides_ssp=no |
| 161 | + if test "x$enable_libssp" = "xno"; then |
| 162 | + gcc_cv_libc_provides_ssp=yes |
| 163 | + elif test "x$enable_libssp" = "xyes"; then |
| 164 | + gcc_cv_libc_provides_ssp=no |
| 165 | + else |
| 166 | case "$target" in |
| 167 | *-*-musl*) |
| 168 | # All versions of musl provide stack protector |
| 169 | @@ -29001,8 +29022,9 @@ else |
| 170 | fi |
| 171 | |
| 172 | ;; |
| 173 | - *) gcc_cv_libc_provides_ssp=no ;; |
| 174 | + *) gcc_cv_libc_provides_ssp=no ;; |
| 175 | esac |
| 176 | + fi |
| 177 | fi |
| 178 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_libc_provides_ssp" >&5 |
| 179 | $as_echo "$gcc_cv_libc_provides_ssp" >&6; } |
| 180 | @@ -29037,18 +29059,15 @@ fi |
| 181 | |
| 182 | |
| 183 | # Test for <sys/sdt.h> on the target. |
| 184 | - |
| 185 | -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking sys/sdt.h in the target C library" >&5 |
| 186 | -$as_echo_n "checking sys/sdt.h in the target C library... " >&6; } |
| 187 | -have_sys_sdt_h=no |
| 188 | +#GCC_TARGET_TEMPLATE([HAVE_SYS_SDT_H]) |
| 189 | +#AC_MSG_CHECKING(sys/sdt.h in the target C library) |
| 190 | +#have_sys_sdt_h=no |
| 191 | #if test -f $target_header_dir/sys/sdt.h; then |
| 192 | # have_sys_sdt_h=yes |
| 193 | -# |
| 194 | -#$as_echo "#define HAVE_SYS_SDT_H 1" >>confdefs.h |
| 195 | -# |
| 196 | +# AC_DEFINE(HAVE_SYS_SDT_H, 1, |
| 197 | +# [Define if your target C library provides sys/sdt.h]) |
| 198 | #fi |
| 199 | -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_sys_sdt_h" >&5 |
| 200 | -$as_echo "$have_sys_sdt_h" >&6; } |
| 201 | +#AC_MSG_RESULT($have_sys_sdt_h) |
| 202 | |
| 203 | # Check if TFmode long double should be used by default or not. |
| 204 | # Some glibc targets used DFmode long double, but with glibc 2.4 |