libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MLB] AIX fixes patch


From: Robert Boehne
Subject: Re: [MLB] AIX fixes patch
Date: Mon, 11 Jun 2001 10:50:40 -0500

Robert Boehne wrote:
> 
> Alexandre Oliva wrote:
> >
> > On Jun  2, 2001, Robert Boehne <address@hidden> wrote:
> >
> > > ChangeLog entry:
> >
> > > 2001-06-02  Albert Chin  <address@hidden>
> >
> > >       * ltconfig.in [aix4* | aix5*]: Enable the $aix_use_runtimelinking
> > >       variable to turn on run time linking if -brtl is in LDFLAGS.
> > >       * ltcf-gcj.sh ditto.
> > >       * ltcf-c.sh ditto.  Also fix incorrect setting of 
> > > lt_cv_prog_cc_static
> > >         when using gcc.
> > >       * ltcf-cxx.sh ditto.
> >
> > Thanks, Robert, this looks ok.  Did you have a chance to test it on
> > AIX 4.3 by bootstrapping GCC 3.0-CVS with it?
> >
> 
> Alexandre:
> 
> I tried several times, but couldn't get libstdc++ to build for
> other reasons.  I've been hitting our only AIX machine pretty
> hard, compiling my 57 (large) library project, attempting to
> bootstrap with GNU ld, and the release builds of other
> commerical software.
> I finally gave up and sent in the patch.  I will be able
> to try it again in about two weeks, so if you'd rather hold
> off on updating the GCC libtool until then that's OK with me.
> 

Here is an updated patch that builds a working gcc 3.0
under AIX 4.3.  :)


-- 
Robert Boehne             Software Engineer
Ricardo Software   Chicago Technical Center
TEL: (630)789-0003 x. 238
FAX: (630)789-0127
email:  address@hidden
Index: ltcf-c.sh
===================================================================
RCS file: /cvsroot/libtool/libtool/Attic/ltcf-c.sh,v
retrieving revision 1.1.2.38
diff -u -r1.1.2.38 ltcf-c.sh
--- ltcf-c.sh   2001/06/04 19:32:48     1.1.2.38
+++ ltcf-c.sh   2001/06/11 15:47:22
@@ -268,6 +268,31 @@
     ;;
 
   aix4* | aix5*)
+    if test "$host_cpu" = ia64; then
+      # On IA64, the linker does runtime linking by default, so we don't
+      # have to do anything special.
+      aix_use_runtimelinking=no
+      exp_sym_flag='-Bexport'
+      no_entry_flag=""
+    else
+      aix_use_runtimelinking=no
+
+      # Test if we are trying to use run time linking or normal
+      # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+      # need to do runtime linking.
+      case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+        for ld_flag in $LDFLAGS; do
+          if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl" ); then
+            aix_use_runtimelinking=yes
+            break
+          fi
+        done
+      esac
+
+      exp_sym_flag='-bexport'
+      no_entry_flag='-bnoentry'
+    fi
+
     hardcode_direct=yes
     hardcode_libdir_separator=':'
     link_all_deplibs=yes
@@ -303,29 +328,14 @@
       if test "$host_cpu" = ia64; then
         shared_flag='${wl}-G'
       else
-        shared_flag='${wl}-bM:SRE'
+        if test "$aix_use_runtimelinking" = yes; then
+          shared_flag='${wl}-G'
+        else
+          shared_flag='${wl}-bM:SRE'
+        fi
       fi
     fi
 
-    if test "$host_cpu" = ia64; then
-      # On IA64, the linker does run time linking by default, so we don't
-      # have to do anything special.
-      aix_use_runtimelinking=no
-      exp_sym_flag='-Bexport'
-      no_entry_flag=""
-    else
-      # Test if we are trying to use run time linking, or normal AIX style 
linking.
-      # If -brtl is somewhere in LDFLAGS, we need to do run time linking.
-      aix_use_runtimelinking=no
-      for ld_flag in $LDFLAGS; do
-        if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl" ); then
-          aix_use_runtimelinking=yes
-          break
-        fi
-      done
-      exp_sym_flag='-bexport'
-      no_entry_flag='-bnoentry'
-    fi
     # -bexpall does not export symbols beginning with underscore (_)
     always_export_symbols=yes
     if test "$aix_use_runtimelinking" = yes; then
@@ -333,7 +343,11 @@
       #           link without error, but may produce a broken library.
       allow_undefined_flag=' ${wl}-berok'
       hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
-      archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname 
$libobjs $deplibs $compiler_flags ${allow_undefined_flag} 
'"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
+
+      # Shared library flag -G must be at the end of the link line
+      # because it is the conglomeration of other flags and we don't
+      # want any user-supplied flags overriding the behavior of -G.
+      archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs 
$compiler_flags '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols 
$shared_flag"
     else
       if test "$host_cpu" = ia64; then
         hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
@@ -347,8 +361,8 @@
         whole_archive_flag_spec=' '
         build_libtool_need_lc=yes
         hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
-        # This is similar to how AIX traditionally builds it's shared 
libraries.
-        archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname 
$libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols 
${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS 
$output_objdir/$libname$release.a $output_objdir/$soname'
+        # This is similar to how AIX traditionally builds it's shared libraries
+        archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname 
$libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry~$AR 
$AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
       fi
     fi
     ;;
@@ -631,12 +645,7 @@
     case $host_os in
     aix*)
       # All AIX code is PIC.
-      if test "$host_cpu" = ia64; then
-        # AIX 5 now supports IA64 processor
-        lt_cv_prog_cc_static='-Bstatic'
-      else
-        lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
-      fi
+      ac_cv_prog_cc_pic=
       ;;
     amigaos*)
       # FIXME: we need at least 68020 code to build shared libraries, but
@@ -674,8 +683,14 @@
     # PORTME Check for PIC flags for the system compiler.
     case $host_os in
     aix*)
-     # All AIX code is PIC.
-      ac_cv_prog_cc_static="$ac_cv_prog_cc_static ${ac_cv_prog_cc_wl}-lC"
+      ac_cv_prog_cc_wl='-Wl,'
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+        # AIX 5 now supports IA64 processor
+        ac_cv_prog_cc_static='-Bstatic'
+      else
+        ac_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
+      fi
       ;;
 
     hpux9* | hpux10* | hpux11*)
Index: ltcf-cxx.sh
===================================================================
RCS file: /cvsroot/libtool/libtool/Attic/ltcf-cxx.sh,v
retrieving revision 1.1.2.47
diff -u -r1.1.2.47 ltcf-cxx.sh
--- ltcf-cxx.sh 2001/05/28 20:59:25     1.1.2.47
+++ ltcf-cxx.sh 2001/06/11 15:47:22
@@ -121,6 +121,31 @@
     ld_shlibs=no
     ;;
   aix4* | aix5*)
+    if test "$host_cpu" = ia64; then
+      # On IA64, the linker does run time linking by default, so we don't
+      # have to do anything special.
+      aix_use_runtimelinking=no
+      exp_sym_flag='-Bexport'
+      no_entry_flag=""
+    else
+      aix_use_runtimelinking=no
+
+      # Test if we are trying to use run time linking or normal
+      # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+      # need to do runtime linking.
+      case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+        for ld_flag in $LDFLAGS; do
+          if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+            aix_use_runtimelinking=yes
+            break
+          fi
+        done
+      esac
+
+      exp_sym_flag='-bexport'
+      no_entry_flag='-bnoentry'
+    fi
+
     archive_cmds=''
     hardcode_direct=yes
     hardcode_libdir_separator=':'
@@ -157,36 +182,24 @@
       if test "$host_cpu" = ia64; then
         shared_flag='${wl}-G'
       else
-        shared_flag='${wl}-bM:SRE'
+        if test "$aix_use_runtimelinking" = yes; then
+          shared_flag='${wl}-G'
+        else
+          shared_flag='${wl}-bM:SRE'
+        fi
       fi
     fi
 
-    if test "$host_cpu" = ia64; then
-      # On IA64, the linker does run time linking by default, so we don't
-      # have to do anything special.
-      aix_use_runtimelinking=no
-      exp_sym_flag='-Bexport'
-      no_entry_flag=""
-    else
-      # Test if we are trying to use run time linking, or normal AIX style 
linking.
-      # If -brtl is somewhere in LDFLAGS, we need to do run time linking.
-      aix_use_runtimelinking=no
-      for ld_flag in $LDFLAGS; do
-        if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl" ); then
-          aix_use_runtimelinking=yes
-          break
-        fi
-      done
-      exp_sym_flag='-bexport'
-      no_entry_flag='-bnoentry'
-    fi
     # It seems that -bexpall does not export symbols beginning with
     # underscore (_), so it is better to generate a list of symbols to export.
     always_export_symbols=yes
     if test "$aix_use_runtimelinking" = yes; then
+      # Warning - without using the other runtime loading flags (-brtl),
+      # -berok will link without error, but may produce a broken library.
+      allow_undefined_flag=' ${wl}-berok'
       hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
-      allow_undefined_flag=' -Wl,-G'
-      archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname 
$libobjs $deplibs $compiler_flags ${allow_undefined_flag} 
'"\${wl}$no_entry_flag \${wl}-brtl \${wl}$exp_sym_flag:\$export_symbols"
+
+      archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs 
$compiler_flags '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols 
$shared_flag"
      else
       if test "$host_cpu" = ia64; then
         hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
@@ -204,7 +217,7 @@
         whole_archive_flag_spec=' '
         build_libtool_need_lc=yes
         # This is similar to how AIX traditionally builds it's shared 
libraries.
-        archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname 
$libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols 
${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS 
$output_objdir/$libname$release.a $output_objdir/$soname'
+        archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname 
$libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry 
${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a 
$output_objdir/$soname'
       fi
     fi
     ;;
@@ -666,12 +679,7 @@
   case $host_os in
   aix*)
     # All AIX code is PIC.
-    if test "$host_cpu" = ia64; then
-      # AIX 5 now supports IA64 processor
-      lt_cv_prog_cc_static='-Bstatic'
-    else
-      lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
-    fi
+    ac_cv_prog_cc_pic=
     ;;
   amigaos*)
     # FIXME: we need at least 68020 code to build shared libraries, but
@@ -708,12 +716,13 @@
 else
   case $host_os in
     aix4* | aix5*)
+      ac_cv_prog_cc_wl='-Wl,'
       # All AIX code is PIC.
       if test "$host_cpu" = ia64; then
         # AIX 5 now supports IA64 processor
-        lt_cv_prog_cc_static='-Bstatic'
+        ac_cv_prog_cc_static='-Bstatic'
       else
-        lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
+        ac_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
       fi
       ;;
     chorus*)
Index: ltcf-gcj.sh
===================================================================
RCS file: /cvsroot/libtool/libtool/Attic/ltcf-gcj.sh,v
retrieving revision 1.1.2.21
diff -u -r1.1.2.21 ltcf-gcj.sh
--- ltcf-gcj.sh 2001/04/24 23:58:18     1.1.2.21
+++ ltcf-gcj.sh 2001/06/11 15:47:22
@@ -605,13 +605,8 @@
       # PIC is the default for these OSes.
       ;;
     aix*)
-      # Below there is a dirty hack to force normal static linking with -ldl
-      # The problem is because libdl dynamically linked with both libc and
-      # libC (AIX C++ library), which obviously doesn't included in libraries
-      # list by gcc. This cause undefined symbols with -static flags.
-      # This hack allows C programs to be linked with "-static -ldl", but
-      # we not sure about C++ programs.
-      ac_cv_prog_cc_static="$ac_cv_prog_cc_static ${ac_cv_prog_cc_wl}-lC"
+      # All aix code is PIC.
+      ac_cv_prog_cc_pic=
       ;;
     *djgpp*)
       # DJGPP does not suppot shared libraries at all
Index: ltconfig.in
===================================================================
RCS file: /cvsroot/libtool/libtool/Attic/ltconfig.in,v
retrieving revision 1.246.2.61
diff -u -r1.246.2.61 ltconfig.in
--- ltconfig.in 2001/05/28 20:09:07     1.246.2.61
+++ ltconfig.in 2001/06/11 15:47:22
@@ -1540,8 +1540,8 @@
 echo $ac_n "checking whether to build shared libraries... $ac_c" 1>&6
 test "$can_build_shared" = "no" && enable_shared=no
 
-# On AIX, shared libraries and static libraries use the same namespace, and
-# are all built from PIC.
+# On AIX 3, shared libraries and static libraries use the same namespace,
+# and are all built from PIC.
 case $host_os in
 aix3*)
   test "$enable_shared" = yes && enable_static=no
@@ -1552,7 +1552,9 @@
   ;;
 
 aix4*)
-  test "$enable_shared" = yes && enable_static=no
+  if test "$aix_use_runtimelinking" != yes; then
+    test "$enable_shared" = yes && enable_static=no
+  fi
   ;;
 esac
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]