Patchwork Add -lssp_nonshared to LINK_SSP_SPEC

login
register
mail settings
Submitter Jakub Jelinek
Date Feb. 7, 2012, 11:53 a.m.
Message ID <20120207115324.GY18768@tyan-ft48-01.lab.bos.redhat.com>
Download mbox | patch
Permalink /patch/139904/
State New
Headers show

Comments

Jakub Jelinek - Feb. 7, 2012, 11:53 a.m.
On Tue, Feb 07, 2012 at 12:17:59PM +0100, Tijl Coosemans wrote:
> Everything still works on FreeBSD.

After discussion about this on IRC Richard expressed his preference
for the following variant instead:

2012-02-07  Jakub Jelinek  <jakub@redhat.com>

	* config/freebsd-spec.h: Add comment about what macros can be defined
	in this header.
	(LINK_EH_SPEC, LINK_SSP_SPEC, USE_LD_AS_NEEDED): Don't define here.
	* config/freebsd.h (LINK_EH_SPEC, LINK_SSP_SPEC, USE_LD_AS_NEEDED): But
	here instead.



	Jakub
Richard Guenther - Feb. 7, 2012, 11:59 a.m.
On Tue, Feb 7, 2012 at 12:53 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Tue, Feb 07, 2012 at 12:17:59PM +0100, Tijl Coosemans wrote:
>> Everything still works on FreeBSD.
>
> After discussion about this on IRC Richard expressed his preference
> for the following variant instead:

Ok.

Thanks,
Richard.

> 2012-02-07  Jakub Jelinek  <jakub@redhat.com>
>
>        * config/freebsd-spec.h: Add comment about what macros can be defined
>        in this header.
>        (LINK_EH_SPEC, LINK_SSP_SPEC, USE_LD_AS_NEEDED): Don't define here.
>        * config/freebsd.h (LINK_EH_SPEC, LINK_SSP_SPEC, USE_LD_AS_NEEDED): But
>        here instead.
>
> --- gcc/config/freebsd-spec.h.jj        2012-01-30 00:10:01.000000000 +0100
> +++ gcc/config/freebsd-spec.h   2012-02-07 12:44:47.000000000 +0100
> @@ -134,15 +134,6 @@ is built with the --enable-threads confi
>  #define FBSD_DYNAMIC_LINKER "/libexec/ld-elf.so.1"
>  #endif
>
> -#if defined(HAVE_LD_EH_FRAME_HDR)
> -#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
> -#endif
> -
> -#ifdef TARGET_LIBC_PROVIDES_SSP
> -#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all:-lssp_nonshared}"
> -#endif
> -
> -/* Use --as-needed -lgcc_s for eh support.  */
> -#ifdef HAVE_LD_AS_NEEDED
> -#define USE_LD_AS_NEEDED 1
> -#endif
> +/* NOTE: The freebsd-spec.h header is included also for various
> +   non-FreeBSD powerpc targets, thus it should never define macros
> +   other than FBSD_* prefixed ones, or USING_CONFIG_FREEBSD_SPEC.  */
> --- gcc/config/freebsd.h.jj     2010-11-26 18:39:09.000000000 +0100
> +++ gcc/config/freebsd.h        2012-02-07 12:45:34.497798123 +0100
> @@ -1,6 +1,6 @@
>  /* Base configuration file for all FreeBSD targets.
>    Copyright (C) 1999, 2000, 2001, 2007, 2008, 2009,
> -   2010 Free Software Foundation, Inc.
> +   2010, 2011, 2012 Free Software Foundation, Inc.
>
>  This file is part of GCC.
>
> @@ -45,6 +45,19 @@ along with GCC; see the file COPYING3.
>  #undef  LIB_SPEC
>  #define LIB_SPEC FBSD_LIB_SPEC
>
> +#if defined(HAVE_LD_EH_FRAME_HDR)
> +#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
> +#endif
> +
> +#ifdef TARGET_LIBC_PROVIDES_SSP
> +#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all:-lssp_nonshared}"
> +#endif
> +
> +/* Use --as-needed -lgcc_s for eh support.  */
> +#ifdef HAVE_LD_AS_NEEDED
> +#define USE_LD_AS_NEEDED 1
> +#endif
> +
>  /************************[  Target stuff  ]***********************************/
>
>  /* All FreeBSD Architectures support the ELF object file format.  */
>
>
>        Jakub
Tijl Coosemans - Feb. 7, 2012, 1:41 p.m.
On Tuesday 07 February 2012 12:53:24 Jakub Jelinek wrote:
> On Tue, Feb 07, 2012 at 12:17:59PM +0100, Tijl Coosemans wrote:
>> Everything still works on FreeBSD.
> 
> After discussion about this on IRC Richard expressed his preference
> for the following variant instead:

Works too.

Patch

--- gcc/config/freebsd-spec.h.jj	2012-01-30 00:10:01.000000000 +0100
+++ gcc/config/freebsd-spec.h	2012-02-07 12:44:47.000000000 +0100
@@ -134,15 +134,6 @@  is built with the --enable-threads confi
 #define FBSD_DYNAMIC_LINKER "/libexec/ld-elf.so.1"
 #endif
 
-#if defined(HAVE_LD_EH_FRAME_HDR)
-#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
-#endif
-
-#ifdef TARGET_LIBC_PROVIDES_SSP
-#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all:-lssp_nonshared}"
-#endif
-
-/* Use --as-needed -lgcc_s for eh support.  */
-#ifdef HAVE_LD_AS_NEEDED
-#define USE_LD_AS_NEEDED 1
-#endif
+/* NOTE: The freebsd-spec.h header is included also for various
+   non-FreeBSD powerpc targets, thus it should never define macros
+   other than FBSD_* prefixed ones, or USING_CONFIG_FREEBSD_SPEC.  */
--- gcc/config/freebsd.h.jj	2010-11-26 18:39:09.000000000 +0100
+++ gcc/config/freebsd.h	2012-02-07 12:45:34.497798123 +0100
@@ -1,6 +1,6 @@ 
 /* Base configuration file for all FreeBSD targets.
    Copyright (C) 1999, 2000, 2001, 2007, 2008, 2009,
-   2010 Free Software Foundation, Inc.
+   2010, 2011, 2012 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -45,6 +45,19 @@  along with GCC; see the file COPYING3.
 #undef  LIB_SPEC
 #define LIB_SPEC FBSD_LIB_SPEC
 
+#if defined(HAVE_LD_EH_FRAME_HDR)
+#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
+#endif
+
+#ifdef TARGET_LIBC_PROVIDES_SSP
+#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all:-lssp_nonshared}"
+#endif
+
+/* Use --as-needed -lgcc_s for eh support.  */
+#ifdef HAVE_LD_AS_NEEDED
+#define USE_LD_AS_NEEDED 1
+#endif
+
 /************************[  Target stuff  ]***********************************/
 
 /* All FreeBSD Architectures support the ELF object file format.  */