NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
toolchain/58271: external/gpl3/gcc/dist/gcc/system.h: Early inclusion of "safe-type.h" causes toolchain build failure on macOS 14.5
>Number: 58271
>Category: toolchain
>Synopsis: external/gpl3/gcc/dist/gcc/system.h: Early inclusion of "safe-type.h" causes toolchain build failure on macOS 14.5
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: toolchain-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue May 21 01:00:00 +0000 2024
>Originator: Timothy McIntosh
>Release: netbsd-10
>Organization:
>Environment:
% uname -a
Darwin m2.astro.net 23.5.0 Darwin Kernel Version 23.5.0: Wed May 1 20:19:05 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T8112 arm64
% clang --version
Apple clang version 15.0.0 (clang-1500.3.9.4)
Target: arm64-apple-darwin23.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
% xcodebuild -version -sdk macosx
MacOSX14.5.sdk - macOS 14.5 (macosx14.5)
SDKVersion: 14.5
Path: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk
PlatformVersion: 14.5
PlatformPath: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform
BuildID: A011F280-02DD-11EF-ADB6-B65E12B1A625
ProductBuildVersion: 23F73
ProductCopyright: 1983-2024 Apple Inc.
ProductName: macOS
ProductUserVisibleVersion: 14.5
ProductVersion: 14.5
iOSSupportVersion: 17.5
>Description:
I was attempting to build a toolchain for NetBSD/sgimips from the netbsd-10 branch pulled from git today, using the following build command:
./build.sh -U -u -j8 -m sgimips -O ../sgimips tools
This failed during building of gcov.c with errors in clang's `usr/include/c++/v1/__locale` file (pulled in via system.h's inclusion of <map>), at line 550 and later...
_LIBCPP_INLINE_VISIBILITY
char_type toupper(char_type __c) const
{
return do_toupper(__c);
}
...due to a bad interaction with the macros (including toupper(c)) defined at the end of safe-ctype.h.
I was able to work around this problem by moving inclusion of "safe-ctype.h" to the end of `system.h`, as shown in the patch below, which minimizes the exposure of system headers to the nonstandard macro definitions in safe-ctype.h.
In general, it seems unsafe to redefine reserved identifiers as is done in safe-ctype.h.
>How-To-Repeat:
Run the following on macOS 14.5 with Xcode version & SDK documented above:
git clone --branch netbsd-10 --depth 1 https://github.com/NetBSD/src.git src
cd src
./build.sh -U -u -j8 -m sgimips -O ../sgimips tools
>Fix:
diff --git a/external/gpl3/gcc/dist/gcc/system.h b/external/gpl3/gcc/dist/gcc/system.h
index 239496698..1077282ba 100644
--- a/external/gpl3/gcc/dist/gcc/system.h
+++ b/external/gpl3/gcc/dist/gcc/system.h
@@ -209,11 +209,6 @@ extern int fprintf_unlocked (FILE *, const char *, ...);
#endif
#endif
-/* There are an extraordinary number of issues with <ctype.h>.
- The last straw is that it varies with the locale. Use libiberty's
- replacement instead. */
-#include "safe-ctype.h"
-
#include <sys/types.h>
#include <errno.h>
@@ -1213,6 +1208,11 @@ helper_const_non_const_cast (const char *p)
/* Get definitions of HOST_WIDE_INT. */
#include "hwint.h"
+/* There are an extraordinary number of issues with <ctype.h>.
+ The last straw is that it varies with the locale. Use libiberty's
+ replacement instead. */
+#include "safe-ctype.h"
+
typedef int sort_r_cmp_fn (const void *, const void *, void *);
void qsort_chk (void *, size_t, size_t, sort_r_cmp_fn *, void *);
void gcc_sort_r (void *, size_t, size_t, sort_r_cmp_fn *, void *);
Home |
Main Index |
Thread Index |
Old Index