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 <nathanielosh...@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 diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc index d54f1c88366..3e9b63c1e56 100644 --- a/gcc/cp/module.cc +++ b/gcc/cp/module.cc @@ -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; diff --git a/gcc/testsuite/g++.dg/modules/xtreme-header-8.C b/gcc/testsuite/g++.dg/modules/xtreme-header-8.C new file mode 100644 index 00000000000..9da4e01cc68 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/xtreme-header-8.C @@ -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" +} -- 2.46.0