From c67a93384d5266f5646bd2773cda98fd5c9d66b7 Mon Sep 17 00:00:00 2001 From: Olivier Hainque Date: Wed, 30 Jul 2008 10:13:46 +0000 Subject: [PATCH] irix-crti.asm: .hide __gcc_init and __gcc_fini. * config/mips/irix-crti.asm: .hide __gcc_init and __gcc_fini. * config/mips/iris6.h (IRIX_SUBTARGET_LINK_SPEC, irix ld): Hide __dso_handle explicitly here. From-SVN: r138297 --- gcc/ChangeLog | 6 ++++++ gcc/config/mips/iris6.h | 24 ++++++++++++++++++++++++ gcc/config/mips/irix-crti.asm | 7 +++++++ 3 files changed, 37 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 671b794cf25..bb2350b63d0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2008-07-25 Olivier Hainque + + * config/mips/irix-crti.asm: .hide __gcc_init and __gcc_fini. + * config/mips/iris6.h (IRIX_SUBTARGET_LINK_SPEC, irix ld): Hide + __dso_handle explicitly here. + 2008-07-30 Manuel Lopez-Ibanez PR 34389 diff --git a/gcc/config/mips/iris6.h b/gcc/config/mips/iris6.h index 750eaa199fa..ffd918e8aaa 100644 --- a/gcc/config/mips/iris6.h +++ b/gcc/config/mips/iris6.h @@ -49,8 +49,32 @@ along with GCC; see the file COPYING3. If not see #define IRIX_SUBTARGET_LINK_SPEC \ "%{mabi=32: -melf32bsmip}%{mabi=n32: -melf32bmipn32}%{mabi=64: -melf64bmip}" #else + /* Explicitly hide crt symbols that would normally be marked with + a "hidden" visibility attribute. + + We have traditionally disabled this attribute when using the + native linker because the native linker's visibility support is + not fully-compatible with the GNU linker's. In particular, the + native linker does not pull in archive objects purely to resolve + references to the object's hidden symbols, whereas the GNU + linker does. + + The gcc build system currently hides symbols in some static + libraries (typically libgcov.a or libgcc.a) whenever visibility + attributes are supported. On targets with GNU semantics, this + makes sure that uses of libx.so symbols in one dynamic object are + not resolved to libx.a symbols in another dynamic object. But + on targets with IRIX semantics, hiding the symbols prevents the + static archive from working at all. + + It would probably be better to enable visiblity attributes for + IRIX ld and disable the static archives versioning. It shouldn't + make anything worse, since libx.a symbols are global by default + anyway. However, no-one has volunteered to do this yet. */ + #define IRIX_SUBTARGET_LINK_SPEC \ "%{w} -_SYSTYPE_SVR4 -woff 131 \ + %{shared:-hidden_symbol __dso_handle} \ %{mabi=32: -32}%{mabi=n32: -n32}%{mabi=64: -64}%{!mabi*: -n32}" #endif diff --git a/gcc/config/mips/irix-crti.asm b/gcc/config/mips/irix-crti.asm index d6888bbf014..992f8b695dc 100644 --- a/gcc/config/mips/irix-crti.asm +++ b/gcc/config/mips/irix-crti.asm @@ -49,3 +49,10 @@ __gcc_fini: sd $31,0($sp) sd $28,8($sp) #endif + +/* This object will typically be included in the final link for both + shared libraries and executable, and we need to hide the symbols to + prevent possible symbol preemption warnings from the SGI linker. */ +.hidden __gcc_init +.hidden __gcc_fini + -- 2.30.2