[PATCH] prevent warnings from -shared-libgcc on mips-irix

Olivier Hainque hainque@adacore.com
Thu Jun 5 09:20:00 GMT 2008


Hello,

On mips-irix, a number of objects are always included in the final
link for either executables or shared libraries, and some of these
objects expose global symbols. This causes the system linker to
warn as soon as a shared library is linked with an executable.

The simple case below illustrates:

    /* t.c */
    int main (void)
    {
      return 0;
    }

    $ gcc -o t t.c -shared-libgcc
    ld32: WARNING 85: definition of __gcc_init in
     .../4.4.0/irix-crti.o preempts that definition in
     .../4.4.0/../../../../lib32/libgcc_s.so.

    ld32: WARNING 85: definition of __gcc_fini in
    .../4.4.0/irix-crti.o preempts that definition in
    .../4.4.0/../../../../lib32/libgcc_s.so.

    ld32: WARNING 85: definition of __dso_handle in
    .../4.4.0/crtbegin.o preempts that definition in
    .../4.4.0/../../../../lib32/libgcc_s.so.

The attached patch is a suggestion to address this by hiding the
symbols in the shared libraries.

Bootstrapped and regression tested for c,c++,ada on mips-sgi-irix6.5.

Thanks in advnace,

Olivier

	2008-06-05  Olivier Hainque  <hainque@adacore.com>

	* mips/iris6.h (IRIX_SUBTARGET_LINK_SPEC, system ld): Hide
	__gcc_init,__gcc_fini and __dso_handle in shared libraries.


	



-------------- next part --------------
Index: iris6.h
===================================================================
--- iris6.h	(revision 136278)
+++ iris6.h	(working copy)
@@ -51,6 +51,7 @@
 #else
 #define IRIX_SUBTARGET_LINK_SPEC \
   "%{w} -_SYSTYPE_SVR4 -woff 131 \
+   %{shared:-hidden_symbol __gcc_init,__gcc_fini,__dso_handle} \
    %{mabi=32: -32}%{mabi=n32: -n32}%{mabi=64: -64}%{!mabi*: -n32}"
 #endif
 


More information about the Gcc-patches mailing list