diff options
author | Jason Merrill <jason@redhat.com> | 2006-03-21 23:20:52 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2006-03-21 23:20:52 -0500 |
commit | 5b5cba1f05156ad8ba51ba09ef8ec10fdbe915d0 (patch) | |
tree | bea9fcaacdabc909ee70a71492432316d8610e1f | |
parent | 1dc11afe862edceccc0bead5d086509f181fc67a (diff) | |
download | gcc-5b5cba1f05156ad8ba51ba09ef8ec10fdbe915d0.zip gcc-5b5cba1f05156ad8ba51ba09ef8ec10fdbe915d0.tar.gz gcc-5b5cba1f05156ad8ba51ba09ef8ec10fdbe915d0.tar.bz2 |
re PR middle-end/20297 (#pragma GCC visibility isn't properly handled for builtin functions)
PR middle-end/20297
* expr.c (init_block_move_fn): Force default visibility.
(init_block_clear_fn): Likewise.
* builtins.c (expand_builtin_fork_or_exec): Likewise.
* targhooks.c (default_external_stack_protect_fail): Likewise.
From-SVN: r112270
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/builtins.c | 2 | ||||
-rw-r--r-- | gcc/expr.c | 4 | ||||
-rw-r--r-- | gcc/targhooks.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/visibility-11.c | 24 |
5 files changed, 40 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6b1c06e..b9b9eae 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2006-03-21 Jason Merrill <jason@redhat.com> + + PR middle-end/20297 + * expr.c (init_block_move_fn): Force default visibility. + (init_block_clear_fn): Likewise. + * builtins.c (expand_builtin_fork_or_exec): Likewise. + * targhooks.c (default_external_stack_protect_fail): Likewise. + 2006-03-21 Richard Sandiford <richard@codesourcery.com> * config/mips/predicates.md (const_call_insn_operand): Allow direct diff --git a/gcc/builtins.c b/gcc/builtins.c index 999d777..ebdbb69 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -5381,6 +5381,8 @@ expand_builtin_fork_or_exec (tree fn, tree arglist, rtx target, int ignore) TREE_PUBLIC (decl) = 1; DECL_ARTIFICIAL (decl) = 1; TREE_NOTHROW (decl) = 1; + DECL_VISIBILITY (fn) = VISIBILITY_DEFAULT; + DECL_VISIBILITY_SPECIFIED (fn) = 1; call = build_function_call_expr (decl, arglist); return expand_call (call, target, ignore); @@ -1409,6 +1409,8 @@ init_block_move_fn (const char *asmspec) TREE_PUBLIC (fn) = 1; DECL_ARTIFICIAL (fn) = 1; TREE_NOTHROW (fn) = 1; + DECL_VISIBILITY (fn) = VISIBILITY_DEFAULT; + DECL_VISIBILITY_SPECIFIED (fn) = 1; block_move_fn = fn; } @@ -2556,6 +2558,8 @@ init_block_clear_fn (const char *asmspec) TREE_PUBLIC (fn) = 1; DECL_ARTIFICIAL (fn) = 1; TREE_NOTHROW (fn) = 1; + DECL_VISIBILITY (fn) = VISIBILITY_DEFAULT; + DECL_VISIBILITY_SPECIFIED (fn) = 1; block_clear_fn = fn; } diff --git a/gcc/targhooks.c b/gcc/targhooks.c index f6289c8..45942a2 100644 --- a/gcc/targhooks.c +++ b/gcc/targhooks.c @@ -398,6 +398,8 @@ default_external_stack_protect_fail (void) TREE_NOTHROW (t) = 1; DECL_ARTIFICIAL (t) = 1; DECL_IGNORED_P (t) = 1; + DECL_VISIBILITY (t) = VISIBILITY_DEFAULT; + DECL_VISIBILITY_SPECIFIED (t) = 1; stack_chk_fail_decl = t; } diff --git a/gcc/testsuite/gcc.dg/visibility-11.c b/gcc/testsuite/gcc.dg/visibility-11.c new file mode 100644 index 0000000..e599582 --- /dev/null +++ b/gcc/testsuite/gcc.dg/visibility-11.c @@ -0,0 +1,24 @@ +/* PR middle-end/20297 */ +/* The memcpy FUNCTION_DECL built in the middle-end for block moves got + hidden visibility from the first push, so the call didn't use the PLT. */ + +/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ +/* { dg-require-visibility "" } */ +/* { dg-options "-Os -fpic" } */ +/* { dg-final { scan-assembler "memcpy@PLT" } } */ + +#pragma GCC visibility push(hidden) +#pragma GCC visibility push(default) +extern void* memcpy (void *, const void *, __SIZE_TYPE__); +#pragma GCC visibility pop + +struct a { int a[10]; }; + +extern void *bar (struct a *, struct a *, int); + +void * +foo (struct a *a, struct a *b, int c) +{ + struct a cc = *b; + return bar (a, &cc, 4 * c); +} |