diff mbox

[regression?] Support --static-libstdc++ with native AIX ld

Message ID 5100FC73.8090300@salomon.at
State New
Headers show

Commit Message

Michael Haubenwallner Jan. 24, 2013, 9:18 a.m. UTC
On 01/23/13 20:55, David Edelsohn wrote:
> This patch looks okay, although it needs a ChangeLog entry.

Ok, inside the patch file now rather than at the end of the mail text.
I'm still unsure if the patch should contain a real ChangeLog diff or
a simple comment, as I doubt the ChangeLog diff would apply smoothly.

> Also, is this really sufficient? I guess you are linking the shared
> libstdc++ library statically, which is bulky but will work. In the
> past there have been problems linking libstdc++ statically without
> explicitly linking libsupc++ as well.

It is not me using --static-libstdc++, but gcc itself when linking xgcc/xg++.

Since switching to C++ inside gcc, it isn't possible to get working gcc/g++
binaries installed using native ld on AIX without this patch, as these need
dynamic libstdc++.a from builddir(!). Even after successful build with the
workaround from PR55105[1], installed binaries break when removing builddir.

Since --disable-build-with-cxx/--disable-build-poststage1-with-cxx [2] aren't
supported any more too, this really feels like a regression with 4.8.

[1] http://gcc.gnu.org/PR55105
[2] http://gcc.gnu.org/PR52623

Thank you!
/haubi/

Comments

David Edelsohn Jan. 24, 2013, 5:45 p.m. UTC | #1
On Thu, Jan 24, 2013 at 4:18 AM, Michael Haubenwallner
<michael.haubenwallner@salomon.at> wrote:

> Ok, inside the patch file now rather than at the end of the mail text.
> I'm still unsure if the patch should contain a real ChangeLog diff or
> a simple comment, as I doubt the ChangeLog diff would apply smoothly.
>
>> Also, is this really sufficient? I guess you are linking the shared
>> libstdc++ library statically, which is bulky but will work. In the
>> past there have been problems linking libstdc++ statically without
>> explicitly linking libsupc++ as well.
>
> It is not me using --static-libstdc++, but gcc itself when linking xgcc/xg++.
>
> Since switching to C++ inside gcc, it isn't possible to get working gcc/g++
> binaries installed using native ld on AIX without this patch, as these need
> dynamic libstdc++.a from builddir(!). Even after successful build with the
> workaround from PR55105[1], installed binaries break when removing builddir.
>
> Since --disable-build-with-cxx/--disable-build-poststage1-with-cxx [2] aren't
> supported any more too, this really feels like a regression with 4.8.

I build GCC almost daily on AIX and test installation and do not have
this problem.

Are you configuring GCC in a special way? Do you set the installation
directory prefix when you configure?  I build GCC with GCC and have an
older version of GCC (including libstdc++) already installed.

I do not understand why you refer to native ld on AIX and what that
has to do with any problem.

$ dump -H cc1

                        ***Import File Strings***
INDEX  PATH                          BASE                MEMBER
0      /tmp/20130123/prev-powerpc-ibm-aix7.1.0.0/libstdc++-v3/src/.libs:/tmp/20130123/prev-powerpc-ibm-aix7.1.0.0/libstdc++-v3/libsupc++/.libs:/usr/gnu/lib:../zlib:/tmp/20130123/./prev-gcc:/usr/lib:/lib
1                                    libc.a              shr.o
2                                    libgcc_s.a          shr.o
3                                    libmpfr.a           libmpfr.so.4
4                                    libstdc++.a         libstdc++.so.6
5                                    libgmp.a            libgmp.so.3
6                                    libmpc.a            libmpc.so.2

Yes, it refers to the build directory, but it also include
/usr/gnu/lib on the path and a copy of libstdc++.a is in /usr/gnu/lib.
I often re-link the executable and add -Wl,-blibpath: to set a
narrower search path.

With your patch do you configure with any additional options to cause
the libraries to be linked statically?

The values you set in the patch are correct, but something still does
not make sense with the problem.

Thanks, David
David Edelsohn Jan. 24, 2013, 9:59 p.m. UTC | #2
> Ok, inside the patch file now rather than at the end of the mail text.
> I'm still unsure if the patch should contain a real ChangeLog diff or
> a simple comment, as I doubt the ChangeLog diff would apply smoothly.

The general approach is insert the ChangeLog, as text, in the body of
the email message.  Create a patch for the actual changes to the
source code and append it in the message if it is small or attach it
if it is large.

> Since switching to C++ inside gcc, it isn't possible to get working gcc/g++
> binaries installed using native ld on AIX without this patch, as these need
> dynamic libstdc++.a from builddir(!). Even after successful build with the
> workaround from PR55105[1], installed binaries break when removing builddir.

I have added your patch, but LDFLAGS only includes -static-libstdc++
-static-libgcc for stage1, when the initial GCC does not implement it.
I configure with

--with-boot-ldflags=-L/usr/gnu/lib

so that bootstrap will find the gmp, mpfr, mpc shared libraries.

Do you have those libraries built statically or shared?

Thanks, David
diff mbox

Patch

2014-01-23  Michael Haubenwallner  <michael.haubenwallner@salomon.at>

	AIX ld does support -bstatic/-bdynamic instead of -Bstatic/-Bdynamic.
	* configure.ac (gcc_cv_ld_static_dynamic): Define for AIX native ld.
	* configure: Regenerate.

diff --git a/gcc/configure b/gcc/configure
index 10ff5ae..f153294 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -23650,6 +23650,12 @@  elif test x$gcc_cv_ld != x; then
       gcc_cv_ld_static_dynamic=yes
   else
     case "$target" in
+      # AIX ld uses -b flags
+      *-*-aix4.[23]*|*-*-aix[5-9]*)
+	gcc_cv_ld_static_dynamic=yes
+	gcc_cv_ld_static_option="-bstatic"
+	gcc_cv_ld_dynamic_option="-bdynamic"
+	;;
       # HP-UX ld uses -a flags to select between shared and archive.
       *-*-hpux*)
 	if test x"$gnu_ld" = xno; then
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 3703a20..d33fcb2 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -3317,6 +3317,12 @@  elif test x$gcc_cv_ld != x; then
       gcc_cv_ld_static_dynamic=yes
   else
     case "$target" in
+      # AIX ld uses -b flags
+      *-*-aix4.[[23]]*|*-*-aix[[5-9]]*)
+	gcc_cv_ld_static_dynamic=yes
+	gcc_cv_ld_static_option="-bstatic"
+	gcc_cv_ld_dynamic_option="-bdynamic"
+	;;
       # HP-UX ld uses -a flags to select between shared and archive.
       *-*-hpux*)
 	if test x"$gnu_ld" = xno; then