crosstools: Fix host GCC char8_t bootstrap issue in libcody and clean binutils 2.32 patch - #1024
Conversation
… binutils 2.32 patch
de97b51 to
f5de027
Compare
|
Thanks for looking at this. I tested all three hunks against the base commit of this PR ( binutils 2.32: the removed hunk is not a duplicate, and removing it breaks ldThe description says the hunk is "a duplicate file creation hunk ... which caused patch application failures with modern It is not a duplicate. In the base blob there is exactly one It applies cleanly. Pristine binutils 2.32, GNU patch 2.8, using the same invocation the build uses ( Applying this PR's version to a pristine tree removes the file but leaves all four references to it:
Two things make this wider than a big-endian corner case. On what you may have hit: AROS records applied patches with Could you restore this file? If the goal is really to drop big-endian ARM, that needs doing completely and across all six patches, including the BFD side ( gcc 16.2.0 libcody: not neededUpstream 16.2.0 already handles this. #if __cpp_char8_t >= 201811
template<unsigned I>
constexpr char S2C (char8_t const (&s)[I]) { ... }
#else
template<unsigned I>
constexpr char S2C (char const (&s)[I]) { ... }
#endifalong with The added function could not take effect in any case:
It also lands between the copyright line and gcc 15.2.0 libcody: real problem, but this fix cannot workThis one is chasing something real. 15.2.0 has no char8_t handling: // C++11 doesn't have utf8 character literals :(
template<unsigned I>
constexpr char S2C (char const (&s)[I])while The three points above still apply, plus a fourth that settles it: the failing calls are in The fix is to backport what upstream did for 16.x, into --- gcc-15.2.0/libcody/cody.hh
+++ gcc-15.2.0.aros/libcody/cody.hh
@@ -47,12 +47,21 @@
// C++11 doesn't have utf8 character literals :(
+#if __cpp_char8_t >= 201811
+template<unsigned I>
+constexpr char S2C (char8_t const (&s)[I])
+{
+ static_assert (I == 2, "only single octet strings may be converted");
+ return s[0];
+}
+#else
template<unsigned I>
constexpr char S2C (char const (&s)[I])
{
static_assert (I == 2, "only single octet strings may be converted");
return s[0];
}
+#endif
/// Internal buffering class. Used to concatenate outgoing messages
/// and Lex incoming ones.
@@ -123,6 +132,13 @@
Space ();
Append (str, maybe_quote, len);
}
+#if __cpp_char8_t >= 201811
+ void AppendWord (char8_t const *str, bool maybe_quote = false,
+ size_t len = ~size_t (0))
+ {
+ AppendWord ((const char *) str, maybe_quote, len);
+ }
+#endif
/// Add a word as with AppendWord
/// @param str the string to append
/// @param maybe_quote string might need quoting, as for Append
@@ -264,6 +280,12 @@
: string (s), cat (STRING), code (c)
{
}
+#if __cpp_char8_t >= 201811
+ Packet (unsigned c, const char8_t *s)
+ : string ((const char *) s), cat (STRING), code (c)
+ {
+ }
+#endif
Packet (unsigned c, std::vector<std::string> &&v)
: vector (std::move (v)), cat (VECTOR), code (c)
{Upstream writes the guard as Summary
If you can post the exact compiler error you saw for 15.2.0, that would confirm the backport covers it, since there may be further call sites in |
Summary
Fixes cross-compiler bootstrap build failures when compiling AROS on modern Linux/macOS host systems equipped with recent compilers (GCC 14/15/16, modern Clang) where C++20
char8_tstrict typing is enabled by default.Details
#if __cpp_char8_t >= 201811L inline char S2C(char8_t c) { return static_cast<char>(c); }togcc-15.2.0-aros.diffandgcc-16.2.0-aros.diff. This resolves type mismatch errors inlibcody/buffer.ccduring the host stage of the toolchain build.ld/emulparams/armelfb_aros.sh) inbinutils-2.32-aros.diffwhich caused patch application failures with modernpatchutilities.Testing