yann@1
|
1 |
[adjusted very slightly to apply to gcc-3.3.2 - dank]
|
yann@1
|
2 |
|
yann@1
|
3 |
From: kaz Kojima <kkojima@rr.iij4u.or.jp>
|
yann@1
|
4 |
|
yann@1
|
5 |
I've noticed one more problem about this issue. In the testcase given
|
yann@1
|
6 |
by ZhouChang, libdemo.so exports __movstr_i4_even which is a function
|
yann@1
|
7 |
in libgcc.a. This itself is not a problem but it means that some functions
|
yann@1
|
8 |
in libgcc.a which should not be exported from shared objects might be
|
yann@1
|
9 |
exported from shared libs
|
yann@1
|
10 |
|
yann@1
|
11 |
Date: Wed, 19 Nov 2003 09:04:12 +0900 (JST)
|
yann@1
|
12 |
From: kaz Kojima <kkojima@rr.iij4u.or.jp>
|
yann@1
|
13 |
Subject: [linux-sh:03096] Re: [linux] Re: About tool chain in
|
yann@1
|
14 |
http://kegel.com/crosstool/
|
yann@1
|
15 |
To: dank@kegel.com
|
yann@1
|
16 |
Cc: zjuzhou@yahoo.com.cn, linux-sh@m17n.org, zhan_sh@yahoo.com.cn,
|
yann@1
|
17 |
crossgcc@sources.redhat.com
|
yann@1
|
18 |
Message-Id: <20031119.090412.85413542.kkojima@rr.iij4u.or.jp>
|
yann@1
|
19 |
|
yann@1
|
20 |
Hi,
|
yann@1
|
21 |
|
yann@1
|
22 |
Dan Kegel <dank@kegel.com> wrote:
|
yann@1
|
23 |
> I'll try that, thanks. I notice that the '.hidden' isn't in cvs yet.
|
yann@1
|
24 |
> I also notice you've been trying to get that into CVS for two years
|
yann@1
|
25 |
> now (http://gcc.gnu.org/ml/gcc-patches/2001-10/msg00053.html).
|
yann@1
|
26 |
> Time for another try? It'd be nice if gcc-3.4 (and maybe even gcc-3.3.3)
|
yann@1
|
27 |
> didn't need a patch for this.
|
yann@1
|
28 |
|
yann@1
|
29 |
The situation is a bit complicated. sh-linux target doesn't make
|
yann@1
|
30 |
shared libgcc in gcc-3.3.x.
|
yann@1
|
31 |
OTOH, I withdrew that .hidden patch because gcc-3.3 has a general
|
yann@1
|
32 |
mechanism to make all libgcc functions .hidden. But I missed that
|
yann@1
|
33 |
that mechanism was conditionalized later so that it's done only
|
yann@1
|
34 |
when the target creates the shared libgcc.
|
yann@1
|
35 |
In 3.4, sh-linux target becomes to use the shared libgcc like as
|
yann@1
|
36 |
all other linux targets, so there is no problem.
|
yann@1
|
37 |
|
yann@1
|
38 |
I inclined to backport 3.4 shared libgcc stuff to 3.3.3 rather
|
yann@1
|
39 |
than the old .hidden patch. How do you think about it?
|
yann@1
|
40 |
I'm happy if you or ZhouChang create a PR on gcc bugzilla about
|
yann@1
|
41 |
this issue.
|
yann@1
|
42 |
|
yann@1
|
43 |
Regards,
|
yann@1
|
44 |
kaz
|
yann@1
|
45 |
--
|
yann@1
|
46 |
This is a backport of 3.4 shared libgcc stuff to 3.3 branch.
|
yann@1
|
47 |
* config.gcc (sh*-*-linux*): Add t-slibgcc-elf-ver and t-linux.
|
yann@1
|
48 |
to tmake_file. * config/sh/libgcc-glibc.ver: New file.
|
yann@1
|
49 |
* config/sh/t-linux (SHLIB_LINK): Override to use a linker script
|
yann@1
|
50 |
libgcc_s.so.
|
yann@1
|
51 |
(SHLIB_INSTALL): Likewise.
|
yann@1
|
52 |
|
yann@1
|
53 |
diff -u3prN ORIG/gcc-3.3/gcc/config/sh/libgcc-glibc.ver gcc-3.3/gcc/config/sh/libgcc-glibc.ver
|
yann@1
|
54 |
--- ORIG/gcc-3.3/gcc/config/sh/libgcc-glibc.ver Thu Jan 1 09:00:00 1970
|
yann@1
|
55 |
+++ gcc-3.3/gcc/config/sh/libgcc-glibc.ver Wed Nov 19 08:15:16 2003
|
yann@1
|
56 |
@@ -0,0 +1,21 @@
|
yann@1
|
57 |
+# In order to work around the very problems that force us to now generally
|
yann@1
|
58 |
+# create a libgcc.so, glibc reexported a number of routines from libgcc.a.
|
yann@1
|
59 |
+# By now choosing the same version tags for these specific routines, we
|
yann@1
|
60 |
+# maintain enough binary compatibility to allow future versions of glibc
|
yann@1
|
61 |
+# to defer implementation of these routines to libgcc.so via DT_AUXILIARY.
|
yann@1
|
62 |
+
|
yann@1
|
63 |
+# Note that we cannot use the default libgcc-glibc.ver file on sh,
|
yann@1
|
64 |
+# because GLIBC_2.0 does not exist on this architecture, as the first
|
yann@1
|
65 |
+# ever glibc release on the platform was GLIBC_2.2.
|
yann@1
|
66 |
+
|
yann@1
|
67 |
+%inherit GCC_3.0 GLIBC_2.2
|
yann@1
|
68 |
+GLIBC_2.2 {
|
yann@1
|
69 |
+ __register_frame
|
yann@1
|
70 |
+ __register_frame_table
|
yann@1
|
71 |
+ __deregister_frame
|
yann@1
|
72 |
+ __register_frame_info
|
yann@1
|
73 |
+ __deregister_frame_info
|
yann@1
|
74 |
+ __frame_state_for
|
yann@1
|
75 |
+ __register_frame_info_table
|
yann@1
|
76 |
+}
|
yann@1
|
77 |
+
|
yann@1
|
78 |
diff -u3prN ORIG/gcc-3.3/gcc/config/sh/t-linux gcc-3.3/gcc/config/sh/t-linux
|
yann@1
|
79 |
--- ORIG/gcc-3.3/gcc/config/sh/t-linux Fri Jun 6 11:07:14 2003
|
yann@1
|
80 |
+++ gcc-3.3/gcc/config/sh/t-linux Wed Nov 19 08:09:26 2003
|
yann@1
|
81 |
@@ -12,3 +12,27 @@ MULTILIB_MATCHES =
|
yann@1
|
82 |
MULTILIB_EXCEPTIONS=
|
yann@1
|
83 |
|
yann@1
|
84 |
EXTRA_MULTILIB_PARTS= crtbegin.o crtend.o crtbeginS.o crtendS.o
|
yann@1
|
85 |
+
|
yann@1
|
86 |
+# Override t-slibgcc-elf-ver to export some libgcc symbols with
|
yann@1
|
87 |
+# the symbol versions that glibc used.
|
yann@1
|
88 |
+SHLIB_MAPFILES = $(srcdir)/libgcc-std.ver $(srcdir)/config/sh/libgcc-glibc.ver
|
yann@1
|
89 |
+
|
yann@1
|
90 |
+# Override SHLIB_LINK and SHLIB_INSTALL to use linker script
|
yann@1
|
91 |
+# libgcc_s.so.
|
yann@1
|
92 |
+SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \
|
yann@1
|
93 |
+ -Wl,--soname=$(SHLIB_SONAME) \
|
yann@1
|
94 |
+ -Wl,--version-script=$(SHLIB_MAP) \
|
yann@1
|
95 |
+ -o $(SHLIB_NAME) @multilib_flags@ $(SHLIB_OBJS) $(SHLIB_LC) && \
|
yann@1
|
96 |
+ rm -f $(SHLIB_SOLINK) && \
|
yann@1
|
97 |
+ (echo "/* GNU ld script"; \
|
yann@1
|
98 |
+ echo " Use the shared library, but some functions are only in"; \
|
yann@1
|
99 |
+ echo " the static library. */"; \
|
yann@1
|
100 |
+ echo "GROUP ( $(SHLIB_SONAME) libgcc.a )" \
|
yann@1
|
101 |
+ ) > $(SHLIB_SOLINK)
|
yann@1
|
102 |
+SHLIB_INSTALL = \
|
yann@1
|
103 |
+ $$(SHELL) $$(srcdir)/mkinstalldirs $$(slibdir)$(SHLIB_SLIBDIR_QUAL); \
|
yann@1
|
104 |
+ $(INSTALL_DATA) $(SHLIB_NAME) \
|
yann@1
|
105 |
+ $$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SONAME); \
|
yann@1
|
106 |
+ rm -f $$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK); \
|
yann@1
|
107 |
+ $(INSTALL_DATA) $(SHLIB_SOLINK) \
|
yann@1
|
108 |
+ $$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK)
|
yann@1
|
109 |
diff -u3prN ORIG/gcc-3.3/gcc/config.gcc gcc-3.3/gcc/config.gcc
|
yann@1
|
110 |
--- ORIG/gcc-3.3/gcc/config.gcc Sat Aug 9 07:19:07 2003
|
yann@1
|
111 |
+++ gcc-3.3/gcc/config.gcc Wed Nov 19 08:07:53 2003
|
yann@1
|
112 |
@@ -2308,7 +2308,7 @@ sh-*-rtems*)
|
yann@1
|
113 |
fi
|
yann@1
|
114 |
;;
|
yann@1
|
115 |
sh-*-linux* | sh[2346lbe]*-*-linux*)
|
yann@1
|
116 |
- tmake_file="sh/t-sh sh/t-elf"
|
yann@1
|
117 |
+ tmake_file="sh/t-sh sh/t-elf t-slibgcc-elf-ver t-linux"
|
yann@1
|
118 |
case $machine in
|
yann@1
|
119 |
sh*be-*-* | sh*eb-*-*) ;;
|
yann@1
|
120 |
*)
|
yann@1
|
121 |
|
yann@1
|
122 |
|