public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Ulrich Drepper <drepper@redhat.com>
Cc: Glibc hackers <libc-hacker@sources.redhat.com>
Subject: [PATCH] Fix -lgcc_s configury with multilib compilers
Date: Sat, 08 May 2004 16:58:00 -0000	[thread overview]
Message-ID: <20040508144622.GT5191@sunsite.ms.mff.cuni.cz> (raw)

Hi!

libgcc_s.so.1 isn't always -lgcc_s, e.g. for x86-64 gcc -m32
it is -lgcc_s_32 etc.
This patch makes it possible to build 32-bit glibc on x86-64
with x86-64 gcc (and similarly on other arches).
All that is needed is:
CC="gcc -m32" CXX="g++ -m32" ../configure ... --target i686-pc-linux ...

2004-05-08  Jakub Jelinek  <jakub@redhat.com>

	* configure.in (libc_cv_libgcc_s_suffix): New check.
	(libc_cv_as_needed): Use -lgcc_s$libc_cv_libgcc_s_suffix.
	* config.make.in (libgcc_s_suffix): Set.
	* Makeconfig (libgcc_eh): Use -lgcc_s$(libgcc_s_suffix).
	* configure: Rebuilt.

--- libc/configure.in.jj	2004-04-21 10:05:58.000000000 +0200
+++ libc/configure.in	2004-04-29 14:50:24.982280886 +0200
@@ -1315,14 +1315,29 @@ EOF
   rm -f conftest*])
   AC_SUBST(libc_cv_Bgroup)
 
+  AC_CACHE_CHECK(for libgcc_s suffix,
+		 libc_cv_libgcc_s_suffix, [dnl
+  cat > conftest.c <<EOF
+int main (void) { return 0; }
+EOF
+changequote(,)dnl
+  libc_cv_libgcc_s_suffix=`${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
+			   -shared -shared-libgcc -o conftest.so \
+			   conftest.c -v 2>&1 >/dev/null \
+			   | sed -n 's/^.* -lgcc_s\([^ ]*\) .*$/\1/p'`
+changequote([,])dnl
+  rm -f conftest*])
+  AC_SUBST(libc_cv_libgcc_s_suffix)
+
   AC_CACHE_CHECK(for --as-needed option,
 		 libc_cv_as_needed, [dnl
   cat > conftest.c <<EOF
 int main (void) { return 0; }
 EOF
   if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
-			      -shared -o conftest.so conftest.c -lgcc_s
-			      -Wl,--as-needed -nostdlib 1>&AS_MESSAGE_LOG_FD])
+			      -shared -o conftest.so conftest.c
+			      -lgcc_s$libc_cv_libgcc_s_suffix -Wl,--as-needed
+			      -nostdlib 1>&AS_MESSAGE_LOG_FD])
   then
     libc_cv_as_needed=yes
   else
--- libc/config.make.in.jj	2004-04-13 10:42:50.000000000 +0200
+++ libc/config.make.in	2004-04-29 14:48:38.149426724 +0200
@@ -47,6 +47,7 @@ have-initfini = @libc_cv_have_initfini@
 have-z-relro = @libc_cv_z_relro@
 have-Bgroup = @libc_cv_Bgroup@
 have-as-needed = @libc_cv_as_needed@
+libgcc_s_suffix = @libc_cv_libgcc_s_suffix@
 need-nopic-initfini = @nopic_initfini@
 with-fp = @with_fp@
 with-cvs = @with_cvs@
--- libc/Makeconfig.jj	2004-04-21 10:10:03.000000000 +0200
+++ libc/Makeconfig	2004-04-29 14:49:02.324094309 +0200
@@ -520,7 +520,7 @@ ifndef gnulib
 ifneq ($(have-as-needed),yes)
  libgcc_eh := -lgcc_eh
 else
- libgcc_eh := -Wl,--as-needed -lgcc_s -Wl,--no-as-needed
+ libgcc_eh := -Wl,--as-needed -lgcc_s$(libgcc_s_suffix) -Wl,--no-as-needed
 endif
 ifneq ($(have-cc-with-libunwind),yes)
  gnulib := -lgcc $(libgcc_eh)
--- libc/configure.jj	2004-04-29 11:34:14.000000000 +0200
+++ libc/configure	2004-04-29 14:50:28.265692455 +0200
@@ -313,7 +313,7 @@ ac_includes_default="\
 # include <unistd.h>
 #endif"
 
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS with_fp with_cvs enable_check_abi oldest_abi bindnow subdirs force_install all_warnings build build_cpu build_vendor build_os host host_cpu host_vendor host_os base_machine sysnames INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT BUILD_CC cross_compiling CPP CXX CXXFLAGS ac_ct_CXX AR OBJDUMP RANLIB ac_ct_RANLIB MIG AS LD PWD_P MAKE MSGFMT MAKEINFO SED AUTOCONF SYSINCLUDES libc_cv_gcc_static_libgcc BASH libc_cv_have_bash2 KSH libc_cv_have_ksh AWK PERL INSTALL_INFO BISON VERSIONING libc_cv_asm_protected_directive libc_cv_initfinit_array libc_cv_cc_with_libunwind libc_cv_z_nodelete libc_cv_z_nodlopen libc_cv_z_initfirst libc_cv_z_relro libc_cv_Bgroup libc_cv_as_needed ASFLAGS_config libc_cv_z_combreloc libc_cv_z_execstack libc_cv_fpie fno_unit_at_a_time libc_cv_have_initfini libc_cv_cpp_asm_debuginfo no_whole_archive exceptions LIBGD EGREP sizeof_long_double libc_cv_gcc_unwind_find_fde uname_sysname uname_release uname_version old_glibc_headers libc_cv_slibdir libc_cv_localedir libc_cv_sysconfdir libc_cv_rootsbindir libc_cv_forced_unwind use_ldconfig ldd_rewrite_script gnu_ld gnu_as elf xcoff static shared pic_default profile omitfp bounded static_nss nopic_initfini DEFINES linux_doors mach_interface_list VERSION RELEASE LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS with_fp with_cvs enable_check_abi oldest_abi bindnow subdirs force_install all_warnings build build_cpu build_vendor build_os host host_cpu host_vendor host_os base_machine sysnames INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT BUILD_CC cross_compiling CPP CXX CXXFLAGS ac_ct_CXX AR OBJDUMP RANLIB ac_ct_RANLIB MIG AS LD PWD_P MAKE MSGFMT MAKEINFO SED AUTOCONF SYSINCLUDES libc_cv_gcc_static_libgcc BASH libc_cv_have_bash2 KSH libc_cv_have_ksh AWK PERL INSTALL_INFO BISON VERSIONING libc_cv_asm_protected_directive libc_cv_initfinit_array libc_cv_cc_with_libunwind libc_cv_z_nodelete libc_cv_z_nodlopen libc_cv_z_initfirst libc_cv_z_relro libc_cv_Bgroup libc_cv_libgcc_s_suffix libc_cv_as_needed ASFLAGS_config libc_cv_z_combreloc libc_cv_z_execstack libc_cv_fpie fno_unit_at_a_time libc_cv_have_initfini libc_cv_cpp_asm_debuginfo no_whole_archive exceptions LIBGD EGREP sizeof_long_double libc_cv_gcc_unwind_find_fde uname_sysname uname_release uname_version old_glibc_headers libc_cv_slibdir libc_cv_localedir libc_cv_sysconfdir libc_cv_rootsbindir libc_cv_forced_unwind use_ldconfig ldd_rewrite_script gnu_ld gnu_as elf xcoff static shared pic_default profile omitfp bounded static_nss nopic_initfini DEFINES linux_doors mach_interface_list VERSION RELEASE LIBOBJS LTLIBOBJS'
 ac_subst_files=''
 
 # Initialize some variables set by options.
@@ -5556,6 +5556,24 @@ echo "$as_me:$LINENO: result: $libc_cv_B
 echo "${ECHO_T}$libc_cv_Bgroup" >&6
 
 
+  echo "$as_me:$LINENO: checking for libgcc_s suffix" >&5
+echo $ECHO_N "checking for libgcc_s suffix... $ECHO_C" >&6
+if test "${libc_cv_libgcc_s_suffix+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+    cat > conftest.c <<EOF
+int main (void) { return 0; }
+EOF
+  libc_cv_libgcc_s_suffix=`${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
+			   -shared -shared-libgcc -o conftest.so \
+			   conftest.c -v 2>&1 >/dev/null \
+			   | sed -n 's/^.* -lgcc_s\([^ ]*\) .*$/\1/p'`
+  rm -f conftest*
+fi
+echo "$as_me:$LINENO: result: $libc_cv_libgcc_s_suffix" >&5
+echo "${ECHO_T}$libc_cv_libgcc_s_suffix" >&6
+
+
   echo "$as_me:$LINENO: checking for --as-needed option" >&5
 echo $ECHO_N "checking for --as-needed option... $ECHO_C" >&6
 if test "${libc_cv_as_needed+set}" = set; then
@@ -5565,8 +5583,9 @@ else
 int main (void) { return 0; }
 EOF
   if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
-			      -shared -o conftest.so conftest.c -lgcc_s
-			      -Wl,--as-needed -nostdlib 1>&5'
+			      -shared -o conftest.so conftest.c
+			      -lgcc_s$libc_cv_libgcc_s_suffix -Wl,--as-needed
+			      -nostdlib 1>&5'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -8244,6 +8263,7 @@ s,@libc_cv_z_nodlopen@,$libc_cv_z_nodlop
 s,@libc_cv_z_initfirst@,$libc_cv_z_initfirst,;t t
 s,@libc_cv_z_relro@,$libc_cv_z_relro,;t t
 s,@libc_cv_Bgroup@,$libc_cv_Bgroup,;t t
+s,@libc_cv_libgcc_s_suffix@,$libc_cv_libgcc_s_suffix,;t t
 s,@libc_cv_as_needed@,$libc_cv_as_needed,;t t
 s,@ASFLAGS_config@,$ASFLAGS_config,;t t
 s,@libc_cv_z_combreloc@,$libc_cv_z_combreloc,;t t

	Jakub

                 reply	other threads:[~2004-05-08 16:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040508144622.GT5191@sunsite.ms.mff.cuni.cz \
    --to=jakub@redhat.com \
    --cc=drepper@redhat.com \
    --cc=libc-hacker@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).