aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/mangle.cc
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2022-04-06 06:37:12 -0700
committerNathan Sidwell <nathan@acm.org>2022-05-13 07:18:52 -0700
commit0ee9a62ef4b718ce7a66051f768c2bf5e1b62263 (patch)
tree9e941fa106bf0b71c2fa471b2d336215cd952e68 /gcc/cp/mangle.cc
parentaf34279921f4bb95b07c0be7fce9baeffafcb53d (diff)
downloadgcc-0ee9a62ef4b718ce7a66051f768c2bf5e1b62263.zip
gcc-0ee9a62ef4b718ce7a66051f768c2bf5e1b62263.tar.gz
gcc-0ee9a62ef4b718ce7a66051f768c2bf5e1b62263.tar.bz2
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.
Diffstat (limited to 'gcc/cp/mangle.cc')
-rw-r--r--gcc/cp/mangle.cc5
1 files changed, 4 insertions, 1 deletions
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);