[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[MLB] Revised patch for AIX
From: |
Robert Boehne |
Subject: |
[MLB] Revised patch for AIX |
Date: |
Fri, 09 Feb 2001 14:03:17 -0600 |
Hello!
This patch is an improved version of the patch that David Edelsohn,
Dan McNichol and I collaborated on. In essence, this patch uses
David's methods under Power* aix4*, and Dan's patches otherwise.
I wanted this revision available to everyone, GCC testers
in particular, even before it has been blessed for commit.
I believe we are still waiting for paperwork from Dan.
Anyone care to build gcc's libstdc++ with it?
ChangeLog entry:
2001-02-09 Robert Boehne <address@hidden>
* ltcf-cxx.sh: Added support for g++ under
AIX 4 and 5 on Power* and IA64.
* ltcf-c.sh: Added support for gcc under
AIX 4 and 5 on Power* and IA64
* ltconfig.in: The export_symbols_cmds had to be
specifically changed under AIX.
--
Robert Boehne Software Engineer
Ricardo Software Chicago Technical Center
TEL: (630)789-0003 x. 238
FAX: (630)789-0127
email: address@hidden
2001-02-09 Robert Boehne <address@hidden>
* ltcf-cxx.sh: Added support for g++ under
AIX 4 and 5 on Power* and IA64.
* ltcf-c.sh: Added support for gcc under
AIX 4 and 5 on Power* and IA64
* ltconfig.in: The export_symbols_cmds had to be
specifically changed under AIX.
Index: ltcf-c.sh
===================================================================
RCS file: /cvsroot/libtool/libtool/Attic/ltcf-c.sh,v
retrieving revision 1.1.2.25
diff -u -r1.1.2.25 ltcf-c.sh
--- ltcf-c.sh 2001/01/27 19:20:51 1.1.2.25
+++ ltcf-c.sh 2001/02/09 19:52:37
@@ -57,7 +57,7 @@
# See if GNU ld supports shared libraries.
case "$host_os" in
- aix3* | aix4*)
+ aix3* | aix4* | aix5*)
# On AIX, the GNU linker is very broken
ld_shlibs=no
cat <<EOF 1>&2
@@ -263,9 +263,14 @@
fi
;;
- aix4*)
- hardcode_libdir_flag_spec='${wl}-b ${wl}nolibpath ${wl}-b
${wl}libpath:$libdir:/usr/lib:/lib'
+ aix4* | aix5*)
hardcode_libdir_separator=':'
+ link_all_deplibs=yes
+ # When large executables or shared objects are built, AIX ld can
+ # have problems creating the table of contents. If linking a library
+ # or program results in "error TOC overflow" add -mminimal-toc to
+ # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
+ # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
if test "$with_gcc" = yes; then
collect2name=`${CC} -print-prog-name=collect2`
if test -f "$collect2name" && \
@@ -285,23 +290,59 @@
fi
shared_flag='-shared'
else
- shared_flag='${wl}-bM:SRE'
+ if test "$host_cpu" = ia64; then
+ shared_flag='${wl}-G'
+ else
+ shared_flag='${wl}-bM:SRE'
+ fi
hardcode_direct=yes
fi
- allow_undefined_flag=' ${wl}-berok'
- archive_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs
$deplibs $compiler_flags ${wl}-bexpall ${wl}-bnoentry${allow_undefined_flag}'
- archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname
$libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols
${wl}-bnoentry${allow_undefined_flag}'
- case "$host_os" in aix4.[01]|aix4.[01].*)
- # According to Greg Wooledge, -bexpall is only supported from AIX 4.2 on
- always_export_symbols=yes ;;
- esac
- # We don't want to build shared libraries on unknown CPU types.
- case $host_cpu in
- powerpc | rs6000) ;;
- *) ld_shlibs=no ;;
- esac
- ;;
+ 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
+ # Warning - without using the other run time 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'
+ 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"
+ else
+ if test "$host_cpu" = ia64; then
+ hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+ allow_undefined_flag="-z nodefs"
+ archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname
$libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag}
'"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
+ else
+ allow_undefined_flag=' ${wl}-berok'
+ # -bexpall does not export symbols beginning with underscore (_)
+ always_export_symbols=yes
+ # Exported symbols can be pulled into shared objects from archives
+ 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'
+ fi
+ fi
+ ;;
amigaos*)
archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME
$libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >>
$output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >>
$output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >>
$output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd
$output_objdir && a2ixlibrary -32)'
@@ -564,13 +605,13 @@
# 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.
+ 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
;;
cygwin* | mingw* | os2*)
# This hack is so that the source file can tell whether it is being
@@ -595,9 +636,9 @@
else
# PORTME Check for PIC flags for the system compiler.
case "$host_os" in
- aix3* | aix4*)
+ aix*)
# All AIX code is PIC.
- ac_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
+ ac_cv_prog_cc_static="$ac_cv_prog_cc_static ${ac_cv_prog_cc_wl}-lC"
;;
hpux9* | hpux10* | hpux11*)
Index: ltcf-cxx.sh
===================================================================
RCS file: /cvsroot/libtool/libtool/Attic/ltcf-cxx.sh,v
retrieving revision 1.1.2.30
diff -u -r1.1.2.30 ltcf-cxx.sh
--- ltcf-cxx.sh 2001/02/05 17:50:37 1.1.2.30
+++ ltcf-cxx.sh 2001/02/09 19:52:37
@@ -120,15 +120,87 @@
# FIXME: insert proper C++ library support
ld_shlibs=no
;;
- aix4*)
- # FIXME: insert proper C++ library support
- ld_shlibs=no
-
- # We don't want to build shared libraries on unknown CPU types.
- case $host_cpu in
- powerpc | rs6000) ;;
- *) ld_shlibs=no ;;
- esac
+ aix4* | aix5*)
+ archive_cmds=''
+ hardcode_libdir_separator=':'
+ link_all_deplibs=yes
+ # When large executables or shared objects are built, AIX ld can
+ # have problems creating the table of contents. If linking a library
+ # or program results in "error TOC overflow" add -mminimal-toc to
+ # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
+ # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+ if test "$with_gcc" = yes; then
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" && \
+ strings "$collect2name" | grep resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ hardcode_direct=yes
+ else
+ # We have old collect2
+ hardcode_direct=unsupported
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
+ hardcode_minus_L=yes
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_libdir_separator=
+ fi
+ shared_flag='-shared'
+ else
+ if test "$host_cpu" = ia64; then
+ shared_flag='${wl}-G'
+ else
+ shared_flag='${wl}-bM:SRE'
+ fi
+ hardcode_direct=yes
+ 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
+ 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"
+ else
+ if test "$host_cpu" = ia64; then
+ hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+ allow_undefined_flag="-z nodefs"
+ archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname
$libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag}
'"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
+ else
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
+ # Warning - without using the other run time loading flags, -berok will
+ # link without error, but may produce a broken library.
+ no_undefined_flag='${wl}-bnoerok'
+ allow_undefined_flag='${wl}-berok"
+ # -bexpall does not export symbols beginning with underscore (_)
+ always_export_symbols=yes
+ # Exported symbols can be pulled into shared objects from archives
+ 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'
+ fi
+ fi
;;
chorus*)
case "$cc_basename" in
@@ -570,13 +642,13 @@
# 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.
+ 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
;;
cygwin* | mingw* | os2*)
# This hack is so that the source file can tell whether it is being
@@ -600,8 +672,14 @@
esac
else
case "$host_os" in
- aix4*)
+ aix4* | aix5*)
# 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
;;
chorus*)
case "$cc_basename" in
Index: ltconfig.in
===================================================================
RCS file: /cvsroot/libtool/libtool/Attic/ltconfig.in,v
retrieving revision 1.246.2.42
diff -u -r1.246.2.42 ltconfig.in
--- ltconfig.in 2001/02/02 18:01:18 1.246.2.42
+++ ltconfig.in 2001/02/09 19:52:37
@@ -939,19 +939,35 @@
library_names_spec='${libname}${release}.so$versuffix $libname.a'
shlibpath_var=LIBPATH
- # AIX has no versioning support, so we append a major version to the name.
+ # AIX 3 has no versioning support, so we append a major version to the name.
soname_spec='${libname}${release}.so$major'
;;
-aix4*)
- version_type=linux
- # AIX has no versioning support, so currently we can not hardcode correct
- # soname into executable. Probably we can add versioning support to
- # collect2, so additional links can be useful in future.
- # We preserve .a as extension for shared libraries though AIX4.2
- # and later linker supports .so
- library_names_spec='${libname}${release}.so$versuffix
${libname}${release}.so$major $libname.a'
- shlibpath_var=LIBPATH
+aix4* | aix5*)
+ if test "$host_cpu" = ia64; then
+ # AIX 5 supports IA64
+ library_names_spec='${libname}${release}.so$versuffix
${libname}${release}.so$major $libname.so'
+ shlibpath_var=LD_LIBRARY_PATH
+ else
+ # AIX (on Power*) has no versioning support, so currently we can not
hardcode correct
+ # soname into executable. Probably we can add versioning support to
+ # collect2, so additional links can be useful in future.
+ # We preserve .a as extension for shared libraries though AIX4.2
+ # and later linker supports .so
+ if test "$aix_use_runtimelinking" = yes; then
+ # If using run time linking (on AIX 4.2 or later) use lib<name>.so
instead of
+ # lib<name>.a to let people know that these are not typical AIX shared
libraries.
+ library_names_spec='${libname}${release}.so$versuffix
${libname}${release}.so$major $libname.so'
+ else
+ # We preserve .a as extension for shared libraries though AIX4.2
+ # and later when we are not doing run time linking.
+ library_names_spec='${libname}${release}.a $libname.a'
+ soname_spec='${libname}${release}.so$major.o'
+ fi
+ export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2
== "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print
\$3 } }'\'' | sort -u > $export_symbols'
+ shlibpath_var=LIBPATH
+ deplibs_check_method=pass_all
+ fi
;;
amigaos*)
- [MLB] Revised patch for AIX,
Robert Boehne <=