branch: development
commit ec577ffbb3b5fc6752da7e26a23d11056a9f2cea
Author: Alexandre Janniaux <[email protected]>
AuthorDate: Tue Apr 28 16:11:01 2026 +0200
tests: extend archive-in-archive with dependency forwarding check
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 | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/tests/archive-in-archive.at b/tests/archive-in-archive.at
index b48579ae..fd667232 100644
--- a/tests/archive-in-archive.at
+++ b/tests/archive-in-archive.at
@@ -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