https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91349

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I have no idea which parts are GNU-specific, and which parts power actually
needs. I can just see that your change to include gnu-user.h on non-GNU targets
seems like a design smell, and the requirement to kluge around it by #undef'ing
things later confirms it.

The gnu-user.h file has several comments that talk about "GNU userspace" and
none at all that make it obvious it's also used on unrelated targets like
FreeBSD. So it's not obvious that changes to that file now need to consider the
effect on non-GNU targets.

Your comments in rs6000/freebsd.h and rs6000/freebsd64.h just say "Undef
gnu-user.h macros we don't want." Those comments would be more use if they
mentioned why gnu-user.h macros are defined in the first place for FreeBSD and
NetBSD.

And what about all the other non-GNU targets affected by r266496? Is
_GNU_SOURCE now defined for RTEMS? VxWorks?

A smaller (but still smelly) fix would be something like:

--- a/gcc/config/gnu-user.h
+++ b/gcc/config/gnu-user.h
@@ -90,9 +90,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If
not, see
 #define CC1_SPEC GNU_USER_TARGET_CC1_SPEC
 #endif

+#ifdef TARGET_REALLY_GNU
 /* The GNU C++ standard library requires that these macros be defined.  */
 #undef CPLUSPLUS_CPP_SPEC
 #define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)"
+#endif

 #define GNU_USER_TARGET_NO_PTHREADS_LIB_SPEC \
   "%{shared:-lc} \
@@ -113,8 +115,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. 
If not, see
   "%{static|static-pie:--start-group} %G %{!nolibc:%L} \
    %{static|static-pie:--end-group}%{!static:%{!static-pie:%G}}"

+#ifdef TARGET_REALLY_GNU
 #undef LINK_GCC_C_SEQUENCE_SPEC
 #define LINK_GCC_C_SEQUENCE_SPEC GNU_USER_TARGET_LINK_GCC_C_SEQUENCE_SPEC
+#endif

 /* Use --as-needed -lgcc_s for eh support.  */
 #ifdef HAVE_LD_AS_NEEDED

Reply via email to