re PR target/6429 (libgcc_s problem on dual 32/64-bit arches)

PR target/6429
	* Makefile.in (libgcc.mk): Pass SHLIB_SLIBDIR_SUFFIXES to mklibgcc.
	* mklibgcc.in: If SHLIB_SLIBDIR_SUFFIXES is defined, put libgcc_s
	shared libraries into multilib dirs, with SONAME libgcc_s.so.1 for
	base multilibs.
	* config/t-slibgcc-elf-ver (SHLIB_LINK): Adjust for the above.
	* config/t-slibgcc-sld (SHLIB_LINK): Likewise.
	* config/i386/t-linux64 (SHLIB_SLIBDIR_SUFFIXES): Define.
	* config/sparc/t-linux64 (SHLIB_SLIBDIR_SUFFIXES): Define.
	* config/sparc/t-sol2-64 (SHLIB_SLIBDIR_SUFFIXES): Define.

	* lib/g77.exp (g77_link_flags): Append all multilib dirs containing
	libgcc_s*.so.1 below gcc object dir to LD_LIBRARY_PATH.
	* lib/g++.exp (g++_link_flags): Likewise.
	* lib/objc.exp (objc_target_compile): Likewise.

	* testsuite/lib/libstdc++-v3-dg.exp (libstdc++-v3-init): Append all
	multilib dirs containing libgcc_s*.so.1 below gcc object dir to
	LD_LIBRARY_PATH.

	* testsuite/lib/libjava.exp (libjava_arguments): Append all
	multilib dirs containing libgcc_s*.so.1 below gcc object dir to
	LD_LIBRARY_PATH.

From-SVN: r53310
This commit is contained in:
Jakub Jelinek 2002-05-09 01:18:39 +02:00 committed by Jakub Jelinek
parent dd2a0c82df
commit e9ae38ae98
16 changed files with 235 additions and 32 deletions

View File

@ -1,3 +1,16 @@
2002-05-09 Jakub Jelinek <jakub@redhat.com>
PR target/6429
* Makefile.in (libgcc.mk): Pass SHLIB_SLIBDIR_SUFFIXES to mklibgcc.
* mklibgcc.in: If SHLIB_SLIBDIR_SUFFIXES is defined, put libgcc_s
shared libraries into multilib dirs, with SONAME libgcc_s.so.1 for
base multilibs.
* config/t-slibgcc-elf-ver (SHLIB_LINK): Adjust for the above.
* config/t-slibgcc-sld (SHLIB_LINK): Likewise.
* config/i386/t-linux64 (SHLIB_SLIBDIR_SUFFIXES): Define.
* config/sparc/t-linux64 (SHLIB_SLIBDIR_SUFFIXES): Define.
* config/sparc/t-sol2-64 (SHLIB_SLIBDIR_SUFFIXES): Define.
2002-05-08 Mark Mitchell <mark@codesourcery.com>
PR c/6569.

View File

@ -1002,6 +1002,7 @@ libgcc.mk: config.status Makefile mklibgcc $(LIB2ADD) $(LIB2ADD_ST) xgcc$(exeext
SHLIB_MKMAP_OPTS='$(SHLIB_MKMAP_OPTS)' \
SHLIB_MAPFILES='$(SHLIB_MAPFILES)' \
SHLIB_NM_FLAGS='$(SHLIB_NM_FLAGS)' \
SHLIB_SLIBDIR_SUFFIXES='$(SHLIB_SLIBDIR_SUFFIXES)' \
mkinstalldirs='$(SHELL) $(srcdir)/mkinstalldirs' \
$(SHELL) mklibgcc > tmp-libgcc.mk
mv tmp-libgcc.mk libgcc.mk

View File

@ -9,3 +9,5 @@ LIBGCC = stmp-multilib
INSTALL_LIBGCC = install-multilib
EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o
SHLIB_SLIBDIR_SUFFIXES = 64:64 32:

View File

@ -8,3 +8,5 @@ LIBGCC = stmp-multilib
INSTALL_LIBGCC = install-multilib
EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o
SHLIB_SLIBDIR_SUFFIXES = 64:64 32:

View File

@ -6,3 +6,5 @@ LIBGCC = stmp-multilib
INSTALL_LIBGCC = install-multilib
EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o gmon.o crt1.o crti.o crtn.o gcrt1.o
SHLIB_SLIBDIR_SUFFIXES = sparcv9:/sparcv9 sparcv7:

View File

@ -2,22 +2,28 @@
# with the GNU linker.
SHLIB_EXT = .so
SHLIB_NAME = @shlib_base_name@.so
SHLIB_SONAME = @shlib_base_name@.so.1
SHLIB_SOLINK = @shlib_base_name@.so
SHLIB_SONAME = @shlib_so_name@.so.1
SHLIB_NAME = @shlib_dir@@shlib_so_name@.so.1
SHLIB_MAP = @shlib_map_file@
SHLIB_OBJS = @shlib_objs@
SHLIB_SLIBDIR_QUAL = @shlib_slibdir_qual@
SHLIB_LC = -lc
SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \
-Wl,--soname=$(SHLIB_SONAME) \
-Wl,--version-script=$(SHLIB_MAP) \
-o $(SHLIB_NAME) @multilib_flags@ $(SHLIB_OBJS) $(SHLIB_LC) && \
rm -f $(SHLIB_SONAME) && \
$(LN_S) $(SHLIB_NAME) $(SHLIB_SONAME)
rm -f $(SHLIB_SOLINK) && \
$(LN_S) $(SHLIB_NAME) $(SHLIB_SOLINK)
# $(slibdir) double quoted to protect it from expansion while building
# libgcc.mk. We want this delayed until actual install time.
SHLIB_INSTALL = $(INSTALL_DATA) $(SHLIB_NAME) $$(slibdir)/$(SHLIB_SONAME); \
rm -f $$(slibdir)/$(SHLIB_NAME); \
$(LN_S) $(SHLIB_SONAME) $$(slibdir)/$(SHLIB_NAME)
SHLIB_INSTALL = \
$$(SHELL) $$(srcdir)/mkinstalldirs $$(slibdir)$(SHLIB_SLIBDIR_QUAL); \
$(INSTALL_DATA) $(SHLIB_NAME) \
$$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SONAME); \
rm -f $$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK); \
$(LN_S) $(SHLIB_SONAME) \
$$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK)
SHLIB_MKMAP = $(srcdir)/mkmap-symver.awk
SHLIB_MAPFILES = $(srcdir)/libgcc-std.ver

View File

@ -1,21 +1,27 @@
# Build a shared libgcc library with the Solaris linker.
SHLIB_EXT = .so
SHLIB_NAME = @shlib_base_name@.so
SHLIB_SONAME = @shlib_base_name@.so.1
SHLIB_SOLINK = @shlib_base_name@.so
SHLIB_SONAME = @shlib_so_name@.so.1
SHLIB_NAME = @shlib_dir@@shlib_so_name@.so.1
SHLIB_MAP = @shlib_map_file@
SHLIB_OBJS = @shlib_objs@
SHLIB_SLIBDIR_QUAL = @shlib_slibdir_qual@
SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \
-Wl,-h,$(SHLIB_SONAME) -Wl,-z,text -Wl,-z,defs \
-Wl,-M,$(SHLIB_MAP) -o $(SHLIB_NAME) \
@multilib_flags@ $(SHLIB_OBJS) -lc && \
rm -f $(SHLIB_SONAME) && \
$(LN_S) $(SHLIB_NAME) $(SHLIB_SONAME)
rm -f $(SHLIB_SOLINK) && \
$(LN_S) $(SHLIB_NAME) $(SHLIB_SOLINK)
# $(slibdir) double quoted to protect it from expansion while building
# libgcc.mk. We want this delayed until actual install time.
SHLIB_INSTALL = $(INSTALL_DATA) $(SHLIB_NAME) $$(slibdir)/$(SHLIB_SONAME); \
rm -f $$(slibdir)/$(SHLIB_NAME); \
$(LN_S) $(SHLIB_SONAME) $$(slibdir)/$(SHLIB_NAME)
SHLIB_INSTALL = \
$$(SHELL) $$(srcdir)/mkinstalldirs $$(slibdir)$(SHLIB_SLIBDIR_QUAL); \
$(INSTALL_DATA) $(SHLIB_NAME) \
$$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SONAME); \
rm -f $$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK); \
$(LN_S) $(SHLIB_SONAME) \
$$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK)
SHLIB_MKMAP = $(srcdir)/mkmap-symver.awk
SHLIB_MAPFILES = $(srcdir)/libgcc-std.ver

View File

@ -32,6 +32,7 @@
# SHLIB_MAPFILES
# SHLIB_NM_FLAGS
# SHLIB_INSTALL
# SHLIB_SLIBDIR_SUFFIXES
# Make needs VPATH to be literal.
echo 'srcdir = @srcdir@'
@ -306,11 +307,31 @@ for ml in $MULTILIBS; do
echo ' else true; fi;'
if [ -z "$SHLIB_MULTILIB" ]; then
if [ "$dir" = "." ]; then
shlib_base_name="libgcc_s";
if [ "$dir" = . ]; then
shlib_base_name=libgcc_s
else
shlib_base_name=libgcc_s_`echo $dir | sed s,/,_,g`
fi
shlib_so_name="$shlib_base_name"
shlib_dir=
if [ -n "$SHLIB_SLIBDIR_SUFFIXES" ]; then
if [ "$dir" != . ]; then
shlib_dir="$dir"/
for suffix_pair in $SHLIB_SLIBDIR_SUFFIXES ; do
base_ml_dir=`echo ${suffix_pair} | sed -e 's/:.*$//' -e 's/=/$(EQ)/g'`
if [ "$dir" = "$base_ml_dir" ]; then
shlib_so_name=libgcc_s
break
else
canon_dir=`echo $dir | sed -n -e "s:$base_ml_dir/::p"`
if [ -n "$canon_dir" ]; then
shlib_so_name=libgcc_s_`echo $canon_dir | sed s,/,_,g`
break
fi
fi
done
fi
fi
echo ""
echo "${dir}/${shlib_base_name}${SHLIB_EXT}: $shlib_deps"
echo " $SHLIB_LINK" \
@ -318,7 +339,9 @@ for ml in $MULTILIBS; do
-e "s%@multilib_dir@%$dir%g" \
-e "s%@shlib_objs@%$libgcc_sh_objs%g" \
-e "s%@shlib_base_name@%$shlib_base_name%g" \
-e "s%@shlib_map_file@%$mapfile%g"
-e "s%@shlib_map_file@%$mapfile%g" \
-e "s%@shlib_so_name@%$shlib_so_name%g" \
-e "s%@shlib_dir@%$shlib_dir%g"
elif [ "$SHLIB_MULTILIB" = "$dir" ]; then
shlib_base_name="libgcc_s";
echo ""
@ -328,7 +351,9 @@ for ml in $MULTILIBS; do
-e "s%@multilib_dir@%$dir%g" \
-e "s%@shlib_objs@%$libgcc_sh_objs%g" \
-e "s%@shlib_base_name@%$shlib_base_name%g" \
-e "s%@shlib_map_file@%$mapfile%g"
-e "s%@shlib_map_file@%$mapfile%g" \
-e "s%@shlib_so_name@%$shlib_base_name%g" \
-e "s%@shlib_dir@%%g"
fi
fi
done
@ -424,17 +449,60 @@ for ml in $MULTILIBS; do
echo ' $(RANLIB_FOR_TARGET)' ${ldir}/libgcc_eh.a
if [ -z "$SHLIB_MULTILIB" ]; then
if [ "$dir" = "." ]; then
shlib_base_name="libgcc_s";
if [ "$dir" = . ]; then
shlib_base_name=libgcc_s
else
shlib_base_name=libgcc_s_`echo $dir | sed s,/,_,g`
fi
shlib_so_name="$shlib_base_name"
shlib_dir=
shlib_slibdir_qual=none
if [ -n "$SHLIB_SLIBDIR_SUFFIXES" ]; then
if [ "$dir" != . ]; then
shlib_dir="$dir"/
for suffix_pair in $SHLIB_SLIBDIR_SUFFIXES ; do
base_ml_dir=`echo ${suffix_pair} | sed -e 's/:.*$//' -e 's/=/$(EQ)/g'`
if [ "$dir" = "$base_ml_dir" ]; then
shlib_so_name=libgcc_s
shlib_slibdir_qual=`echo ${suffix_pair} | sed -e 's/^[^:]*://'`
break
else
canon_dir=`echo $dir | sed -n -e "s:$base_ml_dir/::p"`
if [ -n "$canon_dir" ]; then
shlib_so_name=libgcc_s_`echo $canon_dir | sed s,/,_,g`
shlib_slibdir_qual=`echo ${suffix_pair} | sed -e 's/^[^:]*://'`
break
fi
fi
done
fi
if [ "$shlib_slibdir_qual" = none ]; then
for suffix_pair in $SHLIB_SLIBDIR_SUFFIXES ; do
base_ml_dir=`echo ${suffix_pair} | sed -e 's/:.*$//' -e 's/=/$(EQ)/g'`
shlib_slibdir_qual=`echo ${suffix_pair} | sed -e 's/^[^:]*://'`
for ml2 in $MULTILIBS; do
dir2=`echo ${ml2} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
if [ "$base_ml_dir" = "$dir2" ]; then
shlib_slibdir_qual=
break
fi
done
if [ -n "$shlib_slibdir_qual" ]; then break; fi
done
fi
fi
echo " $SHLIB_INSTALL" \
| sed -e "s%@shlib_base_name@%$shlib_base_name%g"
| sed -e "s%@shlib_base_name@%$shlib_base_name%g" \
-e "s%@shlib_so_name@%$shlib_so_name%g" \
-e "s%@shlib_dir@%$shlib_dir%g" \
-e "s%@shlib_slibdir_qual@%$shlib_slibdir_qual%g"
elif [ "$SHLIB_MULTILIB" = "$dir" ]; then
shlib_base_name="libgcc_s";
echo " $SHLIB_INSTALL" \
| sed -e "s%@shlib_base_name@%$shlib_base_name%g"
| sed -e "s%@shlib_base_name@%$shlib_base_name%g" \
-e "s%@shlib_so_name@%$shlib_base_name%g" \
-e "s%@shlib_dir@%%g" \
-e "s%@shlib_slibdir_qual@%%g"
fi
fi
done

View File

@ -1,3 +1,10 @@
2002-05-09 Jakub Jelinek <jakub@redhat.com>
* lib/g77.exp (g77_link_flags): Append all multilib dirs containing
libgcc_s*.so.1 below gcc object dir to LD_LIBRARY_PATH.
* lib/g++.exp (g++_link_flags): Likewise.
* lib/objc.exp (objc_target_compile): Likewise.
2002-05-08 Mark Mitchell <mark@codesourcery.com>
PR c/6569

View File

@ -1,4 +1,5 @@
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2002
# Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -108,6 +109,7 @@ proc g++_link_flags { paths } {
global rootme
global srcdir
global ld_library_path
global GXX_UNDER_TEST
set gccpath ${paths}
set libio_dir ""
@ -137,6 +139,20 @@ proc g++_link_flags { paths } {
append flags "-L${gccpath}/librx "
}
append ld_library_path ":${rootme}"
set compiler [lindex $GXX_UNDER_TEST 0]
if { [is_remote host] == 0 && [which $compiler] != 0 } {
foreach i "[exec $compiler --print-multi-lib]" {
set mldir ""
regexp -- "\[a-z0-9=/\.-\]*;" $i mldir
set mldir [string trimright $mldir "\;@"]
if { "$mldir" == "." } {
continue
}
if { [llength [glob -nocomplain ${rootme}/${mldir}/libgcc_s*.so.*]] == 1 } {
append ld_library_path ":${rootme}/${mldir}"
}
}
}
} else {
global tool_root_dir;

View File

@ -75,6 +75,7 @@ proc g77_link_flags { paths } {
global rootme
global srcdir
global ld_library_path
global G77_UNDER_TEST
set gccpath ${paths}
set libio_dir ""
@ -93,6 +94,20 @@ proc g77_link_flags { paths } {
append flags "-L${gccpath}/libiberty "
}
append ld_library_path ":${rootme}"
set compiler [lindex $G77_UNDER_TEST 0]
if { [is_remote host] == 0 && [which $compiler] != 0 } {
foreach i "[exec $compiler --print-multi-lib]" {
set mldir ""
regexp -- "\[a-z0-9=/\.-\]*;" $i mldir
set mldir [string trimright $mldir "\;@"]
if { "$mldir" == "." } {
continue
}
if { [llength [glob -nocomplain ${rootme}/${mldir}/libgcc_s*.so.*]] == 1 } {
append ld_library_path ":${rootme}/${mldir}"
}
}
}
}
# On IRIX 6, we have to set variables akin to LD_LIBRARY_PATH, but

View File

@ -1,4 +1,4 @@
# Copyright (C) 1992, 1993, 1994, 1996, 1997, 2000, 2001
# Copyright (C) 1992, 1993, 1994, 1996, 1997, 2000, 2001, 2002
# Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
@ -85,12 +85,14 @@ proc objc_version { } {
set objc_initialized 0
proc objc_init { args } {
global rootme
global tmpdir
global libdir
global gluefile wrap_flags
global objc_initialized
global OBJC_UNDER_TEST
global TOOL_EXECUTABLE
global objc_libgcc_s_path
if { $objc_initialized == 1 } { return; }
@ -115,6 +117,22 @@ proc objc_init { args } {
unset gluefile
}
}
set objc_libgcc_s_path "${rootme}"
set compiler [lindex $OBJC_UNDER_TEST 0]
if { [is_remote host] == 0 && [which $compiler] != 0 } {
foreach i "[exec $compiler --print-multi-lib]" {
set mldir ""
regexp -- "\[a-z0-9=/\.-\]*;" $i mldir
set mldir [string trimright $mldir "\;@"]
if { "$mldir" == "." } {
continue
}
if { [llength [glob -nocomplain ${rootme}/${mldir}/libgcc_s*.so.*]] == 1 } {
append objc_libgcc_s_path ":${rootme}/${mldir}"
}
}
}
}
proc objc_target_compile { source dest type options } {
@ -124,8 +142,9 @@ proc objc_target_compile { source dest type options } {
global OBJC_UNDER_TEST
global TOOL_OPTIONS
global ld_library_path
global objc_libgcc_s_path
set ld_library_path ".:${rootme}"
set ld_library_path ".:${objc_libgcc_s_path}"
lappend options "libs=-lobjc"
if { [target_info needs_status_wrapper]!="" && [info exists gluefile] } {

View File

@ -1,3 +1,9 @@
2002-05-09 Jakub Jelinek <jakub@redhat.com>
* testsuite/lib/libjava.exp (libjava_arguments): Append all
multilib dirs containing libgcc_s*.so.1 below gcc object dir to
LD_LIBRARY_PATH.
2002-05-08 Alexandre Oliva <aoliva@redhat.com>
* configure.in (ORIGINAL_LD_FOR_MULTILIBS): Preserve LD at

View File

@ -112,6 +112,8 @@ proc libjava_init { args } {
global TOOL_EXECUTABLE
global original_ld_library_path
global env objdir
global tool_root_dir
global libjava_libgcc_s_path
if { $libjava_initialized == 1 } { return; }
@ -164,6 +166,29 @@ proc libjava_init { args } {
}
}
# Finally, add the gcc build directory so that we can find the
# shared libgcc. This, like much of dejagnu, is hideous.
set libjava_libgcc_s_path {}
set gccdir [lookfor_file $tool_root_dir gcc/libgcc_s.so]
if {$gccdir != ""} {
set gccdir [file dirname $gccdir]
lappend libjava_libgcc_s_path $gccdir
set compiler ${gccdir}/xgcc
if { [is_remote host] == 0 && [which $compiler] != 0 } {
foreach i "[exec $compiler --print-multi-lib]" {
set mldir ""
regexp -- "\[a-z0-9=/\.-\]*;" $i mldir
set mldir [string trimright $mldir "\;@"]
if { "$mldir" == "." } {
continue
}
if { [llength [glob -nocomplain ${gccdir}/${mldir}/libgcc_s*.so.*]] == 1 } {
lappend libjava_libgcc_s_path "${gccdir}/${mldir}"
}
}
}
}
set libjava_initialized 1
}
@ -240,6 +265,7 @@ proc libjava_arguments {{mode compile}} {
global runtests
global env
global tool_root_dir
global libjava_libgcc_s_path
if [info exists LIBJAVA] {
set libjava $LIBJAVA;
@ -289,13 +315,7 @@ proc libjava_arguments {{mode compile}} {
}
}
# Finally, add the gcc build directory so that we can find the
# shared libgcc. This, like much of dejagnu, is hideous.
set gccdir [lookfor_file $tool_root_dir gcc/libgcc_s.so]
if {$gccdir != ""} {
lappend lpath [file dirname $gccdir]
}
set lpath [concat $lpath $libjava_libgcc_s_path]
set ld_library_path [join $lpath :]
# That's enough to make things work for the normal case.

View File

@ -1,3 +1,9 @@
2002-05-09 Jakub Jelinek <jakub@redhat.com>
* testsuite/lib/libstdc++-v3-dg.exp (libstdc++-v3-init): Append all
multilib dirs containing libgcc_s*.so.1 below gcc object dir to
LD_LIBRARY_PATH.
2002-05-08 Alexandre Oliva <aoliva@redhat.com>
* configure.in (ORIGINAL_LD_FOR_MULTILIBS): Preserve LD at

View File

@ -67,6 +67,20 @@ proc libstdc++-v3-init { args } {
set ld_library_path "."
append ld_library_path ":${gccdir}"
set compiler ${gccdir}/g++
if { [is_remote host] == 0 && [which $compiler] != 0 } {
foreach i "[exec $compiler --print-multi-lib]" {
set mldir ""
regexp -- "\[a-z0-9=/\.-\]*;" $i mldir
set mldir [string trimright $mldir "\;@"]
if { "$mldir" == "." } {
continue
}
if { [llength [glob -nocomplain ${gccdir}/${mldir}/libgcc_s*.so.*]] == 1 } {
append ld_library_path ":${gccdir}/${mldir}"
}
}
}
append ld_library_path ":${blddir}/src/.libs"
# On IRIX 6, we have to set variables akin to LD_LIBRARY_PATH, but