This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH-PING] libssp and FORTIFY_SOURCE
- From: Ian Lance Taylor <iant at google dot com>
- To: Stefan Schulze Frielinghaus <stefan at seekline dot net>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 11 Nov 2008 07:58:09 -0800
- Subject: Re: [PATCH-PING] libssp and FORTIFY_SOURCE
- References: <1226321654.10062.22.camel@localhost.localdomain>
Stefan Schulze Frielinghaus <stefan@seekline.net> writes:
> 2008-11-10 Stefan Schulze Frielinghaus <stefan@seekline.net>
>
> * configure.ac (LIBSSP_INCLUDE_DIR): Define LIBSSP_INCLUDE_DIR to
> represent the include path of libssp if libc does not provide
> __stack_chk_fail.
> * configure: Re-generated.
> * cppdefault.h (cpp_LIBSSP_INCLUDE_DIR, cpp_LIBSSP_INCLUDE_DIR_len):
> Declare and externalize new variables.
> * cppdefault.c (cpp_LIBSSP_INCLUDE_DIR, cpp_LIBSSP_INCLUDE_DIR_len):
> Initialize both variables.
> * Makefile.in (@LIBSSP_INCLUDE_DIR@): Add result of configure script
> to PREPROCESSOR_DEFINES.
> Index: configure.ac
> ===================================================================
> --- configure.ac (revision 141731)
> +++ configure.ac (working copy)
> @@ -3540,7 +3540,11 @@
> if test x$gcc_cv_libc_provides_ssp = xyes; then
> AC_DEFINE(TARGET_LIBC_PROVIDES_SSP, 1,
> [Define if your target C library provides stack protector support])
> + LIBSSP_INCLUDE_DIR=""
> +else
> + LIBSSP_INCLUDE_DIR="-DLIBSSP_INCLUDE_DIR=\\\"\$(libsubdir)/include/ssp\\\""
> fi
> +AC_SUBST(LIBSSP_INCLUDE_DIR)
Please name this variable LIBSSP_INCLUDE_DIR_DEFINE.
> Index: cppdefault.c
> ===================================================================
> --- cppdefault.c (revision 141731)
> +++ cppdefault.c (working copy)
> @@ -46,6 +46,9 @@
> = INCLUDE_DEFAULTS;
> #else
> = {
> +#ifdef LIBSSP_INCLUDE_DIR
> + { LIBSSP_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
> +#endif
> #ifdef GPLUSPLUS_INCLUDE_DIR
> /* Pick up GNU C++ generic include files. */
> { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, 0, 0 },
I think this new directory should go in between LOCAL_INCLUDE_DIR and
PREFIX_INCLUDE_DIR.
> @@ -109,6 +112,14 @@
> const size_t cpp_GCC_INCLUDE_DIR_len = 0;
> #endif
>
> +#ifdef LIBSSP_INCLUDE_DIR
> +const char cpp_LIBSSP_INCLUDE_DIR[] = LIBSSP_INCLUDE_DIR;
> +const size_t cpp_LIBSSP_INCLUDE_DIR_len = sizeof LIBSSP_INCLUDE_DIR - 1;
> +#else
> +const char cpp_LIBSSP_INCLUDE_DIR[] = "";
> +const size_t cpp_LIBSSP_INCLUDE_DIR_len = 0;
> +#endif
> +
This seems unnecessary and should be omitted.
> Index: cppdefault.h
> ===================================================================
> --- cppdefault.h (revision 141731)
> +++ cppdefault.h (working copy)
> @@ -51,6 +51,8 @@
> extern const struct default_include cpp_include_defaults[];
> extern const char cpp_GCC_INCLUDE_DIR[];
> extern const size_t cpp_GCC_INCLUDE_DIR_len;
> +extern const char cpp_LIBSSP_INCLUDE_DIR[];
> +extern const size_t cpp_LIBSSP_INCLUDE_DIR_len;
Same here--omit.
> Index: Makefile.in
> ===================================================================
> --- Makefile.in (revision 141731)
> +++ Makefile.in (working copy)
> @@ -3500,7 +3500,8 @@
> -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" \
> -DPREFIX=\"$(prefix)/\" \
> -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc/\" \
> - @TARGET_SYSTEM_ROOT_DEFINE@
> + @TARGET_SYSTEM_ROOT_DEFINE@ \
> + @LIBSSP_INCLUDE_DIR@
Change to LIBSSP_INCLUDE_DIR_DEFINE.
With those changes this patch is OK when we return to stage 1.
Thanks.
Ian