@@ -13135,6 +13135,11 @@ depset::hash::is_tu_local_entity (tree decl, bool explain/*=false*/)
linkage_kind kind = decl_linkage (decl);
if (kind == lk_internal)
{
+ /* But don't consider weak entities as TU-local. */
+ tree inner = STRIP_TEMPLATE (decl);
+ if (VAR_OR_FUNCTION_DECL_P (inner) && DECL_WEAK (inner))
+ return false;
+
if (explain)
inform (loc, "%qD declared with internal linkage", decl);
return true;
new file mode 100644
@@ -0,0 +1,8 @@
+// PR c++/115126
+// { dg-additional-options "-fmodules-ts -Wignored-exposures" }
+// { dg-module-cmi xstd }
+
+export module xstd;
+extern "C++" {
+ #include "xtreme-header.h"
+}
This follows up on some more test failures reported by Linaro on aarch64. The testcase also depends on the libgcc/libstdc++ patch here: https://gcc.gnu.org/pipermail/gcc-patches/2024-September/663749.html To avoid an intermediary state where aarch64 regtests fail I could include the module.cc changes in patch 6 of this series. Let me know if you'd like me to send through a full updated v2 patch series instead of having all these 'extra' patches fixing issues on other platforms... Bootstrapped and regtested on x86_64-pc-linux and aarch64-unknown-linux-gnu, OK for trunk? -- >8 -- On some targets the gthreads support code uses weakref aliases on entities marked 'static'. By the C++ standard these have internal linkage, but we really shouldn't consider these as TU-local. This provides enough of the puzzle to pass the testcase in the PR on at least x86_64-linux and aarch64-linux; we'll see what happens on other targets. PR c++/115126 gcc/cp/ChangeLog: * module.cc (depset::hash::is_tu_local_entity): Don't treat weak entities as TU-local. gcc/testsuite/ChangeLog: * g++.dg/modules/xtreme-header-8.C: New test. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com> --- gcc/cp/module.cc | 5 +++++ gcc/testsuite/g++.dg/modules/xtreme-header-8.C | 8 ++++++++ 2 files changed, 13 insertions(+) create mode 100644 gcc/testsuite/g++.dg/modules/xtreme-header-8.C