public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] hurd: align -p and -pg behavior on Linux
@ 2015-09-19 12:33 Samuel Thibault
  2015-09-28 21:51 ` Samuel Thibault
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Samuel Thibault @ 2015-09-19 12:33 UTC (permalink / raw)
  To: gcc-patches, roland; +Cc: bug-hurd

On Linux, -p and -pg do not make gcc link against libc_p.a, only
-profile does (as documented in r11246), and thus people expect -p
and -pg to work without libc_p.a installed (it is actually even not
available any more in Debian).  We should thus rather make the Hurd port
do the same to avoid build failures.

Samuel

	* gcc/config/gnu.h (LIB_SPEC) [-p|-pg]: Link with -lc instead of -lc_p.
        * gcc/config/i386/gnu.h (STARTFILE_SPEC) [-p|-pg]: Use gcrt1.o
        instead of gcrt0.o.

--- gcc/config/gnu.h.orig	2015-09-16 00:43:09.785570853 +0200
+++ gcc/config/gnu.h	2015-09-16 00:43:12.513550418 +0200
@@ -25,7 +25,7 @@
 
 /* Default C library spec.  */
 #undef LIB_SPEC
-#define LIB_SPEC "%{pthread:-lpthread} %{pg|p|profile:-lc_p;:-lc}"
+#define LIB_SPEC "%{pthread:-lpthread} %{profile:-lc_p;:-lc}"
 
 #undef GNU_USER_TARGET_OS_CPP_BUILTINS
 #define GNU_USER_TARGET_OS_CPP_BUILTINS()		\
--- gcc/config/i386/gnu.h.orig	2015-09-17 21:41:13.000000000 +0000
+++ gcc/config/i386/gnu.h	2015-09-17 23:03:57.000000000 +0000
@@ -27,11 +27,11 @@
 #undef	STARTFILE_SPEC
 #if defined HAVE_LD_PIE
 #define STARTFILE_SPEC \
-  "%{!shared: %{pg|p|profile:gcrt0.o%s;pie:Scrt1.o%s;static:crt0.o%s;:crt1.o%s}} \
+  "%{!shared: %{pg|p:gcrt1.o%s;profile:gcrt0.o%s;pie:Scrt1.o%s;static:crt0.o%s;:crt1.o%s}} \
    crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
 #else
 #define STARTFILE_SPEC \
-  "%{!shared: %{pg|p|profile:gcrt0.o%s;static:crt0.o%s;:crt1.o%s}} \
+  "%{!shared: %{pg|p:gcrt1.o%s;profile:gcrt0.o%s;static:crt0.o%s;:crt1.o%s}} \
    crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
 #endif
 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] hurd: align -p and -pg behavior on Linux
  2015-09-19 12:33 [PATCH] hurd: align -p and -pg behavior on Linux Samuel Thibault
@ 2015-09-28 21:51 ` Samuel Thibault
  2015-10-11 18:29 ` Samuel Thibault
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: Samuel Thibault @ 2015-09-28 21:51 UTC (permalink / raw)
  To: gcc-patches, roland, bug-hurd

Ping?

Samuel Thibault, le Sat 19 Sep 2015 14:00:23 +0200, a écrit :
> On Linux, -p and -pg do not make gcc link against libc_p.a, only
> -profile does (as documented in r11246), and thus people expect -p
> and -pg to work without libc_p.a installed (it is actually even not
> available any more in Debian).  We should thus rather make the Hurd port
> do the same to avoid build failures.
> 
> Samuel
> 
> 	* gcc/config/gnu.h (LIB_SPEC) [-p|-pg]: Link with -lc instead of -lc_p.
>         * gcc/config/i386/gnu.h (STARTFILE_SPEC) [-p|-pg]: Use gcrt1.o
>         instead of gcrt0.o.
> 
> --- gcc/config/gnu.h.orig	2015-09-16 00:43:09.785570853 +0200
> +++ gcc/config/gnu.h	2015-09-16 00:43:12.513550418 +0200
> @@ -25,7 +25,7 @@
>  
>  /* Default C library spec.  */
>  #undef LIB_SPEC
> -#define LIB_SPEC "%{pthread:-lpthread} %{pg|p|profile:-lc_p;:-lc}"
> +#define LIB_SPEC "%{pthread:-lpthread} %{profile:-lc_p;:-lc}"
>  
>  #undef GNU_USER_TARGET_OS_CPP_BUILTINS
>  #define GNU_USER_TARGET_OS_CPP_BUILTINS()		\
> --- gcc/config/i386/gnu.h.orig	2015-09-17 21:41:13.000000000 +0000
> +++ gcc/config/i386/gnu.h	2015-09-17 23:03:57.000000000 +0000
> @@ -27,11 +27,11 @@
>  #undef	STARTFILE_SPEC
>  #if defined HAVE_LD_PIE
>  #define STARTFILE_SPEC \
> -  "%{!shared: %{pg|p|profile:gcrt0.o%s;pie:Scrt1.o%s;static:crt0.o%s;:crt1.o%s}} \
> +  "%{!shared: %{pg|p:gcrt1.o%s;profile:gcrt0.o%s;pie:Scrt1.o%s;static:crt0.o%s;:crt1.o%s}} \
>     crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
>  #else
>  #define STARTFILE_SPEC \
> -  "%{!shared: %{pg|p|profile:gcrt0.o%s;static:crt0.o%s;:crt1.o%s}} \
> +  "%{!shared: %{pg|p:gcrt1.o%s;profile:gcrt0.o%s;static:crt0.o%s;:crt1.o%s}} \
>     crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
>  #endif
>  

-- 
Samuel
Hi ! I'm a .signature virus ! Copy me into your ~/.signature, please !

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] hurd: align -p and -pg behavior on Linux
  2015-09-19 12:33 [PATCH] hurd: align -p and -pg behavior on Linux Samuel Thibault
  2015-09-28 21:51 ` Samuel Thibault
@ 2015-10-11 18:29 ` Samuel Thibault
  2016-01-14  0:10   ` Samuel Thibault
  2015-10-12  8:37 ` Thomas Schwinge
  2016-02-24 22:47 ` Thomas Schwinge
  3 siblings, 1 reply; 10+ messages in thread
From: Samuel Thibault @ 2015-10-11 18:29 UTC (permalink / raw)
  To: gcc-patches, roland, bug-hurd

Ping?

(I don't have commit access)

Samuel Thibault, le Sat 19 Sep 2015 14:00:23 +0200, a écrit :
> On Linux, -p and -pg do not make gcc link against libc_p.a, only
> -profile does (as documented in r11246), and thus people expect -p
> and -pg to work without libc_p.a installed (it is actually even not
> available any more in Debian).  We should thus rather make the Hurd port
> do the same to avoid build failures.
> 
> Samuel
> 
> 	* gcc/config/gnu.h (LIB_SPEC) [-p|-pg]: Link with -lc instead of -lc_p.
>         * gcc/config/i386/gnu.h (STARTFILE_SPEC) [-p|-pg]: Use gcrt1.o
>         instead of gcrt0.o.
> 
> --- gcc/config/gnu.h.orig	2015-09-16 00:43:09.785570853 +0200
> +++ gcc/config/gnu.h	2015-09-16 00:43:12.513550418 +0200
> @@ -25,7 +25,7 @@
>  
>  /* Default C library spec.  */
>  #undef LIB_SPEC
> -#define LIB_SPEC "%{pthread:-lpthread} %{pg|p|profile:-lc_p;:-lc}"
> +#define LIB_SPEC "%{pthread:-lpthread} %{profile:-lc_p;:-lc}"
>  
>  #undef GNU_USER_TARGET_OS_CPP_BUILTINS
>  #define GNU_USER_TARGET_OS_CPP_BUILTINS()		\
> --- gcc/config/i386/gnu.h.orig	2015-09-17 21:41:13.000000000 +0000
> +++ gcc/config/i386/gnu.h	2015-09-17 23:03:57.000000000 +0000
> @@ -27,11 +27,11 @@
>  #undef	STARTFILE_SPEC
>  #if defined HAVE_LD_PIE
>  #define STARTFILE_SPEC \
> -  "%{!shared: %{pg|p|profile:gcrt0.o%s;pie:Scrt1.o%s;static:crt0.o%s;:crt1.o%s}} \
> +  "%{!shared: %{pg|p:gcrt1.o%s;profile:gcrt0.o%s;pie:Scrt1.o%s;static:crt0.o%s;:crt1.o%s}} \
>     crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
>  #else
>  #define STARTFILE_SPEC \
> -  "%{!shared: %{pg|p|profile:gcrt0.o%s;static:crt0.o%s;:crt1.o%s}} \
> +  "%{!shared: %{pg|p:gcrt1.o%s;profile:gcrt0.o%s;static:crt0.o%s;:crt1.o%s}} \
>     crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
>  #endif
>  

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] hurd: align -p and -pg behavior on Linux
  2015-09-19 12:33 [PATCH] hurd: align -p and -pg behavior on Linux Samuel Thibault
  2015-09-28 21:51 ` Samuel Thibault
  2015-10-11 18:29 ` Samuel Thibault
@ 2015-10-12  8:37 ` Thomas Schwinge
  2016-02-24 22:47 ` Thomas Schwinge
  3 siblings, 0 replies; 10+ messages in thread
From: Thomas Schwinge @ 2015-10-12  8:37 UTC (permalink / raw)
  To: Samuel Thibault; +Cc: bug-hurd, gcc-patches, roland

[-- Attachment #1: Type: text/plain, Size: 1913 bytes --]

Hi Samuel!

On Sat, 19 Sep 2015 14:00:23 +0200, Samuel Thibault <samuel.thibault@gnu.org> wrote:
> On Linux, -p and -pg do not make gcc link against libc_p.a, only
> -profile does (as documented in r11246), and thus people expect -p
> and -pg to work without libc_p.a installed (it is actually even not
> available any more in Debian).  We should thus rather make the Hurd port
> do the same to avoid build failures.

ACK.  Thanks, I'll take care of your patch.

> 	* gcc/config/gnu.h (LIB_SPEC) [-p|-pg]: Link with -lc instead of -lc_p.
>         * gcc/config/i386/gnu.h (STARTFILE_SPEC) [-p|-pg]: Use gcrt1.o
>         instead of gcrt0.o.
> 
> --- gcc/config/gnu.h.orig	2015-09-16 00:43:09.785570853 +0200
> +++ gcc/config/gnu.h	2015-09-16 00:43:12.513550418 +0200
> @@ -25,7 +25,7 @@
>  
>  /* Default C library spec.  */
>  #undef LIB_SPEC
> -#define LIB_SPEC "%{pthread:-lpthread} %{pg|p|profile:-lc_p;:-lc}"
> +#define LIB_SPEC "%{pthread:-lpthread} %{profile:-lc_p;:-lc}"
>  
>  #undef GNU_USER_TARGET_OS_CPP_BUILTINS
>  #define GNU_USER_TARGET_OS_CPP_BUILTINS()		\
> --- gcc/config/i386/gnu.h.orig	2015-09-17 21:41:13.000000000 +0000
> +++ gcc/config/i386/gnu.h	2015-09-17 23:03:57.000000000 +0000
> @@ -27,11 +27,11 @@
>  #undef	STARTFILE_SPEC
>  #if defined HAVE_LD_PIE
>  #define STARTFILE_SPEC \
> -  "%{!shared: %{pg|p|profile:gcrt0.o%s;pie:Scrt1.o%s;static:crt0.o%s;:crt1.o%s}} \
> +  "%{!shared: %{pg|p:gcrt1.o%s;profile:gcrt0.o%s;pie:Scrt1.o%s;static:crt0.o%s;:crt1.o%s}} \
>     crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
>  #else
>  #define STARTFILE_SPEC \
> -  "%{!shared: %{pg|p|profile:gcrt0.o%s;static:crt0.o%s;:crt1.o%s}} \
> +  "%{!shared: %{pg|p:gcrt1.o%s;profile:gcrt0.o%s;static:crt0.o%s;:crt1.o%s}} \
>     crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
>  #endif


Grüße,
 Thomas

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] hurd: align -p and -pg behavior on Linux
  2015-10-11 18:29 ` Samuel Thibault
@ 2016-01-14  0:10   ` Samuel Thibault
  0 siblings, 0 replies; 10+ messages in thread
From: Samuel Thibault @ 2016-01-14  0:10 UTC (permalink / raw)
  To: thomas; +Cc: gcc-patches, bug-hurd

Ping?

Samuel Thibault, on Sun 11 Oct 2015 20:29:10 +0200, wrote:
> Ping?
> 
> (I don't have commit access)
> 
> Samuel Thibault, le Sat 19 Sep 2015 14:00:23 +0200, a écrit :
> > On Linux, -p and -pg do not make gcc link against libc_p.a, only
> > -profile does (as documented in r11246), and thus people expect -p
> > and -pg to work without libc_p.a installed (it is actually even not
> > available any more in Debian).  We should thus rather make the Hurd port
> > do the same to avoid build failures.
> > 
> > Samuel
> > 
> > 	* gcc/config/gnu.h (LIB_SPEC) [-p|-pg]: Link with -lc instead of -lc_p.
> >         * gcc/config/i386/gnu.h (STARTFILE_SPEC) [-p|-pg]: Use gcrt1.o
> >         instead of gcrt0.o.
> > 
> > --- gcc/config/gnu.h.orig	2015-09-16 00:43:09.785570853 +0200
> > +++ gcc/config/gnu.h	2015-09-16 00:43:12.513550418 +0200
> > @@ -25,7 +25,7 @@
> >  
> >  /* Default C library spec.  */
> >  #undef LIB_SPEC
> > -#define LIB_SPEC "%{pthread:-lpthread} %{pg|p|profile:-lc_p;:-lc}"
> > +#define LIB_SPEC "%{pthread:-lpthread} %{profile:-lc_p;:-lc}"
> >  
> >  #undef GNU_USER_TARGET_OS_CPP_BUILTINS
> >  #define GNU_USER_TARGET_OS_CPP_BUILTINS()		\
> > --- gcc/config/i386/gnu.h.orig	2015-09-17 21:41:13.000000000 +0000
> > +++ gcc/config/i386/gnu.h	2015-09-17 23:03:57.000000000 +0000
> > @@ -27,11 +27,11 @@
> >  #undef	STARTFILE_SPEC
> >  #if defined HAVE_LD_PIE
> >  #define STARTFILE_SPEC \
> > -  "%{!shared: %{pg|p|profile:gcrt0.o%s;pie:Scrt1.o%s;static:crt0.o%s;:crt1.o%s}} \
> > +  "%{!shared: %{pg|p:gcrt1.o%s;profile:gcrt0.o%s;pie:Scrt1.o%s;static:crt0.o%s;:crt1.o%s}} \
> >     crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
> >  #else
> >  #define STARTFILE_SPEC \
> > -  "%{!shared: %{pg|p|profile:gcrt0.o%s;static:crt0.o%s;:crt1.o%s}} \
> > +  "%{!shared: %{pg|p:gcrt1.o%s;profile:gcrt0.o%s;static:crt0.o%s;:crt1.o%s}} \
> >     crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
> >  #endif
> >  

-- 
Samuel
<c> hiri, le cri ici, c des marrants
<c> j'ai un rep ".uglyhackdirectorywithoutacls" ds mon home
 -+- #ens-mim en stage -+-

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] hurd: align -p and -pg behavior on Linux
  2015-09-19 12:33 [PATCH] hurd: align -p and -pg behavior on Linux Samuel Thibault
                   ` (2 preceding siblings ...)
  2015-10-12  8:37 ` Thomas Schwinge
@ 2016-02-24 22:47 ` Thomas Schwinge
  2016-02-24 23:18   ` Samuel Thibault
  2016-03-29 22:00   ` Thomas Schwinge
  3 siblings, 2 replies; 10+ messages in thread
From: Thomas Schwinge @ 2016-02-24 22:47 UTC (permalink / raw)
  To: Samuel Thibault, Roland McGrath; +Cc: bug-hurd, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 6687 bytes --]

Hi!

Sorry for the late answer...

On Sat, 19 Sep 2015 14:00:23 +0200, Samuel Thibault <samuel.thibault@gnu.org> wrote:
> On Linux, -p and -pg do not make gcc link against libc_p.a, only
> -profile does (as documented in r11246), and thus people expect -p

(Yo, 20 years ago...)

> and -pg to work without libc_p.a installed (it is actually even not
> available any more in Debian).  We should thus rather make the Hurd port
> do the same to avoid build failures.

Conceptually, ACK.


> 	* gcc/config/gnu.h (LIB_SPEC) [-p|-pg]: Link with -lc instead of -lc_p.

> --- gcc/config/gnu.h.orig	2015-09-16 00:43:09.785570853 +0200
> +++ gcc/config/gnu.h	2015-09-16 00:43:12.513550418 +0200
> @@ -25,7 +25,7 @@
>  
>  /* Default C library spec.  */
>  #undef LIB_SPEC
> -#define LIB_SPEC "%{pthread:-lpthread} %{pg|p|profile:-lc_p;:-lc}"
> +#define LIB_SPEC "%{pthread:-lpthread} %{profile:-lc_p;:-lc}"

I guess, we can just drop that custom LIB_SPEC altogether, and will then
use the default (which is also used for x86 GNU/Linux):

    gcc/config/gnu-user.h:#define GNU_USER_TARGET_NO_PTHREADS_LIB_SPEC \
    gcc/config/gnu-user.h-  "%{shared:-lc} \
    gcc/config/gnu-user.h-   %{!shared:%{mieee-fp:-lieee} %{profile:-lc_p}%{!profile:-lc}}"
    gcc/config/gnu-user.h-
    gcc/config/gnu-user.h:#define GNU_USER_TARGET_LIB_SPEC \
    gcc/config/gnu-user.h-  "%{pthread:-lpthread} " \
    gcc/config/gnu-user.h:  GNU_USER_TARGET_NO_PTHREADS_LIB_SPEC
    gcc/config/gnu-user.h-
    gcc/config/gnu-user.h:#undef  LIB_SPEC
    gcc/config/gnu-user.h:#define LIB_SPEC GNU_USER_TARGET_LIB_SPEC

I have not tested the -mieee-fp thingy, but I don't expect any issues
there; looke like this on both x86 GNU/Linux and GNU/Hurd:

    $ nm /usr/lib/i386-*gnu/libieee.a
    00000000 D _LIB_VERSION


That said, I think we can also drop our custom CPP_SPEC:

    gcc/config/gnu.h:#define CPP_SPEC "%{posix:-D_POSIX_SOURCE}"

..., and instead go with the default:

    gcc/config/i386/gnu-user-common.h:#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"

(It doesn't matter for GNU/Hurd which is x86-only, but I don't know why
CPP_SPEC is defined in gcc/config/i386/gnu-user-common.h -- and repeated
in a number of other GNU-user and */linux.h files -- instead of putting
it into the generic gcc/config/gnu-user.h?)

I guess getting -D_REENTRANT for -pthread won't do us any harm?


>         * gcc/config/i386/gnu.h (STARTFILE_SPEC) [-p|-pg]: Use gcrt1.o
>         instead of gcrt0.o.

> --- gcc/config/i386/gnu.h.orig	2015-09-17 21:41:13.000000000 +0000
> +++ gcc/config/i386/gnu.h	2015-09-17 23:03:57.000000000 +0000
> @@ -27,11 +27,11 @@
>  #undef	STARTFILE_SPEC
>  #if defined HAVE_LD_PIE
>  #define STARTFILE_SPEC \
> -  "%{!shared: %{pg|p|profile:gcrt0.o%s;pie:Scrt1.o%s;static:crt0.o%s;:crt1.o%s}} \
> +  "%{!shared: %{pg|p:gcrt1.o%s;profile:gcrt0.o%s;pie:Scrt1.o%s;static:crt0.o%s;:crt1.o%s}} \
>     crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
>  #else
>  #define STARTFILE_SPEC \
> -  "%{!shared: %{pg|p|profile:gcrt0.o%s;static:crt0.o%s;:crt1.o%s}} \
> +  "%{!shared: %{pg|p:gcrt1.o%s;profile:gcrt0.o%s;static:crt0.o%s;:crt1.o%s}} \
>     crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
>  #endif

I think I understand what you're trying to do (avoid gcrt0.o being used
for -pg or -p, and instead use gcrt1.o), but I'm not sure this is
completely correct.  Which of the several configurations, that is, flags
and their combinations, did you actually test?

In my understanding, the Hurd needs crt0.o for static linking, and crt1.o
for dynamic linking.  Likewise, for -pg or -p, I would assume that we
still need gcrt0.o for static linking, and gcrt1.o for dynamic linking.
Instead you're now suggesting to always use gcrt1.o for -pg or -p, and
gcrt0.o for -profile.


I'm now testing the following patch:

--- gcc/config/gnu.h
+++ gcc/config/gnu.h
@@ -19,14 +19,6 @@ You should have received a copy of the GNU General Public License
 along with GCC.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-/* Provide GCC options for standard feature-test macros.  */
-#undef CPP_SPEC
-#define CPP_SPEC "%{posix:-D_POSIX_SOURCE}"
-
-/* Default C library spec.  */
-#undef LIB_SPEC
-#define LIB_SPEC "%{pthread:-lpthread} %{pg|p|profile:-lc_p;:-lc}"
-
 #undef GNU_USER_TARGET_OS_CPP_BUILTINS
 #define GNU_USER_TARGET_OS_CPP_BUILTINS()		\
     do {					\
--- gcc/config/i386/gnu.h
+++ gcc/config/i386/gnu.h
@@ -27,11 +27,11 @@ along with GCC.  If not, see <http://www.gnu.org/licenses/>.
 #undef	STARTFILE_SPEC
 #if defined HAVE_LD_PIE
 #define STARTFILE_SPEC \
-  "%{!shared: %{pg|p|profile:gcrt0.o%s;pie:Scrt1.o%s;static:crt0.o%s;:crt1.o%s}} \
+  "%{!shared: %{pg|p|profile:%{static:gcrt0.o%s;:gcrt1.o%s};pie:Scrt1.o%s;static:crt0.o%s;:crt1.o%s}} \
    crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
 #else
 #define STARTFILE_SPEC \
-  "%{!shared: %{pg|p|profile:gcrt0.o%s;static:crt0.o%s;:crt1.o%s}} \
+  "%{!shared: %{pg|p|profile:%{static:gcrt0.o%s;:gcrt1.o%s};static:crt0.o%s;:crt1.o%s}} \
    crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
 #endif
 

..., which results in the following spec changes:

@@ -17,7 +17,7 @@
  as %(asm_options) %m.s %A }  }
 
 *cpp:
-%{posix:-D_POSIX_SOURCE}
+%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}
 
 *cpp_options:
 %(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w} %{f*} %{g*:%{!g0:%{g*} %{!fno-working-directory:-fworking-directory}}} %{O*} %{undef} %{save-temps*:-fpch-preprocess}
@@ -53,7 +53,7 @@
 %{!static:--eh-frame-hdr} -m %(link_emulation) %{shared:-shared}   %{!shared:     %{!static:       %{rdynamic:-export-dynamic}       -dynamic-linker %(dynamic_linker)}       %{static:-static}}
 
 *lib:
-%{pthread:-lpthread} %{pg|p|profile:-lc_p;:-lc}
+%{pthread:-lpthread} %{shared:-lc}    %{!shared:%{mieee-fp:-lieee} %{profile:-lc_p}%{!profile:-lc}}
 
 *link_gomp:
 
@@ -62,7 +62,7 @@
 %{static|static-libgcc:-lgcc -lgcc_eh}%{!static:%{!static-libgcc:%{!shared-libgcc:-lgcc --as-needed -lgcc_s --no-as-needed}%{shared-libgcc:-lgcc_s%{!shared: -lgcc}}}}
 
 *startfile:
-%{!shared: %{pg|p|profile:gcrt0.o%s;pie:Scrt1.o%s;static:crt0.o%s;:crt1.o%s}}    crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}
+%{!shared: %{pg|p|profile:%{static:gcrt0.o%s;:gcrt1.o%s};pie:Scrt1.o%s;static:crt0.o%s;:crt1.o%s}}    crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}
 
 *cross_compile:
 0


Grüße
 Thomas

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] hurd: align -p and -pg behavior on Linux
  2016-02-24 22:47 ` Thomas Schwinge
@ 2016-02-24 23:18   ` Samuel Thibault
  2016-02-26  0:56     ` Samuel Thibault
  2016-03-29 22:00   ` Thomas Schwinge
  1 sibling, 1 reply; 10+ messages in thread
From: Samuel Thibault @ 2016-02-24 23:18 UTC (permalink / raw)
  To: Thomas Schwinge; +Cc: Roland McGrath, bug-hurd, gcc-patches

Thomas Schwinge, on Wed 24 Feb 2016 23:46:36 +0100, wrote:
> I guess getting -D_REENTRANT for -pthread won't do us any harm?

It won't.

> > --- gcc/config/i386/gnu.h.orig	2015-09-17 21:41:13.000000000 +0000
> > +++ gcc/config/i386/gnu.h	2015-09-17 23:03:57.000000000 +0000
> > @@ -27,11 +27,11 @@
> >  #undef	STARTFILE_SPEC
> >  #if defined HAVE_LD_PIE
> >  #define STARTFILE_SPEC \
> > -  "%{!shared: %{pg|p|profile:gcrt0.o%s;pie:Scrt1.o%s;static:crt0.o%s;:crt1.o%s}} \
> > +  "%{!shared: %{pg|p:gcrt1.o%s;profile:gcrt0.o%s;pie:Scrt1.o%s;static:crt0.o%s;:crt1.o%s}} \
> >     crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
> >  #else
> >  #define STARTFILE_SPEC \
> > -  "%{!shared: %{pg|p|profile:gcrt0.o%s;static:crt0.o%s;:crt1.o%s}} \
> > +  "%{!shared: %{pg|p:gcrt1.o%s;profile:gcrt0.o%s;static:crt0.o%s;:crt1.o%s}} \
> >     crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
> >  #endif
> 
> I think I understand what you're trying to do (avoid gcrt0.o being used
> for -pg or -p, and instead use gcrt1.o),

Yes.

> Likewise, for -pg or -p, I would assume that we
> still need gcrt0.o for static linking, and gcrt1.o for dynamic linking.

Mmm, probably indeed.

> -  "%{!shared: %{pg|p|profile:gcrt0.o%s;pie:Scrt1.o%s;static:crt0.o%s;:crt1.o%s}} \
> +  "%{!shared: %{pg|p|profile:%{static:gcrt0.o%s;:gcrt1.o%s};pie:Scrt1.o%s;static:crt0.o%s;:crt1.o%s}} \

Yes, that looks reasonable.

Samuel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] hurd: align -p and -pg behavior on Linux
  2016-02-24 23:18   ` Samuel Thibault
@ 2016-02-26  0:56     ` Samuel Thibault
  0 siblings, 0 replies; 10+ messages in thread
From: Samuel Thibault @ 2016-02-26  0:56 UTC (permalink / raw)
  To: Thomas Schwinge, Roland McGrath, bug-hurd, gcc-patches

Samuel Thibault, on Thu 25 Feb 2016 00:18:21 +0100, wrote:
> Thomas Schwinge, on Wed 24 Feb 2016 23:46:36 +0100, wrote:
> > I guess getting -D_REENTRANT for -pthread won't do us any harm?
> 
> It won't.

(Actually we've been using this in Debian for a long time).

Samuel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] hurd: align -p and -pg behavior on Linux
  2016-02-24 22:47 ` Thomas Schwinge
  2016-02-24 23:18   ` Samuel Thibault
@ 2016-03-29 22:00   ` Thomas Schwinge
  2016-03-29 22:04     ` Samuel Thibault
  1 sibling, 1 reply; 10+ messages in thread
From: Thomas Schwinge @ 2016-03-29 22:00 UTC (permalink / raw)
  To: gcc-patches; +Cc: bug-hurd, Samuel Thibault, Roland McGrath

[-- Attachment #1: Type: text/plain, Size: 3167 bytes --]

Hi!

On Wed, 24 Feb 2016 23:46:36 +0100, I wrote:
> On Sat, 19 Sep 2015 14:00:23 +0200, Samuel Thibault <samuel.thibault@gnu.org> wrote:
> > On Linux, -p and -pg do not make gcc link against libc_p.a, only
> > -profile does (as documented in r11246), and thus people expect -p
> 
> (Yo, 20 years ago...)
> 
> > and -pg to work without libc_p.a installed (it is actually even not
> > available any more in Debian).  We should thus rather make the Hurd port
> > do the same to avoid build failures.
> 
> Conceptually, ACK.

> I'm now testing the following patch:

Now committed in r234535:

commit 9b2eb5d3268cf674f9a6964479f20428e0b43500
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Tue Mar 29 21:17:53 2016 +0000

    [Hurd] Specs maintenance
    
    	gcc/
    	* config/gnu.h (CPP_SPEC, LIB_SPEC): Don't override.
    	* config/i386/gnu.h (STARTFILE_SPEC): Use gcrt1.o instead of
    	gcrt0.o if linking dynamically.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@234535 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog         | 6 ++++++
 gcc/config/gnu.h      | 8 --------
 gcc/config/i386/gnu.h | 4 ++--
 3 files changed, 8 insertions(+), 10 deletions(-)

diff --git gcc/ChangeLog gcc/ChangeLog
index 866531f..37e2504 100644
--- gcc/ChangeLog
+++ gcc/ChangeLog
@@ -1,3 +1,9 @@
+2016-03-29  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* config/gnu.h (CPP_SPEC, LIB_SPEC): Don't override.
+	* config/i386/gnu.h (STARTFILE_SPEC): Use gcrt1.o instead of
+	gcrt0.o if linking dynamically.
+
 2016-03-10  Jan Hubicka  <hubicka@ucw.cz>
 
 	PR ipa/70283
diff --git gcc/config/gnu.h gcc/config/gnu.h
index 1d98ec8..1dbecda 100644
--- gcc/config/gnu.h
+++ gcc/config/gnu.h
@@ -19,14 +19,6 @@ You should have received a copy of the GNU General Public License
 along with GCC.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-/* Provide GCC options for standard feature-test macros.  */
-#undef CPP_SPEC
-#define CPP_SPEC "%{posix:-D_POSIX_SOURCE}"
-
-/* Default C library spec.  */
-#undef LIB_SPEC
-#define LIB_SPEC "%{pthread:-lpthread} %{pg|p|profile:-lc_p;:-lc}"
-
 #undef GNU_USER_TARGET_OS_CPP_BUILTINS
 #define GNU_USER_TARGET_OS_CPP_BUILTINS()		\
     do {					\
diff --git gcc/config/i386/gnu.h gcc/config/i386/gnu.h
index c726d31..9d2f94f 100644
--- gcc/config/i386/gnu.h
+++ gcc/config/i386/gnu.h
@@ -27,11 +27,11 @@ along with GCC.  If not, see <http://www.gnu.org/licenses/>.
 #undef	STARTFILE_SPEC
 #if defined HAVE_LD_PIE
 #define STARTFILE_SPEC \
-  "%{!shared: %{pg|p|profile:gcrt0.o%s;pie:Scrt1.o%s;static:crt0.o%s;:crt1.o%s}} \
+  "%{!shared: %{pg|p|profile:%{static:gcrt0.o%s;:gcrt1.o%s};pie:Scrt1.o%s;static:crt0.o%s;:crt1.o%s}} \
    crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
 #else
 #define STARTFILE_SPEC \
-  "%{!shared: %{pg|p|profile:gcrt0.o%s;static:crt0.o%s;:crt1.o%s}} \
+  "%{!shared: %{pg|p|profile:%{static:gcrt0.o%s;:gcrt1.o%s};static:crt0.o%s;:crt1.o%s}} \
    crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
 #endif
 


Grüße
 Thomas

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] hurd: align -p and -pg behavior on Linux
  2016-03-29 22:00   ` Thomas Schwinge
@ 2016-03-29 22:04     ` Samuel Thibault
  0 siblings, 0 replies; 10+ messages in thread
From: Samuel Thibault @ 2016-03-29 22:04 UTC (permalink / raw)
  To: Thomas Schwinge; +Cc: gcc-patches, bug-hurd, Roland McGrath

Hello,

Thomas Schwinge, on Tue 29 Mar 2016 23:19:09 +0200, wrote:
> On Wed, 24 Feb 2016 23:46:36 +0100, I wrote:
> > On Sat, 19 Sep 2015 14:00:23 +0200, Samuel Thibault <samuel.thibault@gnu.org> wrote:
> > > On Linux, -p and -pg do not make gcc link against libc_p.a, only
> > > -profile does (as documented in r11246), and thus people expect -p
> > 
> > (Yo, 20 years ago...)
> > 
> > > and -pg to work without libc_p.a installed (it is actually even not
> > > available any more in Debian).  We should thus rather make the Hurd port
> > > do the same to avoid build failures.
> > 
> > Conceptually, ACK.
> 
> > I'm now testing the following patch:
> 
> Now committed in r234535:

Groovy :)

Could you also commit to gcc 5 branches so we get it in Debian without
having to poke Doko?

Samuel

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-03-29 21:21 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-19 12:33 [PATCH] hurd: align -p and -pg behavior on Linux Samuel Thibault
2015-09-28 21:51 ` Samuel Thibault
2015-10-11 18:29 ` Samuel Thibault
2016-01-14  0:10   ` Samuel Thibault
2015-10-12  8:37 ` Thomas Schwinge
2016-02-24 22:47 ` Thomas Schwinge
2016-02-24 23:18   ` Samuel Thibault
2016-02-26  0:56     ` Samuel Thibault
2016-03-29 22:00   ` Thomas Schwinge
2016-03-29 22:04     ` Samuel Thibault

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).