git: 61ad1ddc5a81 - main - Improve broken-on-gcc checks

From: Brooks Davis <brooks_at_FreeBSD.org>
Date: Fri, 17 May 2024 20:51:11 UTC
The branch main has been updated by brooks:

URL: https://cgit.FreeBSD.org/src/commit/?id=61ad1ddc5a81b8f709509d34962e7f26ac163372

commit 61ad1ddc5a81b8f709509d34962e7f26ac163372
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2024-05-17 20:34:37 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2024-05-17 20:50:57 +0000

    Improve broken-on-gcc checks
    
    Mark powerpc* and riscv broken.
    
    Refactor and add a TRY_GCC_BROKEN option to build anyway.  This
    simplifies things for people trying to get gcc builds working
    while letting other developers know that they aren't expected to work.
    
    Reviewed by:    jhb, emaste
    Improves:       4c0dfd5959bd4 arm: fail early on gcc builds
    Differential Revision:  https://reviews.freebsd.org/D45230
---
 Makefile.inc1 | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/Makefile.inc1 b/Makefile.inc1
index 1bf4212b1d5e..90439adcbc09 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -175,7 +175,24 @@ LIBCOMPAT_INCLUDE_DIRS+= arm
 .if ((defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == "gcc") || \
      (!defined(X_COMPILER_TYPE) && ${COMPILER_TYPE} == "gcc"))
 .if ${TARGET} == "arm"
-.error "armv6/armv7 build are broken with gcc. See https://reviews.freebsd.org/D36754"
+_GCC_BROKEN="https://reviews.freebsd.org/D36754"
+.endif
+.if ${TARGET_ARCH} == "powerpc"
+_GCC_BROKEN=Missing atomic builtins in libc++.
+.endif
+.if ${TARGET_ARCH:Mpowerpc64*}
+_GCC_BROKEN=libsys.so.7.full has a LOAD segment with RWX permissions.
+.endif
+.if ${TARGET} == "riscv"
+_GCC_BROKEN=boot code linker script issues.
+.endif
+.if defined(_GCC_BROKEN)
+.warning Target ${TARGET} is broken with GCC: ${_GCC_BROKEN}
+.if defined(TRY_GCC_BROKEN)
+.warning Trying build anyway.
+.else
+.error Avoiding broken build.  Define TRY_GCC_BROKEN to try anyway.
+.endif
 .endif
 .endif