This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] support --without-multilib --with-specs=-pthread on AIX
- From: Michael Haubenwallner <michael dot haubenwallner at ssi-schaefer dot com>
- To: David Edelsohn <dje dot gcc at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 17 Feb 2015 09:03:59 +0100
- Subject: [PATCH] support --without-multilib --with-specs=-pthread on AIX
- Authentication-results: sourceware.org; auth=none
Hi David,
according to LIB_SPEC found in config/rs6000/aix*.h, pthread linking was done with
"-lpthreads -lc_r libc.a" for aix43, which simplified to "-lpthreads -lc" with aix51.
But libgcc_s still is linked the aix43 way with "-lpthreads -lc_r libc.a".
As libc_r.a is a symlink to libc.a now, do you know if its shared objects are loaded
both as "libc.a(shr.o)" and "libc_r.a(shr.o)", or as "libc.a(shr.o)" only?
Can this be a problem worth a bug entry?
Anyway, this patch allows me to configure --without-multilib --with-specs=-pthread
Thanks!
/haubi/
>From cee852b7e80f15474187673926c4e0a96d454cac Mon Sep 17 00:00:00 2001
From: Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
Date: Tue, 3 Feb 2015 12:56:53 +0100
Subject: [PATCH] support --without-multilib --with-specs=-pthread on AIX
2015-02-17 Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
* config/rs6000/t-slibgcc-aix (SHLIB_LINK): Link libgcc_s with
empty nolibgcc.specs, do not use -nodefaultlibs.
---
libgcc/config/rs6000/t-slibgcc-aix | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
diff --git a/libgcc/config/rs6000/t-slibgcc-aix b/libgcc/config/rs6000/t-slibgcc-aix
index 61853e0..b89e9e0 100644
--- a/libgcc/config/rs6000/t-slibgcc-aix
+++ b/libgcc/config/rs6000/t-slibgcc-aix
@@ -35,13 +35,11 @@ SHLIB_EXT = $(SHLIB_EXT_$(with_aix_soname))
SHLIB_SOVERSION = 1
SHLIB_SONAME = @shlib_base_name@.so.$(SHLIB_SOVERSION)
SHLIB_LINK = \
+ { echo '*libgcc:'; echo; echo; } > nolibgcc.specs ; \
if test svr4 != $(with_aix_soname) ; then \
- $(CC) $(LIBGCC2_CFLAGS) -shared -Wl,-bnortl -nodefaultlibs \
+ $(CC) $(LIBGCC2_CFLAGS) -shared -Wl,-bnortl -specs=nolibgcc.specs \
-Wl,-bE:@shlib_map_file@ -o @multilib_dir@/shr.o \
- @multilib_flags@ @shlib_objs@ -lc \
- `case @multilib_dir@ in \
- *pthread*) echo -L$(TARGET_SYSTEM_ROOT)/usr/lib/threads -lpthreads -lc_r $(TARGET_SYSTEM_ROOT)/usr/lib/libc.a ;; \
- *) echo -lc ;; esac` ; \
+ @multilib_flags@ @shlib_objs@ ; \
rm -f @multilib_dir@/tmp-@shlib_base_name@.a ; \
$(AR_CREATE_FOR_TARGET) @multilib_dir@/tmp-@shlib_base_name@.a \
@multilib_dir@/shr.o ; \
@@ -51,12 +49,9 @@ SHLIB_LINK = \
fi ; \
if test aix != $(with_aix_soname) ; then \
case @multilib_dir@ in *64*) shr='shr_64' ;; *) shr='shr' ;; esac ; \
- $(CC) $(LIBGCC2_CFLAGS) -shared -Wl,-G -nodefaultlibs \
+ $(CC) $(LIBGCC2_CFLAGS) -shared -Wl,-G -specs=nolibgcc.specs \
-Wl,-bE:@shlib_map_file@ -o @multilib_dir@/$$shr.o \
- @multilib_flags@ @shlib_objs@ -lc \
- `case @multilib_dir@ in \
- *pthread*) echo -L$(TARGET_SYSTEM_ROOT)/usr/lib/threads -lpthreads -lc_r $(TARGET_SYSTEM_ROOT)/usr/lib/libc.a ;; \
- *) echo -lc ;; esac` ; \
+ @multilib_flags@ @shlib_objs@ ; \
$(STRIP_FOR_TARGET) -X32_64 -e @multilib_dir@/$$shr.o ; \
{ echo "\#! $(SHLIB_SONAME)($$shr.o)" ; \
case @multilib_dir@ in *64*) echo '\# 64' ;; *) echo '\# 32' ;; esac ; \
@@ -70,7 +65,8 @@ SHLIB_LINK = \
rm -f @multilib_dir@/@shlib_base_name@.so ; \
$(LN_S) $(SHLIB_SONAME) @multilib_dir@/@shlib_base_name@.so ; \
rm -f @multilib_dir@/$$shr.imp @multilib_dir@/$$shr.o ; \
- fi
+ fi ; \
+ rm -f nolibgcc.specs
SHLIB_INSTALL = \
$(mkinstalldirs) $(DESTDIR)$(slibdir)@shlib_slibdir_qual@; \
if test svr4 != $(with_aix_soname) ; then \
--
2.0.5