Re: versioning test on AIX

2010-08-21 Thread Ralf Wildenhues
* Ralf Wildenhues wrote on Sat, Aug 07, 2010 at 12:30:01AM CEST:
 The test tries to ensure that with an incompatible library upgrade,
 programs previously linked against the old library still work.  This
 usually works on systems where different major versions of a library
 have different file names.  Which isn't the case for AIX without
 runtimelinking (liba.a is the same name whether it contains liba.so.2
 or liba.so.0):
[...]

 Now, the part that really surprised me was that this doesn't even work
 with runtimelinking (configure LDFLAGS=-Wl,-brtl), even though the file
 names aren't the issue here:
[...]

 So, while I'm not completely sure yet that there isn't another bug
 lurking in libtool here, it seems that this is another AIX limitation.
 
 One way out may be to use loader domains; see here for a description:
 http://stromberg.dnsalias.org/~strombrg/AIX-shared-libs.html
 
 I don't really see how to apply this concept in general, i.e., without
 user intervention.  So, for now I propose the patch below to skip this
 part of the part; I will leave time for comments before pushing it.

No comments, so I'm pushing this patch.

Also pushing the trivial cleanup patch below.

Cheers,
Ralf

 Skip part of versioning test on AIX.
 
 * tests/versioning.at (versioning): The AIX linker always
 records the unversioned library name, even with runtimelinking,
 so skip the execution test for the incompatibly upgraded
 library.
 Report by Rainer Tammer.
 
 diff --git a/tests/versioning.at b/tests/versioning.at
 index eef7c4a..1d75f62 100644
 --- a/tests/versioning.at
 +++ b/tests/versioning.at

 @@ -227,6 +227,11 @@ AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o 
 liba.la liba4.lo ]dnl
  # available, so test_uninstalled will not necessarily work here any more.
  AT_CHECK([$LIBTOOL --mode=install cp liba.la $libdir], [], [ignore], 
 [ignore])
  AT_CHECK([$LIBTOOL --mode=clean rm -f liba.la], [], [ignore], [ignore])
 +
 +# This test does not work on AIX, not even with runtimelinking, because
 +# the linker always records the unversioned name as dependency.
 +AT_CHECK([:; case $host_os in aix*) exit 77;; esac])
 +
  test_installed


Remove dead code from versioning test.

* tests/versioning.at (versioning): No need to build unused
prog3.

diff --git a/tests/versioning.at b/tests/versioning.at
index 69bf731..eef7c4a 100644
--- a/tests/versioning.at
+++ b/tests/versioning.at
@@ -91,14 +91,6 @@ int main (void)
 }
 ]])
 
-AT_DATA([prog3.c], [[
-extern int a (void), internal_detail;
-int main (void)
-{
-  return a () + internal_detail - 42;
-}
-]])
-
 
 inst=`pwd`/inst
 libdir=$inst/lib
@@ -109,7 +101,7 @@ mkdir $inst $libdir $bindir
 for file in liba1.c liba2.c liba3.c liba4.c libb.c; do
   $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c $file
 done
-for file in prog1.c prog2.c prog3.c; do
+for file in prog1.c prog2.c; do
   $CC $CPPFLAGS $CFLAGS -c $file
 done
 



versioning test on AIX (was: libtool-2.2.8 on AIX 6.1)

2010-08-06 Thread Ralf Wildenhues
* Rainer Tammer wrote on Tue, Aug 03, 2010 at 09:40:23AM CEST:
 On 02.08.2010 20:40, Ralf Wildenhues wrote:
  * Rainer Tammer wrote on Mon, Aug 02, 2010 at 05:40:13PM CEST:
  56: versioning  FAILED
  (versioning.at:169)
  This testsuite bug should (hopefully) be fixed in 2.2.10.  Testsuite
  bugs are no need to worry.
 
 Unfortunately no.

 ## -- ##
 ## libtool 2.2.10 test suite. ##
 ## -- ##

  56: versioning  FAILED
 (versioning.at:172)

This particular test failure is a real failure but not a regression;
it is new because the tests is new.  Quoting the relevant bits from the
testsuite.log:

| ./versioning.at:237: $LIBTOOL --mode=clean rm -f liba.la
| stderr:
| stdout:
| libtool: clean: rm -f liba.la .libs/liba.a .libs/liba.a .libs/liba.so.2 
.libs/liba.la .libs/liba.lai
| libtool: clean: rmdir .libs /dev/null 21
| ./versioning.at:172: if $lt_exe ; then :; else lt_status=$?; 
test X$host != X$build  test -x $lt_exe  exit 77; exit 
$lt_status; 
| --- /dev/null   2010-08-03 08:56:09.0 +0200
| +++ /daten/source/libtool-2.2.10/tests/testsuite.dir/at-groups/56/stderr  
  2010-08-03 08:56:09.0 +0200
| @@ -0,0 +1,3 @@
| +Could not load program 
/daten/source/libtool-2.2.10/tests/testsuite.dir/056/inst/bin/prog1:
| +   Dependent module 
/daten/source/libtool-2.2.10/tests/testsuite.dir/056/inst/lib/liba.a(liba.so.0) 
could not be loaded.
| +   Member liba.so.0 is not found in archive 
| ./versioning.at:172: exit code was 255, expected 0
| 56. versioning.at:24: 56. versioning (versioning.at:24): FAILED 
(versioning.at:172)

Oh well, hacking libtool wouldn't be half the fun without AIX. :-/

The test tries to ensure that with an incompatible library upgrade,
programs previously linked against the old library still work.  This
usually works on systems where different major versions of a library
have different file names.  Which isn't the case for AIX without
runtimelinking (liba.a is the same name whether it contains liba.so.2
or liba.so.0):

$ ls inst/lib
liba.a   liba.la  libb.a   libb.la

$ ar t inst/lib/liba.a
liba.so.2

Now, the part that really surprised me was that this doesn't even work
with runtimelinking (configure LDFLAGS=-Wl,-brtl), even though the file
names aren't the issue here:

$ ls -l inst/lib | sed 's/.*[0-9] \(lib.*\)/\1/'
total 45
liba.a
liba.la
liba.so - liba.so.2.0.0
liba.so.0 - liba.so.0.1.0
liba.so.0.0.1
liba.so.0.1.0
liba.so.2 - liba.so.2.0.0
liba.so.2.0.0
libb.a
libb.la
libb.so - libb.so.0.0.0
libb.so.0 - libb.so.0.0.0
libb.so.0.0.0

The failure looks like this:
$ ./prog1
exec(): 0509-036 Cannot load program ./prog1 because of the following errors:
rtld: 0712-001 Symbol a was referenced
  from module prog1(), but a runtime definition
  of the symbol was not found.

The apparent reason for the failure is that it's not the versioned name
that is encoded:

$ dump -H inst/bin/prog1
[...]
***Import File Strings***
INDEX  PATH  BASEMEMBER  
0  /tmp/build/tests/testsuite.dir/064/inst/lib:/usr/vac/lib:/usr/lib:/lib   
  
1liba.so 
2libc.a  shr.o   
3librtl.ashr.o   


(For reference here's also the respective output for non-rtl:

$ dump -H inst/bin/prog1
[...]
***Import File Strings***
INDEX  PATH  BASEMEMBER  
0  /tmp/build/tests/testsuite.dir/064/inst/lib:/usr/vac/lib:/usr/lib:/lib   
  
1libc.a  shr.o   
2liba.a  liba.so.0   

)


So, while I'm not completely sure yet that there isn't another bug
lurking in libtool here, it seems that this is another AIX limitation.

One way out may be to use loader domains; see here for a description:
http://stromberg.dnsalias.org/~strombrg/AIX-shared-libs.html

I don't really see how to apply this concept in general, i.e., without
user intervention.  So, for now I propose the patch below to skip this
part of the part; I will leave time for comments before pushing it.

Cheers,
Ralf

Skip part of versioning test on AIX.

* tests/versioning.at (versioning): The AIX linker always
records the unversioned library name, even with runtimelinking,
so skip the execution test for the incompatibly upgraded
library.
Report by Rainer Tammer.

diff --git a/tests/versioning.at b/tests/versioning.at
index eef7c4a..1d75f62 100644
--- a/tests/versioning.at
+++ b/tests/versioning.at
@@ -24,7 +24,7 @@
 AT_SETUP([versioning])
 AT_KEYWORDS([libtool])
 
-eval