yann@1: [adjusted very slightly to apply to gcc-3.3.2 - dank] yann@1: yann@1: From: kaz Kojima yann@1: yann@1: I've noticed one more problem about this issue. In the testcase given yann@1: by ZhouChang, libdemo.so exports __movstr_i4_even which is a function yann@1: in libgcc.a. This itself is not a problem but it means that some functions yann@1: in libgcc.a which should not be exported from shared objects might be yann@1: exported from shared libs yann@1: yann@1: Date: Wed, 19 Nov 2003 09:04:12 +0900 (JST) yann@1: From: kaz Kojima yann@1: Subject: [linux-sh:03096] Re: [linux] Re: About tool chain in yann@1: http://kegel.com/crosstool/ yann@1: To: dank@kegel.com yann@1: Cc: zjuzhou@yahoo.com.cn, linux-sh@m17n.org, zhan_sh@yahoo.com.cn, yann@1: crossgcc@sources.redhat.com yann@1: Message-Id: <20031119.090412.85413542.kkojima@rr.iij4u.or.jp> yann@1: yann@1: Hi, yann@1: yann@1: Dan Kegel wrote: yann@1: > I'll try that, thanks. I notice that the '.hidden' isn't in cvs yet. yann@1: > I also notice you've been trying to get that into CVS for two years yann@1: > now (http://gcc.gnu.org/ml/gcc-patches/2001-10/msg00053.html). yann@1: > Time for another try? It'd be nice if gcc-3.4 (and maybe even gcc-3.3.3) yann@1: > didn't need a patch for this. yann@1: yann@1: The situation is a bit complicated. sh-linux target doesn't make yann@1: shared libgcc in gcc-3.3.x. yann@1: OTOH, I withdrew that .hidden patch because gcc-3.3 has a general yann@1: mechanism to make all libgcc functions .hidden. But I missed that yann@1: that mechanism was conditionalized later so that it's done only yann@1: when the target creates the shared libgcc. yann@1: In 3.4, sh-linux target becomes to use the shared libgcc like as yann@1: all other linux targets, so there is no problem. yann@1: yann@1: I inclined to backport 3.4 shared libgcc stuff to 3.3.3 rather yann@1: than the old .hidden patch. How do you think about it? yann@1: I'm happy if you or ZhouChang create a PR on gcc bugzilla about yann@1: this issue. yann@1: yann@1: Regards, yann@1: kaz yann@1: -- yann@1: This is a backport of 3.4 shared libgcc stuff to 3.3 branch. yann@1: * config.gcc (sh*-*-linux*): Add t-slibgcc-elf-ver and t-linux. yann@1: to tmake_file. * config/sh/libgcc-glibc.ver: New file. yann@1: * config/sh/t-linux (SHLIB_LINK): Override to use a linker script yann@1: libgcc_s.so. yann@1: (SHLIB_INSTALL): Likewise. yann@1: yann@1: diff -u3prN ORIG/gcc-3.3/gcc/config/sh/libgcc-glibc.ver gcc-3.3/gcc/config/sh/libgcc-glibc.ver yann@1: --- ORIG/gcc-3.3/gcc/config/sh/libgcc-glibc.ver Thu Jan 1 09:00:00 1970 yann@1: +++ gcc-3.3/gcc/config/sh/libgcc-glibc.ver Wed Nov 19 08:15:16 2003 yann@1: @@ -0,0 +1,21 @@ yann@1: +# In order to work around the very problems that force us to now generally yann@1: +# create a libgcc.so, glibc reexported a number of routines from libgcc.a. yann@1: +# By now choosing the same version tags for these specific routines, we yann@1: +# maintain enough binary compatibility to allow future versions of glibc yann@1: +# to defer implementation of these routines to libgcc.so via DT_AUXILIARY. yann@1: + yann@1: +# Note that we cannot use the default libgcc-glibc.ver file on sh, yann@1: +# because GLIBC_2.0 does not exist on this architecture, as the first yann@1: +# ever glibc release on the platform was GLIBC_2.2. yann@1: + yann@1: +%inherit GCC_3.0 GLIBC_2.2 yann@1: +GLIBC_2.2 { yann@1: + __register_frame yann@1: + __register_frame_table yann@1: + __deregister_frame yann@1: + __register_frame_info yann@1: + __deregister_frame_info yann@1: + __frame_state_for yann@1: + __register_frame_info_table yann@1: +} yann@1: + yann@1: diff -u3prN ORIG/gcc-3.3/gcc/config/sh/t-linux gcc-3.3/gcc/config/sh/t-linux yann@1: --- ORIG/gcc-3.3/gcc/config/sh/t-linux Fri Jun 6 11:07:14 2003 yann@1: +++ gcc-3.3/gcc/config/sh/t-linux Wed Nov 19 08:09:26 2003 yann@1: @@ -12,3 +12,27 @@ MULTILIB_MATCHES = yann@1: MULTILIB_EXCEPTIONS= yann@1: yann@1: EXTRA_MULTILIB_PARTS= crtbegin.o crtend.o crtbeginS.o crtendS.o yann@1: + yann@1: +# Override t-slibgcc-elf-ver to export some libgcc symbols with yann@1: +# the symbol versions that glibc used. yann@1: +SHLIB_MAPFILES = $(srcdir)/libgcc-std.ver $(srcdir)/config/sh/libgcc-glibc.ver yann@1: + yann@1: +# Override SHLIB_LINK and SHLIB_INSTALL to use linker script yann@1: +# libgcc_s.so. yann@1: +SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \ yann@1: + -Wl,--soname=$(SHLIB_SONAME) \ yann@1: + -Wl,--version-script=$(SHLIB_MAP) \ yann@1: + -o $(SHLIB_NAME) @multilib_flags@ $(SHLIB_OBJS) $(SHLIB_LC) && \ yann@1: + rm -f $(SHLIB_SOLINK) && \ yann@1: + (echo "/* GNU ld script"; \ yann@1: + echo " Use the shared library, but some functions are only in"; \ yann@1: + echo " the static library. */"; \ yann@1: + echo "GROUP ( $(SHLIB_SONAME) libgcc.a )" \ yann@1: + ) > $(SHLIB_SOLINK) yann@1: +SHLIB_INSTALL = \ yann@1: + $$(SHELL) $$(srcdir)/mkinstalldirs $$(slibdir)$(SHLIB_SLIBDIR_QUAL); \ yann@1: + $(INSTALL_DATA) $(SHLIB_NAME) \ yann@1: + $$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SONAME); \ yann@1: + rm -f $$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK); \ yann@1: + $(INSTALL_DATA) $(SHLIB_SOLINK) \ yann@1: + $$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK) yann@1: diff -u3prN ORIG/gcc-3.3/gcc/config.gcc gcc-3.3/gcc/config.gcc yann@1: --- ORIG/gcc-3.3/gcc/config.gcc Sat Aug 9 07:19:07 2003 yann@1: +++ gcc-3.3/gcc/config.gcc Wed Nov 19 08:07:53 2003 yann@1: @@ -2308,7 +2308,7 @@ sh-*-rtems*) yann@1: fi yann@1: ;; yann@1: sh-*-linux* | sh[2346lbe]*-*-linux*) yann@1: - tmake_file="sh/t-sh sh/t-elf" yann@1: + tmake_file="sh/t-sh sh/t-elf t-slibgcc-elf-ver t-linux" yann@1: case $machine in yann@1: sh*be-*-* | sh*eb-*-*) ;; yann@1: *) yann@1: yann@1: