From: Alexandre Janniaux Date: Tue, 28 Apr 2026 14:11:01 +0000 (+0200) Subject: tests: extend archive-in-archive with dependency forwarding check X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=ec577ffbb3b5fc6752da7e26a23d11056a9f2cea;p=thirdparty%2Flibtool.git 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 --- diff --git a/tests/archive-in-archive.at b/tests/archive-in-archive.at index b48579ae5..fd6672328 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