aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2021-07-26 19:04:24 +0200
committerIain Buclaw <ibuclaw@gdcproject.org>2021-07-30 12:51:36 +0200
commite22b7ae15b09aef1ec05dec6e24580d0063e9ab1 (patch)
treef8d9d0f1038f3272fc41fd26dc0f3b1660cf91c1
parent99d6d3d92f24c249314e0509f1ffa68f8450495e (diff)
downloadgcc-e22b7ae15b09aef1ec05dec6e24580d0063e9ab1.zip
gcc-e22b7ae15b09aef1ec05dec6e24580d0063e9ab1.tar.gz
gcc-e22b7ae15b09aef1ec05dec6e24580d0063e9ab1.tar.bz2
d: Set COMDAT and visibility of thunks only if they are public.
It is not expected to have a member function that can be non-public, but this guards against any internal errors that might occur should that ever change in the front-end. gcc/d/ChangeLog: * decl.cc (make_thunk): Set COMDAT and visibility of thunks only if they are public.
-rw-r--r--gcc/d/decl.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/d/decl.cc b/gcc/d/decl.cc
index 59991c3..cf61cd4 100644
--- a/gcc/d/decl.cc
+++ b/gcc/d/decl.cc
@@ -1781,9 +1781,12 @@ make_thunk (FuncDeclaration *decl, int offset)
DECL_ARTIFICIAL (thunk) = 1;
DECL_DECLARED_INLINE_P (thunk) = 0;
- DECL_VISIBILITY (thunk) = DECL_VISIBILITY (function);
- DECL_COMDAT (thunk) = DECL_COMDAT (function);
- DECL_WEAK (thunk) = DECL_WEAK (function);
+ if (TREE_PUBLIC (thunk))
+ {
+ DECL_VISIBILITY (thunk) = DECL_VISIBILITY (function);
+ DECL_COMDAT (thunk) = DECL_COMDAT (function);
+ DECL_WEAK (thunk) = DECL_WEAK (function);
+ }
/* When the thunk is for an extern C++ function, let C++ do the thunk
generation and just reference the symbol as extern, instead of