* [patch] configure option to override TARGET_LIBC_PROVIDES_SSP
@ 2017-10-09 7:53 Sandra Loosemore
2017-10-09 15:17 ` Joseph Myers
0 siblings, 1 reply; 7+ messages in thread
From: Sandra Loosemore @ 2017-10-09 7:53 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 581 bytes --]
This patch allows you to configure GCC to explicitly (not) add
-lssp_nonshared -lssp link options when the -fstack-protector options
are provided, by overriding the inferred default setting for
TARGET_LIBC_PROVIDES_SSP. The specific use case this is for is a
bare-metal target where the runtime support is provided by an external
BSP library. Without the patch, you get linker errors about the missing
libraries.
Is this OK? I tested with an x86_64-linux-gnu bootstrap as well as both
nios2-elf and nios2-linux-gnu (requiring another patch still in my queue).
-Sandra
[-- Attachment #2: libssp.log --]
[-- Type: text/x-log, Size: 260 bytes --]
2017-10-08 Sandra Loosemore <sandra@codesourcery.com>
gcc/
* configure.ac (--enable-libssp): New.
(gcc_cv_libc_provides_ssp): Check for explicit setting before
trying to determine target-specific default. Adjust indentation.
* configure: Regenerated.
[-- Attachment #3: libssp.patch --]
[-- Type: text/x-patch, Size: 1424 bytes --]
Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac (revision 253502)
+++ gcc/configure.ac (working copy)
@@ -5751,10 +5751,25 @@ if test x$gcc_cv_solaris_crts = xyes; th
[Define if the system-provided CRTs are present on Solaris.])
fi
+AC_ARG_ENABLE(libssp,
+[AS_HELP_STRING([--enable-libssp], [enable linking against libssp])],
+[case "${enableval}" in
+ yes|no)
+ ;;
+ *)
+ AC_MSG_ERROR(unknown libssp setting $enableval)
+ ;;
+esac], [])
+
# Test for stack protector support in target C library.
AC_CACHE_CHECK(__stack_chk_fail in target C library,
- gcc_cv_libc_provides_ssp,
- [gcc_cv_libc_provides_ssp=no
+ gcc_cv_libc_provides_ssp,
+ [gcc_cv_libc_provides_ssp=no
+ if test "x$enable_libssp" = "xno"; then
+ gcc_cv_libc_provides_ssp=yes
+ elif test "x$enable_libssp" = "xyes"; then
+ gcc_cv_libc_provides_ssp=no
+ else
case "$target" in
*-*-musl*)
# All versions of musl provide stack protector
@@ -5791,8 +5806,9 @@ AC_CACHE_CHECK(__stack_chk_fail in targe
AC_CHECK_FUNC(__stack_chk_fail,[gcc_cv_libc_provides_ssp=yes],
[echo "no __stack_chk_fail on this target"])
;;
- *) gcc_cv_libc_provides_ssp=no ;;
- esac])
+ *) gcc_cv_libc_provides_ssp=no ;;
+ esac
+ fi])
if test x$gcc_cv_libc_provides_ssp = xyes; then
AC_DEFINE(TARGET_LIBC_PROVIDES_SSP, 1,
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [patch] configure option to override TARGET_LIBC_PROVIDES_SSP
2017-10-09 7:53 [patch] configure option to override TARGET_LIBC_PROVIDES_SSP Sandra Loosemore
@ 2017-10-09 15:17 ` Joseph Myers
2017-10-09 20:10 ` Sandra Loosemore
0 siblings, 1 reply; 7+ messages in thread
From: Joseph Myers @ 2017-10-09 15:17 UTC (permalink / raw)
To: Sandra Loosemore; +Cc: gcc-patches
The install.texi documentation for --disable-libssp only says "Specify
that the run-time libraries for stack smashing protection should not be
built.". I think it needs updating to mention these additional effects as
well.
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [patch] configure option to override TARGET_LIBC_PROVIDES_SSP
2017-10-09 15:17 ` Joseph Myers
@ 2017-10-09 20:10 ` Sandra Loosemore
2017-10-11 14:22 ` Gerald Pfeifer
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Sandra Loosemore @ 2017-10-09 20:10 UTC (permalink / raw)
To: Joseph Myers; +Cc: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 324 bytes --]
On 10/09/2017 09:13 AM, Joseph Myers wrote:
> The install.texi documentation for --disable-libssp only says "Specify
> that the run-time libraries for stack smashing protection should not be
> built.". I think it needs updating to mention these additional effects as
> well.
Oops. :") How about this version?
-Sandra
[-- Attachment #2: libssp.log --]
[-- Type: text/x-log, Size: 337 bytes --]
2017-10-09 Sandra Loosemore <sandra@codesourcery.com>
gcc/
* configure.ac (--enable-libssp): New.
(gcc_cv_libc_provides_ssp): Check for explicit setting before
trying to determine target-specific default. Adjust indentation.
* configure: Regenerated.
* doc/install.texi (Configuration): Expand --disable-libssp
documentation.
[-- Attachment #3: libssp.patch --]
[-- Type: text/x-patch, Size: 1968 bytes --]
Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac (revision 253502)
+++ gcc/configure.ac (working copy)
@@ -5751,10 +5751,25 @@ if test x$gcc_cv_solaris_crts = xyes; th
[Define if the system-provided CRTs are present on Solaris.])
fi
+AC_ARG_ENABLE(libssp,
+[AS_HELP_STRING([--enable-libssp], [enable linking against libssp])],
+[case "${enableval}" in
+ yes|no)
+ ;;
+ *)
+ AC_MSG_ERROR(unknown libssp setting $enableval)
+ ;;
+esac], [])
+
# Test for stack protector support in target C library.
AC_CACHE_CHECK(__stack_chk_fail in target C library,
- gcc_cv_libc_provides_ssp,
- [gcc_cv_libc_provides_ssp=no
+ gcc_cv_libc_provides_ssp,
+ [gcc_cv_libc_provides_ssp=no
+ if test "x$enable_libssp" = "xno"; then
+ gcc_cv_libc_provides_ssp=yes
+ elif test "x$enable_libssp" = "xyes"; then
+ gcc_cv_libc_provides_ssp=no
+ else
case "$target" in
*-*-musl*)
# All versions of musl provide stack protector
@@ -5791,8 +5806,9 @@ AC_CACHE_CHECK(__stack_chk_fail in targe
AC_CHECK_FUNC(__stack_chk_fail,[gcc_cv_libc_provides_ssp=yes],
[echo "no __stack_chk_fail on this target"])
;;
- *) gcc_cv_libc_provides_ssp=no ;;
- esac])
+ *) gcc_cv_libc_provides_ssp=no ;;
+ esac
+ fi])
if test x$gcc_cv_libc_provides_ssp = xyes; then
AC_DEFINE(TARGET_LIBC_PROVIDES_SSP, 1,
Index: gcc/doc/install.texi
===================================================================
--- gcc/doc/install.texi (revision 253502)
+++ gcc/doc/install.texi (working copy)
@@ -1665,7 +1665,8 @@ not be built.
@item --disable-libssp
Specify that the run-time libraries for stack smashing protection
-should not be built.
+should not be built or linked against. On many targets library support
+is provided by the C library instead.
@item --disable-libquadmath
Specify that the GCC quad-precision math library should not be built.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [patch] configure option to override TARGET_LIBC_PROVIDES_SSP
2017-10-09 20:10 ` Sandra Loosemore
@ 2017-10-11 14:22 ` Gerald Pfeifer
2017-10-26 17:13 ` PING " Sandra Loosemore
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Gerald Pfeifer @ 2017-10-11 14:22 UTC (permalink / raw)
To: Sandra Loosemore; +Cc: Joseph Myers, gcc-patches
On Mon, 9 Oct 2017, Sandra Loosemore wrote:
>> The install.texi documentation for --disable-libssp only says "Specify
> that the run-time libraries for stack smashing protection should not be
>> built.". I think it needs updating to mention these additional effects as
>> well.
> Oops. :") How about this version?
Makes sense to me, thanks. (Though better give Joseph a day or two
to chime in as well, since he spotted this originally.)
Gerald
^ permalink raw reply [flat|nested] 7+ messages in thread
* PING Re: [patch] configure option to override TARGET_LIBC_PROVIDES_SSP
2017-10-09 20:10 ` Sandra Loosemore
2017-10-11 14:22 ` Gerald Pfeifer
@ 2017-10-26 17:13 ` Sandra Loosemore
2017-10-30 23:58 ` Joseph Myers
2017-10-31 1:20 ` Jeff Law
3 siblings, 0 replies; 7+ messages in thread
From: Sandra Loosemore @ 2017-10-26 17:13 UTC (permalink / raw)
To: Joseph Myers; +Cc: gcc-patches
This one.
https://gcc.gnu.org/ml/gcc-patches/2017-10/msg00537.html
There was discussion about documenting this, but the actual configure
change hasn't been reviewed yet.
-Sandra
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [patch] configure option to override TARGET_LIBC_PROVIDES_SSP
2017-10-09 20:10 ` Sandra Loosemore
2017-10-11 14:22 ` Gerald Pfeifer
2017-10-26 17:13 ` PING " Sandra Loosemore
@ 2017-10-30 23:58 ` Joseph Myers
2017-10-31 1:20 ` Jeff Law
3 siblings, 0 replies; 7+ messages in thread
From: Joseph Myers @ 2017-10-30 23:58 UTC (permalink / raw)
To: Sandra Loosemore; +Cc: gcc-patches
On Mon, 9 Oct 2017, Sandra Loosemore wrote:
> On 10/09/2017 09:13 AM, Joseph Myers wrote:
> > The install.texi documentation for --disable-libssp only says "Specify
> > that the run-time libraries for stack smashing protection should not be
> > built.". I think it needs updating to mention these additional effects as
> > well.
>
> Oops. :") How about this version?
OK with the argument to AC_MSG_ERROR []-quoted (i.e.,
AC_MSG_ERROR([unknown libssp setting $enableval])
which should not change the generated configure script) - the preferred
autoconf style is generally for each macro argument to have one level of
[] quotes unless there is some reason for a different level of quoting,
although gcc/configure.ac is not wonderfully consistent about this.
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [patch] configure option to override TARGET_LIBC_PROVIDES_SSP
2017-10-09 20:10 ` Sandra Loosemore
` (2 preceding siblings ...)
2017-10-30 23:58 ` Joseph Myers
@ 2017-10-31 1:20 ` Jeff Law
3 siblings, 0 replies; 7+ messages in thread
From: Jeff Law @ 2017-10-31 1:20 UTC (permalink / raw)
To: Sandra Loosemore, Joseph Myers; +Cc: gcc-patches
On 10/09/2017 02:08 PM, Sandra Loosemore wrote:
> On 10/09/2017 09:13 AM, Joseph Myers wrote:
>> The install.texi documentation for --disable-libssp only says "Specify
>> that the run-time libraries for stack smashing protection should not be
>> built.".  I think it needs updating to mention these additional effects as
>>
>> well.
>
> Oops.  :")  How about this version?
>
> -Sandra
>
>
>
> libssp.log
>
>
> 2017-10-09 Sandra Loosemore <sandra@codesourcery.com>
>
> gcc/
> * configure.ac (--enable-libssp): New.
> (gcc_cv_libc_provides_ssp): Check for explicit setting before
> trying to determine target-specific default. Adjust indentation.
> * configure: Regenerated.
> * doc/install.texi (Configuration): Expand --disable-libssp
> documentation.
OK.
Jeff
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2017-10-31 1:20 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-09 7:53 [patch] configure option to override TARGET_LIBC_PROVIDES_SSP Sandra Loosemore
2017-10-09 15:17 ` Joseph Myers
2017-10-09 20:10 ` Sandra Loosemore
2017-10-11 14:22 ` Gerald Pfeifer
2017-10-26 17:13 ` PING " Sandra Loosemore
2017-10-30 23:58 ` Joseph Myers
2017-10-31 1:20 ` Jeff Law
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).