aboutsummaryrefslogtreecommitdiff
path: root/gcc/d
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/d')
-rw-r--r--gcc/d/ChangeLog6
-rw-r--r--gcc/d/decl.cc7
2 files changed, 11 insertions, 2 deletions
diff --git a/gcc/d/ChangeLog b/gcc/d/ChangeLog
index fbd56b7..d9c7657 100644
--- a/gcc/d/ChangeLog
+++ b/gcc/d/ChangeLog
@@ -1,3 +1,9 @@
+2020-03-16 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ PR d/92216
+ * decl.cc (make_thunk): Don't set TREE_PUBLIC on thunks if the target
+ function is external to the current compilation.
+
2020-01-01 Jakub Jelinek <jakub@redhat.com>
Update copyright years.
diff --git a/gcc/d/decl.cc b/gcc/d/decl.cc
index 3824060..7afb1aa 100644
--- a/gcc/d/decl.cc
+++ b/gcc/d/decl.cc
@@ -1803,8 +1803,11 @@ make_thunk (FuncDeclaration *decl, int offset)
DECL_CONTEXT (thunk) = d_decl_context (decl);
- /* Thunks inherit the public access of the function they are targetting. */
- TREE_PUBLIC (thunk) = TREE_PUBLIC (function);
+ /* Thunks inherit the public access of the function they are targetting.
+ When the function is outside the current compilation unit however, then the
+ thunk must be kept private to not conflict. */
+ TREE_PUBLIC (thunk) = TREE_PUBLIC (function) && !DECL_EXTERNAL (function);
+
DECL_EXTERNAL (thunk) = 0;
/* Thunks are always addressable. */