[Bug target/91349] [9 regression] powerpc*-*-freebsd* defines _GNU_SOURCE
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91349 --- Comment #9 from Alan Modra --- > I have no idea which parts are GNU-specific, and which parts power actually > needs. Yeah, I was being cheeky in suggesting you provide the effort needed. > 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. If #undefs are a measure of "design smell" then rs6000/freebsd64.h already had forty before I added two more. Many of those are there due to including other headers that define OS specific macros unsuitable for freebsd. The mess is mostly due to rs6000/sysv4.h -mcall- support. Without that I may not have needed to include gnu-user.h before rs6000/sysv4.h everywhere. The -mcall stuff needs to disappear before any meaningful untangling of OS-specific macros in the rs6000 header files can be done.
[Bug target/91349] [9 regression] powerpc*-*-freebsd* defines _GNU_SOURCE
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91349 --- Comment #8 from Jonathan Wakely --- (assuming something like TARGET_REALLY_GNU existed)
[Bug target/91349] [9 regression] powerpc*-*-freebsd* defines _GNU_SOURCE
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91349 --- Comment #7 from Jonathan Wakely --- 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
[Bug target/91349] [9 regression] powerpc*-*-freebsd* defines _GNU_SOURCE
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91349 --- Comment #6 from Alan Modra --- > Wouldn't it have been cleaner to split gnu_user.h I agree. Please do.
[Bug target/91349] [9 regression] powerpc*-*-freebsd* defines _GNU_SOURCE
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91349 --- Comment #5 from Jonathan Wakely --- (In reply to Alan Modra from comment #1) > Huh, it looks like I missed adding the following to freebsd64.h: > > #undef CPLUSPLUS_CPP_SPEC > #undef LINK_GCC_C_SEQUENCE_SPEC Which of course only works if those are only set by gnu-user.h and are never used for something else that freebsd.h and freebsd64.h *do* want. Wouldn't it have been cleaner to split gnu_user.h into the non-GNU parts (that you want for powerpc) and the GNU parts (only relevant to actual GNU userspace targets) and so not include gnu_user.h on irrelevant targets? The current solution seems klugy and fragile.
[Bug target/91349] [9 regression] powerpc*-*-freebsd* defines _GNU_SOURCE
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91349 Alan Modra changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED Target Milestone|--- |9.2 --- Comment #4 from Alan Modra --- Fixed.
[Bug target/91349] [9 regression] powerpc*-*-freebsd* defines _GNU_SOURCE
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91349 --- Comment #3 from Alan Modra --- Author: amodra Date: Mon Aug 5 01:53:31 2019 New Revision: 274106 URL: https://gcc.gnu.org/viewcvs?rev=274106=gcc=rev Log: PR91349, powerpc64*-*-freebsd* defines _GNU_SOURCE rev 266496 (git ab6b1bb456) undefined some macros in rs6000/freebsd.h but missed doing the same in rs6000/freebsd64.h. PR target/91349 * config/rs6000/freebsd64.h (CPLUSPLUS_CPP_SPEC), (LINK_GCC_C_SEQUENCE_SPEC): Undef. Modified: branches/gcc-9-branch/gcc/ChangeLog branches/gcc-9-branch/gcc/config/rs6000/freebsd64.h
[Bug target/91349] [9 regression] powerpc*-*-freebsd* defines _GNU_SOURCE
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91349 --- Comment #2 from Alan Modra --- Author: amodra Date: Mon Aug 5 01:52:33 2019 New Revision: 274105 URL: https://gcc.gnu.org/viewcvs?rev=274105=gcc=rev Log: PR91349, powerpc64*-*-freebsd* defines _GNU_SOURCE rev 266496 (git ab6b1bb456) undefined some macros in rs6000/freebsd.h but missed doing the same in rs6000/freebsd64.h. PR target/91349 * config/rs6000/freebsd64.h (CPLUSPLUS_CPP_SPEC), (LINK_GCC_C_SEQUENCE_SPEC): Undef. Modified: trunk/gcc/ChangeLog trunk/gcc/config/rs6000/freebsd64.h
[Bug target/91349] [9 regression] powerpc*-*-freebsd* defines _GNU_SOURCE
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91349 Alan Modra changed: What|Removed |Added Status|UNCONFIRMED |ASSIGNED Last reconfirmed||2019-08-04 Assignee|unassigned at gcc dot gnu.org |amodra at gmail dot com Ever confirmed|0 |1 --- Comment #1 from Alan Modra --- Huh, it looks like I missed adding the following to freebsd64.h: #undef CPLUSPLUS_CPP_SPEC #undef LINK_GCC_C_SEQUENCE_SPEC