-Date: Thu, 3 Mar 2005 11:08:30 -0800
-From: "H dot J dot Lu" <hjl at lucon dot org>
-Subject: PATCH: PR middle-end/20297: #pragma GCC visibility isn't properly handled for builtin functions
-
-2005-03-03 H.J. Lu <hongjiu.lu@intel.com>
-
- PR middle-end/20297
- * builtins.c (expand_builtin_1): Renamed from expand_builtin.
- (expand_builtin): Save/restore default_visibility and
- visibility_options.inpragma when calling expand_builtin_1.
-
---- gcc-4.0-20050521/gcc/builtins.c.orig 2005-05-04 09:35:06.000000000 +0200
-+++ gcc-4.0-20050521/gcc/builtins.c 2005-05-23 12:19:53.000000000 +0200
-@@ -5119,9 +5119,9 @@ expand_builtin_fork_or_exec (tree fn, tr
+--- gcc/gcc/builtins.c
++++ gcc/gcc/builtins.c
+@@ -5426,9 +5426,9 @@
SUBTARGET may be used as the target for computing one of EXP's operands.
IGNORE is nonzero if the value is to be ignored. */
{
tree fndecl = get_callee_fndecl (exp);
tree arglist = TREE_OPERAND (exp, 1);
-@@ -5755,6 +5755,27 @@ expand_builtin (tree exp, rtx target, rt
+@@ -6247,6 +6247,28 @@
return expand_call (exp, target, ignore);
}
+{
+ enum symbol_visibility saved_visibility = default_visibility;
+ unsigned int saved_inpragma = visibility_options.inpragma;
++ tree fndecl = get_callee_fndecl (exp);
+ rtx expanded;
+
+ /* We should use the original visibility of the builtin function
+ declaration. */
-+ default_visibility = DECL_VISIBILITY (exp);
-+ visibility_options.inpragma = DECL_VISIBILITY_SPECIFIED (exp);
++ default_visibility = DECL_VISIBILITY (fndecl);
++ visibility_options.inpragma = DECL_VISIBILITY_SPECIFIED (fndecl);
+
+ expanded = expand_builtin_1 (exp, target, subtarget, mode, ignore);
+