From 0ee9a62ef4b718ce7a66051f768c2bf5e1b62263 Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Wed, 6 Apr 2022 06:37:12 -0700 Subject: c++: Local symbols do not get module manglings Internal-linkage entity mangling is entirely implementation defined -- there's no ABI issue. Let's not mangle in any module attachment to them, it makes the symbols unnecessarily longer. gcc/cp/ * mangle.cc (maybe_write_module): Check external linkage. gcc/testsuite/ * g++.dg/modules/mod-sym-4.C: New. --- gcc/cp/mangle.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'gcc/cp/mangle.cc') diff --git a/gcc/cp/mangle.cc b/gcc/cp/mangle.cc index eb53e0e..75388e9 100644 --- a/gcc/cp/mangle.cc +++ b/gcc/cp/mangle.cc @@ -916,7 +916,10 @@ maybe_write_module (tree decl) if (!DECL_NAMESPACE_SCOPE_P (decl)) return; - if (TREE_CODE (decl) == NAMESPACE_DECL && DECL_NAME (decl)) + if (!TREE_PUBLIC (STRIP_TEMPLATE (decl))) + return; + + if (TREE_CODE (decl) == NAMESPACE_DECL) return; int m = get_originating_module (decl, true); -- cgit v1.1