Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/gpl3 gcc: fix build with clang++ HOST_CXX



details:   https://anonhg.NetBSD.org/src/rev/3738954345c7
branches:  trunk
changeset: 375893:3738954345c7
user:      lukem <lukem%NetBSD.org@localhost>
date:      Fri May 19 23:28:20 2023 +0000

description:
gcc: fix build with clang++ HOST_CXX

Define HOSTPROG_CXX before .include anything that brings in bsd.own.mk.
This ensures that HOST_DBG (etc) gets assigned before HOST_CFLAGS
and HOST_CXXFLAGS is created.

backend: .include <bsd.init.mk> much earlier, as per the other directories.
Fixes backend build when using clang++ as the host compiler (e.g., macOS),
because backend host tools are now built with -O.
Inspired by https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=255760

Note that gcc.old/Makefile.prog may be mis-used because it defines HOSTPROG_CXX
and this Makefile fragment is included after bsd.*.mk in other Makefiles,
but they seem to build ok so leaving it alone for now.

Fixes PR toolchain/57014

diffstat:

 external/gpl3/gcc.old/usr.bin/backend/Makefile       |  10 +++++-----
 external/gpl3/gcc.old/usr.bin/common-target/Makefile |   5 ++---
 external/gpl3/gcc.old/usr.bin/common/Makefile        |   5 ++---
 external/gpl3/gcc.old/usr.bin/frontend/Makefile      |   5 ++---
 external/gpl3/gcc.old/usr.bin/libcpp/Makefile        |   5 ++---
 external/gpl3/gcc.old/usr.bin/libdecnumber/Makefile  |   5 ++---
 external/gpl3/gcc/usr.bin/backend/Makefile           |  10 +++++-----
 external/gpl3/gcc/usr.bin/common-target/Makefile     |   5 ++---
 external/gpl3/gcc/usr.bin/common/Makefile            |   5 ++---
 external/gpl3/gcc/usr.bin/frontend/Makefile          |   5 ++---
 external/gpl3/gcc/usr.bin/libcpp/Makefile            |   5 ++---
 external/gpl3/gcc/usr.bin/libdecnumber/Makefile      |   5 ++---
 12 files changed, 30 insertions(+), 40 deletions(-)

diffs (260 lines):

diff -r ceb1a044f03f -r 3738954345c7 external/gpl3/gcc.old/usr.bin/backend/Makefile
--- a/external/gpl3/gcc.old/usr.bin/backend/Makefile    Fri May 19 19:50:59 2023 +0000
+++ b/external/gpl3/gcc.old/usr.bin/backend/Makefile    Fri May 19 23:28:20 2023 +0000
@@ -1,7 +1,11 @@
-#      $NetBSD: Makefile,v 1.16 2023/02/20 02:12:29 mrg Exp $
+#      $NetBSD: Makefile,v 1.17 2023/05/19 23:28:21 lukem Exp $
 
+HOSTPROG_CXX=  1
 LIBISPRIVATE=  yes
 
+# For ../Makefile.inc and bsd.own.mk
+.include <bsd.init.mk>
+
 LIB=           backend
 
 SRCS=          ${G_OBJS:S,analyzer/,,} ${G_out_file:T} regsub.c
@@ -28,10 +32,6 @@ CPPFLAGS.lto-streamer-in.c+= -DTARGET_MA
 
 HOST_CXXFLAGS+=        -std=gnu++98
 
-HOSTPROG_CXX=  1
-
-.include <bsd.init.mk>
-
 HOST_LIBIBERTYOBJ!=    cd ${.CURDIR}/../host-libiberty && ${PRINTOBJDIR}
 
 .include <bsd.lib.mk>
diff -r ceb1a044f03f -r 3738954345c7 external/gpl3/gcc.old/usr.bin/common-target/Makefile
--- a/external/gpl3/gcc.old/usr.bin/common-target/Makefile      Fri May 19 19:50:59 2023 +0000
+++ b/external/gpl3/gcc.old/usr.bin/common-target/Makefile      Fri May 19 23:28:20 2023 +0000
@@ -1,5 +1,6 @@
-#      $NetBSD: Makefile,v 1.9 2023/02/20 02:12:29 mrg Exp $
+#      $NetBSD: Makefile,v 1.10 2023/05/19 23:28:21 lukem Exp $
 
+HOSTPROG_CXX=  1
 LIBISPRIVATE=  yes
 
 # For ../Makefile.inc and bsd.own.mk
@@ -43,8 +44,6 @@ HOST_CPPFLAGS+=       -DGENERATOR_FILE
 MKPIC:=                no
 MKPICLIB:=     no
 
-HOSTPROG_CXX=  1
-
 .include <bsd.lib.mk>
 
 # Force using C++ for this
diff -r ceb1a044f03f -r 3738954345c7 external/gpl3/gcc.old/usr.bin/common/Makefile
--- a/external/gpl3/gcc.old/usr.bin/common/Makefile     Fri May 19 19:50:59 2023 +0000
+++ b/external/gpl3/gcc.old/usr.bin/common/Makefile     Fri May 19 23:28:20 2023 +0000
@@ -1,5 +1,6 @@
-#      $NetBSD: Makefile,v 1.10 2023/02/20 02:12:29 mrg Exp $
+#      $NetBSD: Makefile,v 1.11 2023/05/19 23:28:21 lukem Exp $
 
+HOSTPROG_CXX=  1
 LIBISPRIVATE=  yes
 
 # For ../Makefile.inc and bsd.own.mk
@@ -21,8 +22,6 @@ CPPFLAGS+=    -I${GCCARCH} -I${BACKENDOBJ} 
 MKPIC:=                no
 MKPICLIB:=     no
 
-HOSTPROG_CXX=  1
-
 COPTS.diagnostic.c=    -Wno-stack-protector
 COPTS.intl.c=          -Wno-stack-protector
 
diff -r ceb1a044f03f -r 3738954345c7 external/gpl3/gcc.old/usr.bin/frontend/Makefile
--- a/external/gpl3/gcc.old/usr.bin/frontend/Makefile   Fri May 19 19:50:59 2023 +0000
+++ b/external/gpl3/gcc.old/usr.bin/frontend/Makefile   Fri May 19 23:28:20 2023 +0000
@@ -1,5 +1,6 @@
-#      $NetBSD: Makefile,v 1.12 2023/02/20 02:12:30 mrg Exp $
+#      $NetBSD: Makefile,v 1.13 2023/05/19 23:28:21 lukem Exp $
 
+HOSTPROG_CXX=  1
 LIBISPRIVATE=  yes
 
 # For ../Makefile.inc and bsd.own.mk
@@ -9,8 +10,6 @@ LIB=           frontend
 
 SRCS=          gcc.c version.c prefix.c
 
-HOSTPROG_CXX=  1
-
 .include "../Makefile.driver"
 .include "../Makefile.target-defines"
 
diff -r ceb1a044f03f -r 3738954345c7 external/gpl3/gcc.old/usr.bin/libcpp/Makefile
--- a/external/gpl3/gcc.old/usr.bin/libcpp/Makefile     Fri May 19 19:50:59 2023 +0000
+++ b/external/gpl3/gcc.old/usr.bin/libcpp/Makefile     Fri May 19 23:28:20 2023 +0000
@@ -1,5 +1,6 @@
-#      $NetBSD: Makefile,v 1.11 2023/02/20 02:12:36 mrg Exp $
+#      $NetBSD: Makefile,v 1.12 2023/05/19 23:28:21 lukem Exp $
 
+HOSTPROG_CXX=  1
 LIBISPRIVATE=  yes
 
 .include <bsd.init.mk>
@@ -13,8 +14,6 @@ CPPFLAGS+=    -I${.CURDIR} -I${.CURDIR}/arc
                ${G_INCLUDES:M-I*:N-I.*} \
                -DPREFIX=\"/usr\"
 
-HOSTPROG_CXX=  1
-
 .include <bsd.lib.mk>
 
 COPTS+=        -Wno-stack-protector
diff -r ceb1a044f03f -r 3738954345c7 external/gpl3/gcc.old/usr.bin/libdecnumber/Makefile
--- a/external/gpl3/gcc.old/usr.bin/libdecnumber/Makefile       Fri May 19 19:50:59 2023 +0000
+++ b/external/gpl3/gcc.old/usr.bin/libdecnumber/Makefile       Fri May 19 23:28:20 2023 +0000
@@ -1,8 +1,9 @@
-#      $NetBSD: Makefile,v 1.11 2023/02/20 02:12:36 mrg Exp $
+#      $NetBSD: Makefile,v 1.12 2023/05/19 23:28:21 lukem Exp $
 
 DIST=          ${GCCDIST}
 GNUHOSTDIST=   ${DIST}
 
+HOSTPROG_CXX=  1
 LIBISPRIVATE=   yes
 
 .include <bsd.init.mk>
@@ -17,8 +18,6 @@ CPPFLAGS+=    -I${DIST}/libgcc
 COPTS.decNumber.c=-O0
 .endif
 
-HOSTPROG_CXX=  1
-
 .include <bsd.lib.mk>
 
 # Force using C++ for this
diff -r ceb1a044f03f -r 3738954345c7 external/gpl3/gcc/usr.bin/backend/Makefile
--- a/external/gpl3/gcc/usr.bin/backend/Makefile        Fri May 19 19:50:59 2023 +0000
+++ b/external/gpl3/gcc/usr.bin/backend/Makefile        Fri May 19 23:28:20 2023 +0000
@@ -1,7 +1,11 @@
-#      $NetBSD: Makefile,v 1.66 2021/09/18 01:47:08 christos Exp $
+#      $NetBSD: Makefile,v 1.67 2023/05/19 23:28:20 lukem Exp $
 
+HOSTPROG_CXX=  1
 LIBISPRIVATE=  yes
 
+# For ../Makefile.inc and bsd.own.mk
+.include <bsd.init.mk>
+
 LIB=           backend
 
 SRCS=          ${G_OBJS:S,analyzer/,,} ${G_out_file:T} regsub.c
@@ -28,10 +32,6 @@ CPPFLAGS.lto-streamer-in.c+= -DTARGET_MA
 
 HOST_CXXFLAGS+=        -std=gnu++98
 
-HOSTPROG_CXX=  1
-
-.include <bsd.init.mk>
-
 HOST_LIBIBERTYOBJ!=    cd ${.CURDIR}/../host-libiberty && ${PRINTOBJDIR}
 
 .include <bsd.lib.mk>
diff -r ceb1a044f03f -r 3738954345c7 external/gpl3/gcc/usr.bin/common-target/Makefile
--- a/external/gpl3/gcc/usr.bin/common-target/Makefile  Fri May 19 19:50:59 2023 +0000
+++ b/external/gpl3/gcc/usr.bin/common-target/Makefile  Fri May 19 23:28:20 2023 +0000
@@ -1,5 +1,6 @@
-#      $NetBSD: Makefile,v 1.11 2021/09/18 01:47:08 christos Exp $
+#      $NetBSD: Makefile,v 1.12 2023/05/19 23:28:20 lukem Exp $
 
+HOSTPROG_CXX=  1
 LIBISPRIVATE=  yes
 
 # For ../Makefile.inc and bsd.own.mk
@@ -43,8 +44,6 @@ HOST_CPPFLAGS+=       -DGENERATOR_FILE
 MKPIC:=                no
 MKPICLIB:=     no
 
-HOSTPROG_CXX=  1
-
 .include <bsd.lib.mk>
 
 # Force using C++ for this
diff -r ceb1a044f03f -r 3738954345c7 external/gpl3/gcc/usr.bin/common/Makefile
--- a/external/gpl3/gcc/usr.bin/common/Makefile Fri May 19 19:50:59 2023 +0000
+++ b/external/gpl3/gcc/usr.bin/common/Makefile Fri May 19 23:28:20 2023 +0000
@@ -1,5 +1,6 @@
-#      $NetBSD: Makefile,v 1.11 2021/09/18 01:47:08 christos Exp $
+#      $NetBSD: Makefile,v 1.12 2023/05/19 23:28:20 lukem Exp $
 
+HOSTPROG_CXX=  1
 LIBISPRIVATE=  yes
 
 # For ../Makefile.inc and bsd.own.mk
@@ -21,8 +22,6 @@ CPPFLAGS+=    -I${GCCARCH} -I${BACKENDOBJ} 
 MKPIC:=                no
 MKPICLIB:=     no
 
-HOSTPROG_CXX=  1
-
 COPTS.diagnostic.c=    -Wno-stack-protector
 COPTS.intl.c=          -Wno-stack-protector
 
diff -r ceb1a044f03f -r 3738954345c7 external/gpl3/gcc/usr.bin/frontend/Makefile
--- a/external/gpl3/gcc/usr.bin/frontend/Makefile       Fri May 19 19:50:59 2023 +0000
+++ b/external/gpl3/gcc/usr.bin/frontend/Makefile       Fri May 19 23:28:20 2023 +0000
@@ -1,5 +1,6 @@
-#      $NetBSD: Makefile,v 1.14 2021/09/18 01:47:08 christos Exp $
+#      $NetBSD: Makefile,v 1.15 2023/05/19 23:28:20 lukem Exp $
 
+HOSTPROG_CXX=  1
 LIBISPRIVATE=  yes
 
 # For ../Makefile.inc and bsd.own.mk
@@ -9,8 +10,6 @@ LIB=           frontend
 
 SRCS=          gcc.c version.c prefix.c
 
-HOSTPROG_CXX=  1
-
 .include "../Makefile.driver"
 .include "../Makefile.target-defines"
 
diff -r ceb1a044f03f -r 3738954345c7 external/gpl3/gcc/usr.bin/libcpp/Makefile
--- a/external/gpl3/gcc/usr.bin/libcpp/Makefile Fri May 19 19:50:59 2023 +0000
+++ b/external/gpl3/gcc/usr.bin/libcpp/Makefile Fri May 19 23:28:20 2023 +0000
@@ -1,5 +1,6 @@
-#      $NetBSD: Makefile,v 1.9 2021/09/18 01:47:08 christos Exp $
+#      $NetBSD: Makefile,v 1.10 2023/05/19 23:28:21 lukem Exp $
 
+HOSTPROG_CXX=  1
 LIBISPRIVATE=  yes
 
 .include <bsd.init.mk>
@@ -13,8 +14,6 @@ CPPFLAGS+=    -I${.CURDIR} -I${.CURDIR}/arc
                ${G_INCLUDES:M-I*:N-I.*} \
                -DPREFIX=\"/usr\"
 
-HOSTPROG_CXX=  1
-
 .include <bsd.lib.mk>
 
 COPTS+=        -Wno-stack-protector
diff -r ceb1a044f03f -r 3738954345c7 external/gpl3/gcc/usr.bin/libdecnumber/Makefile
--- a/external/gpl3/gcc/usr.bin/libdecnumber/Makefile   Fri May 19 19:50:59 2023 +0000
+++ b/external/gpl3/gcc/usr.bin/libdecnumber/Makefile   Fri May 19 23:28:20 2023 +0000
@@ -1,8 +1,9 @@
-#      $NetBSD: Makefile,v 1.8 2021/09/18 01:47:09 christos Exp $
+#      $NetBSD: Makefile,v 1.9 2023/05/19 23:28:21 lukem Exp $
 
 DIST=          ${GCCDIST}
 GNUHOSTDIST=   ${DIST}
 
+HOSTPROG_CXX=  1
 LIBISPRIVATE=   yes
 
 .include <bsd.init.mk>
@@ -17,8 +18,6 @@ CPPFLAGS+=    -I${DIST}/libgcc
 COPTS.decNumber.c=-O0
 .endif
 
-HOSTPROG_CXX=  1
-
 .include <bsd.lib.mk>
 
 # Force using C++ for this



Home | Main Index | Thread Index | Old Index