[PATCH] Fix {sparc64,x86_64}-linux ABI problem (take 2)
Jakub Jelinek
jakub@redhat.com
Tue May 7 14:15:00 GMT 2002
On Tue, May 07, 2002 at 10:55:07AM -0700, Richard Henderson wrote:
> On Tue, May 07, 2002 at 06:27:30PM +0200, Jakub Jelinek wrote:
> > * config/sparc/t-linux64 (SHLIB_MAPFILES): Set.
> > * config/sparc/libgcc-sparc-glibc.ver: New file.
> > * mklibgcc.in: Preprocess SHLIB_MAPFILES with ml flags.
>
> This looks fine for sparc64, but I'm guessing
> we have the same problems with other ports?
>
> s390 and x86-64 are the ones that come to mind
> right away, but there may be others...
For x86-64 it is clear, it wouldn't make /lib/libgcc_s.so.1 with
wrong versions, for s390 it is no problem ATM, since for strange reasons
s390/s390x doesn't do multilibs and for s390x it already uses GLIBC_2.2.
Once it will support multilibs, it will need something
like the sparc changes below.
Completely separate issue is ia64, where it is even
more complicated and I'm working on a separate patch.
Dunno about other ports, probably maintainers should check.
2002-05-07 Jakub Jelinek <jakub@redhat.com>
* config/sparc/t-linux64 (SHLIB_MAPFILES): Set.
* config/sparc/libgcc-sparc-glibc.ver: New file.
* config/i386/t-linux64 (SHLIB_MAPFILES): Add libgcc-x86_64-glibc.ver.
* config/i386/libgcc-x86_64-glibc.ver: New file.
* mklibgcc.in: Preprocess SHLIB_MAPFILES with ml flags.
--- gcc/config/i386/libgcc-x86_64-glibc.ver.jj Tue May 7 23:00:19 2002
+++ gcc/config/i386/libgcc-x86_64-glibc.ver Tue May 7 23:02:19 2002
@@ -0,0 +1,25 @@
+# In order to work around the very problems that force us to now generally
+# create a libgcc.so, glibc reexported a number of routines from libgcc.a.
+# By now choosing the same version tags for these specific routines, we
+# maintain enough binary compatibility to allow future versions of glibc
+# to defer implementation of these routines to libgcc.so via DT_AUXILIARY.
+
+%ifndef __x86_64__
+%inherit GCC_3.0 GLIBC_2.0
+GLIBC_2.0 {
+ # Sampling of DImode arithmetic used by (at least) i386 and m68k.
+ __divdi3
+ __moddi3
+ __udivdi3
+ __umoddi3
+
+ # Exception handling support functions used by most everyone.
+ __register_frame
+ __register_frame_table
+ __deregister_frame
+ __register_frame_info
+ __deregister_frame_info
+ __frame_state_for
+ __register_frame_info_table
+}
+%endif
--- gcc/config/i386/t-linux64.jj Tue May 7 22:59:33 2002
+++ gcc/config/i386/t-linux64 Tue May 7 22:59:33 2002
@@ -1,6 +1,8 @@
-# On x86-64 we do not need any exports for glibc, override the settings
+# On x86-64 we do not need any exports for glibc for 64-bit libgcc_s,
+# override the settings
# from t-slibgcc-elf-ver and t-linux
-SHLIB_MAPFILES = $(srcdir)/libgcc-std.ver
+SHLIB_MAPFILES = $(srcdir)/libgcc-std.ver \
+ $(srcdir)/config/i386/libgcc-x86_64-glibc.ver
MULTILIB_OPTIONS = m64/m32
MULTILIB_DIRNAMES = 64 32
--- gcc/config/sparc/libgcc-sparc-glibc.ver.jj Tue May 7 17:33:41 2002
+++ gcc/config/sparc/libgcc-sparc-glibc.ver Tue May 7 17:34:50 2002
@@ -0,0 +1,28 @@
+# In order to work around the very problems that force us to now generally
+# create a libgcc.so, glibc reexported a number of routines from libgcc.a.
+# By now choosing the same version tags for these specific routines, we
+# maintain enough binary compatibility to allow future versions of glibc
+# to defer implementation of these routines to libgcc.so via DT_AUXILIARY.
+
+%ifdef __arch64__
+%define GLIBC_VER GLIBC_2.2
+%else
+%define GLIBC_VER GLIBC_2.0
+%endif
+%inherit GCC_3.0 GLIBC_VER
+GLIBC_VER {
+ # Sampling of DImode arithmetic used by (at least) i386 and m68k.
+ __divdi3
+ __moddi3
+ __udivdi3
+ __umoddi3
+
+ # Exception handling support functions used by most everyone.
+ __register_frame
+ __register_frame_table
+ __deregister_frame
+ __register_frame_info
+ __deregister_frame_info
+ __frame_state_for
+ __register_frame_info_table
+}
--- gcc/config/sparc/t-linux64.jj Mon May 6 15:07:12 2002
+++ gcc/config/sparc/t-linux64 Tue May 7 17:37:35 2002
@@ -10,3 +10,9 @@ INSTALL_LIBGCC = install-multilib
EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o
SHLIB_SLIBDIR_SUFFIXES = 64:64 32:
+
+# Override t-slibgcc-elf-ver to export some libgcc symbols with
+# the symbol versions that glibc used.
+# Avoid the t-linux version file.
+SHLIB_MAPFILES = $(srcdir)/libgcc-std.ver \
+ $(srcdir)/config/sparc/libgcc-sparc-glibc.ver
--- gcc/mklibgcc.in.jj Mon May 6 18:02:06 2002
+++ gcc/mklibgcc.in Tue May 7 18:10:27 2002
@@ -263,7 +263,10 @@ for ml in $MULTILIBS; do
tmpmapfile="libgcc/${dir}/tmp-libgcc.map"
echo ""
echo "${mapfile}: $SHLIB_MKMAP $SHLIB_MAPFILES $libgcc_sh_objs"
- echo ' { $(NM_FOR_TARGET)'" $SHLIB_NM_FLAGS $libgcc_sh_objs; echo %%; cat $SHLIB_MAPFILES; } | "'$(AWK)'" -f $SHLIB_MKMAP $SHLIB_MKMAP_OPTS > ${tmpmapfile}"
+ echo ' { $(NM_FOR_TARGET)'" $SHLIB_NM_FLAGS $libgcc_sh_objs; echo %%; \\"
+ echo " cat $SHLIB_MAPFILES | sed -e "'"/^[ ]*#/d" -e '\''s/^%\(if\|else\|elif\|endif\|define\)/#\1/'\'" \\"
+ echo " | $gcc_compile $flags -E -xassembler-with-cpp -; \\"
+ echo ' } | $(AWK)'" -f $SHLIB_MKMAP $SHLIB_MKMAP_OPTS > ${tmpmapfile}"
echo ' mv '"$tmpmapfile"' $@'
fi
shlib_deps="$shlib_deps $mapfile"
Jakub
More information about the Gcc-patches
mailing list