From: ro Date: Wed, 31 Mar 2010 09:19:20 +0000 (+0000) Subject: gcc: X-Git-Tag: upstream/4.9.2~30404 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dc2059b58042bd5a546c0749c0747f7a9f11bbda;p=platform%2Fupstream%2Flinaro-gcc.git gcc: * config/sol2.c: Include output.h. (solaris_assemble_visibility): New function. * config/t-sol2 (sol2.o): Add output.h dependency. * config/sol2-protos.h (solaris_assemble_visibility): Declare. * config/sol2.h [!USE_GAS] (TARGET_ASM_ASSEMBLE_VISIBILITY): Redefine. gcc/testsuite: * g++.dg/ext/visibility/pragma-override1.C: Allow for .hidden in assembler output on *-*-solaris2*. * g++.dg/ext/visibility/pragma-override2.C: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157856 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0deb3bd..e1fd302 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2010-03-31 Rainer Orth + + * config/sol2.c: Include output.h. + (solaris_assemble_visibility): New function. + * config/t-sol2 (sol2.o): Add output.h dependency. + * config/sol2-protos.h (solaris_assemble_visibility): Declare. + * config/sol2.h [!USE_GAS] (TARGET_ASM_ASSEMBLE_VISIBILITY): + Redefine. + 2010-03-31 Jakub Jelinek PR target/43580 diff --git a/gcc/config/sol2-protos.h b/gcc/config/sol2-protos.h index 45d5bcc..800629a 100644 --- a/gcc/config/sol2-protos.h +++ b/gcc/config/sol2-protos.h @@ -1,6 +1,6 @@ /* Operating system specific prototypes to be used when targeting GCC for any Solaris 2 system. - Copyright 2004, 2007 Free Software Foundation, Inc. + Copyright 2004, 2007, 2010 Free Software Foundation, Inc. This file is part of GCC. @@ -21,3 +21,4 @@ along with GCC; see the file COPYING3. If not see extern void solaris_insert_attributes (tree, tree *); extern void solaris_register_pragmas (void); extern void solaris_output_init_fini (FILE *, tree); +extern void solaris_assemble_visibility (tree, int); diff --git a/gcc/config/sol2.c b/gcc/config/sol2.c index 493816c..3531e79 100644 --- a/gcc/config/sol2.c +++ b/gcc/config/sol2.c @@ -1,5 +1,5 @@ /* General Solaris system support. - Copyright (C) 2004, 2005 , 2007 Free Software Foundation, Inc. + Copyright (C) 2004, 2005 , 2007, 2010 Free Software Foundation, Inc. Contributed by CodeSourcery, LLC. This file is part of GCC. @@ -22,6 +22,7 @@ along with GCC; see the file COPYING3. If not see #include "system.h" #include "coretypes.h" #include "tree.h" +#include "output.h" #include "tm.h" #include "rtl.h" #include "tm_p.h" @@ -117,3 +118,42 @@ solaris_output_init_fini (FILE *file, tree decl) } } +/* Emit an assembler directive to set symbol for DECL visibility to + the visibility type VIS, which must not be VISIBILITY_DEFAULT. */ + +void +solaris_assemble_visibility (tree decl, int vis) +{ + /* Sun as uses .symbolic for STV_PROTECTED. STV_INTERNAL is marked as + `currently reserved', but the linker treats it like STV_HIDDEN. Sun + Studio 12.1 cc emits .hidden instead. + + There are 3 Sun extensions GCC doesn't yet know about: STV_EXPORTED, + STV_SINGLETON, and STV_ELIMINATE. + + See Linker and Libraries Guide, Ch. 2, Link-Editor, Defining + Additional Symbols with a mapfile, + http://docs.sun.com/app/docs/doc/819-0690/gdzmc?a=view + and Ch. 7, Object-File Format, Symbol Table Section, + http://docs.sun.com/app/docs/doc/819-0690/chapter6-79797?a=view */ + + static const char * const visibility_types[] = { + NULL, "symbolic", "hidden", "hidden" + }; + + const char *name, *type; + + name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); + type = visibility_types[vis]; + + /* .hidden dates back before Solaris 2.5, but .symbolic was only added in + Solaris 9 12/02. */ +#ifdef HAVE_GAS_HIDDEN + fprintf (asm_out_file, "\t.%s\t", type); + assemble_name (asm_out_file, name); + fprintf (asm_out_file, "\n"); +#else + warning (OPT_Wattributes, "visibility attribute not supported " + "in this configuration; ignored"); +#endif +} diff --git a/gcc/config/sol2.h b/gcc/config/sol2.h index a20c3b9..d77c0f8 100644 --- a/gcc/config/sol2.h +++ b/gcc/config/sol2.h @@ -284,6 +284,11 @@ __enable_execute_stack (void *addr) \ } \ while (0) +#ifndef USE_GAS +#undef TARGET_ASM_ASSEMBLE_VISIBILITY +#define TARGET_ASM_ASSEMBLE_VISIBILITY solaris_assemble_visibility +#endif + extern GTY(()) tree solaris_pending_aligns; extern GTY(()) tree solaris_pending_inits; extern GTY(()) tree solaris_pending_finis; diff --git a/gcc/config/t-sol2 b/gcc/config/t-sol2 index 28aa865..526ae40 100644 --- a/gcc/config/t-sol2 +++ b/gcc/config/t-sol2 @@ -1,4 +1,4 @@ -# Copyright (C) 2004, 2008, 2009 Free Software Foundation, Inc. +# Copyright (C) 2004, 2008, 2009, 2010 Free Software Foundation, Inc. # # This file is part of GCC. # @@ -25,6 +25,6 @@ sol2-c.o: $(srcdir)/config/sol2-c.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ # Solaris-specific attributes sol2.o: $(srcdir)/config/sol2.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ - tree.h $(TM_H) $(TM_P_H) toplev.h $(GGC_H) + tree.h output.h $(TM_H) $(TM_P_H) toplev.h $(GGC_H) $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ $(srcdir)/config/sol2.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1dcabdf..3e9329a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2010-03-31 Rainer Orth + + * g++.dg/ext/visibility/pragma-override1.C: Allow for .hidden in + assembler output on *-*-solaris2*. + * g++.dg/ext/visibility/pragma-override2.C: Likewise. + 2010-03-31 Jakub Jelinek PR debug/43557 diff --git a/gcc/testsuite/g++.dg/ext/visibility/pragma-override1.C b/gcc/testsuite/g++.dg/ext/visibility/pragma-override1.C index e292df4..4300d1a 100644 --- a/gcc/testsuite/g++.dg/ext/visibility/pragma-override1.C +++ b/gcc/testsuite/g++.dg/ext/visibility/pragma-override1.C @@ -1,7 +1,8 @@ /* Test that #pragma GCC visibility does not override class member specific settings. */ /* { dg-do compile } */ /* { dg-require-visibility "internal" } */ -/* { dg-final { scan-assembler "\\.internal.*Foo.methodEv" } } */ +/* { dg-final { scan-assembler "\\.internal.*Foo.methodEv" { target { ! *-*-solaris2* } } } } */ +/* { dg-final { scan-assembler "\\.(internal|hidden).*Foo.methodEv" { target *-*-solaris2* } } } */ #pragma GCC visibility push(hidden) class __attribute__ ((visibility ("internal"))) Foo diff --git a/gcc/testsuite/g++.dg/ext/visibility/pragma-override2.C b/gcc/testsuite/g++.dg/ext/visibility/pragma-override2.C index fe6c47f..f566cd2 100644 --- a/gcc/testsuite/g++.dg/ext/visibility/pragma-override2.C +++ b/gcc/testsuite/g++.dg/ext/visibility/pragma-override2.C @@ -1,7 +1,8 @@ /* Test that #pragma GCC visibility does not override class member specific settings. */ /* { dg-do compile } */ /* { dg-require-visibility "internal" } */ -/* { dg-final { scan-assembler "\\.internal.*Foo.methodEv" } } */ +/* { dg-final { scan-assembler "\\.internal.*Foo.methodEv" { target { ! *-*-solaris2* } } } } */ +/* { dg-final { scan-assembler "\\.(internal|hidden).*Foo.methodEv" { target *-*-solaris2* } } } */ #pragma GCC visibility push(hidden) class Foo