]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
tests: extend archive-in-archive with dependency forwarding check
authorAlexandre Janniaux <ajanni@videolabs.io>
Tue, 28 Apr 2026 14:11:01 +0000 (16:11 +0200)
committerIleana Dumitrescu <ileanadumitrescu95@gmail.com>
Wed, 3 Jun 2026 17:41:54 +0000 (20:41 +0300)
Verify that the old library dependency is recorded in
dependency_libs of the target .la file, and that an executable
linked against the target can resolve symbols from the forwarded
dependency.

Reported: https://savannah.gnu.org/patch/?10569

tests/archive-in-archive.at

index b48579ae5b7463cf27b4c855b5aea0b8727236d1..fd6672328229ae06377e54cc00a4956a239b271d 100644 (file)
@@ -31,7 +31,14 @@ int foo() { return 1;}
 
 AT_DATA([bar.c],
 [
-int bar() { return 1;}
+extern int foo();
+int bar() { return foo();}
+])
+
+AT_DATA([main.c],
+[
+extern int bar();
+int main() { return !bar();}
 ])
 
 thisdir=`cd . && pwd`
@@ -54,4 +61,13 @@ AT_CHECK([$AR -t $libbar | $GREP $libfoo],[1],[ignore],[ignore])
 AT_CHECK([$AR -t $libbar | $GREP foo.$OBJEXT],[1],[ignore],[ignore])
 # bar's own object must still be present.
 AT_CHECK([$AR -t $libbar | $GREP bar.$OBJEXT],[],[ignore],[ignore])
+# libfoo must be forwarded in dependency_libs of libbar.la.
+AT_CHECK([$GREP 'dependency_libs=.*foo' libbar.la],[],[ignore],[ignore])
+# Link an executable against libbar.la; the forwarded dependency must
+# allow the linker to resolve foo().
+$CC $CPPFLAGS $CFLAGS -c -o main.$OBJEXT main.c
+AT_CHECK([$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS \
+        -o main$EXEEXT main.$OBJEXT libbar.la],
+        [], [ignore], [ignore])
+LT_AT_EXEC_CHECK([./main])
 AT_CLEANUP