--- 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. */ -rtx -expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode, - int ignore) +static rtx +expand_builtin_1 (tree exp, rtx target, rtx subtarget, + enum machine_mode mode, int ignore) { tree fndecl = get_callee_fndecl (exp); tree arglist = TREE_OPERAND (exp, 1); @@ -6247,6 +6247,28 @@ return expand_call (exp, target, ignore); } +rtx +expand_builtin (tree exp, rtx target, rtx subtarget, + enum machine_mode mode, int 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 (fndecl); + visibility_options.inpragma = DECL_VISIBILITY_SPECIFIED (fndecl); + + expanded = expand_builtin_1 (exp, target, subtarget, mode, ignore); + + default_visibility = saved_visibility; + visibility_options.inpragma = saved_inpragma; + + return expanded; +} + /* Determine whether a tree node represents a call to a built-in function. If the tree T is a call to a built-in function with the right number of arguments of the appropriate types, return