aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2010-07-24 03:04:29 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2010-07-24 01:04:29 +0000
commit5d7f4d9c8b2f59093e4d4661089a3f9d28002c61 (patch)
treeb4af0c6481e91c27c943e4bfaba4273f24431b31 /gcc
parent67d8bd24cd70cf6d33d3babd293f1c8b18ff94ed (diff)
downloadgcc-5d7f4d9c8b2f59093e4d4661089a3f9d28002c61.zip
gcc-5d7f4d9c8b2f59093e4d4661089a3f9d28002c61.tar.gz
gcc-5d7f4d9c8b2f59093e4d4661089a3f9d28002c61.tar.bz2
lto-streamer-out.c (write_symbol): Fix visibilities of external references.
* lto-streamer-out.c (write_symbol): Fix visibilities of external references. From-SVN: r162497
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/lto-streamer-out.c41
2 files changed, 31 insertions, 15 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3b9aa26..cfdd938 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2010-07-23 Jan Hubicka <jh@suse.cz>
+
+ * lto-streamer-out.c (write_symbol): Fix visibilities of external
+ references.
+
2010-07-23 Le-Chun Wu <lcwu@google.com>
* omega.c (omega_eliminate_redundant): Remove a self-assign statement.
diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c
index c96c13a..98d9442 100644
--- a/gcc/lto-streamer-out.c
+++ b/gcc/lto-streamer-out.c
@@ -2352,21 +2352,32 @@ write_symbol (struct lto_streamer_cache_d *cache,
&& cgraph_get_node (t)->analyzed));
}
- switch (DECL_VISIBILITY(t))
- {
- case VISIBILITY_DEFAULT:
- visibility = GCCPV_DEFAULT;
- break;
- case VISIBILITY_PROTECTED:
- visibility = GCCPV_PROTECTED;
- break;
- case VISIBILITY_HIDDEN:
- visibility = GCCPV_HIDDEN;
- break;
- case VISIBILITY_INTERNAL:
- visibility = GCCPV_INTERNAL;
- break;
- }
+ /* Imitate what default_elf_asm_output_external do.
+ When symbol is external, we need to output it with DEFAULT visibility
+ when compiling with -fvisibility=default, while with HIDDEN visibility
+ when symbol has attribute (visibility("hidden")) specified.
+ targetm.binds_local_p check DECL_VISIBILITY_SPECIFIED and gets this
+ right. */
+
+ if (DECL_EXTERNAL (t)
+ && !targetm.binds_local_p (t))
+ visibility = GCCPV_DEFAULT;
+ else
+ switch (DECL_VISIBILITY(t))
+ {
+ case VISIBILITY_DEFAULT:
+ visibility = GCCPV_DEFAULT;
+ break;
+ case VISIBILITY_PROTECTED:
+ visibility = GCCPV_PROTECTED;
+ break;
+ case VISIBILITY_HIDDEN:
+ visibility = GCCPV_HIDDEN;
+ break;
+ case VISIBILITY_INTERNAL:
+ visibility = GCCPV_INTERNAL;
+ break;
+ }
if (kind == GCCPK_COMMON
&& DECL_SIZE (t)