From: Maciej W. Rozycki Date: Mon, 15 Dec 2025 19:04:30 +0000 (+0000) Subject: LD/testsuite: Expand archive verification to group feature X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ad15f9c23401cf06504b1765aeaf8db9dd404ad8;p=thirdparty%2Fbinutils-gdb.git LD/testsuite: Expand archive verification to group feature Expand archive verification to cover the group feature. Linker error messages for unsatisfied symbol references vary between targets a bit, in particular `arc-*-*' produce duplicate messages and `alpha*-*-osf*' and `alpha*-*-linux*ecoff*' add a "final link failed" message. Factor this in with the error pattern list to match. Usual XFAIL annotations apply. --- diff --git a/ld/testsuite/ld-archive/abcg.vd b/ld/testsuite/ld-archive/abcg.vd new file mode 100644 index 00000000000..40c7c88fd4c --- /dev/null +++ b/ld/testsuite/ld-archive/abcg.vd @@ -0,0 +1,28 @@ +#... +using ..ternal linker script:.* +================================================== +#... +================================================== +.*: mode .* +attempt to open tmpdir/ab\.a succeeded +tmpdir/ab\.a +attempt to open tmpdir/abc\.a succeeded +tmpdir/abc\.a +Archive member included to satisfy reference by file \(symbol\) + +tmpdir/abc\.a\(abc\.o(:?bj)?\) +\(ff\) +\(tmpdir/abc\.a\)abc\.o(:?bj)? +tmpdir/ab\.a +tmpdir/ab\.a\(a\.o(:?bj)?\) +tmpdir/abc\.a\(abc\.o(:?bj)?\) \(aa\) +\(tmpdir/ab\.a\)a\.o(:?bj)? +tmpdir/ab\.a\(b\.o(:?bj)?\) +tmpdir/abc\.a\(abc\.o(:?bj)?\) \(bb\) +\(tmpdir/ab\.a\)b\.o(:?bj)? +tmpdir/abc\.a +!(:?\()?tmpdir/.* +#... +START GROUP +LOAD tmpdir/ab\.a +LOAD tmpdir/abc\.a +END GROUP +!LOAD .* +#pass diff --git a/ld/testsuite/ld-archive/abcn.ed b/ld/testsuite/ld-archive/abcn.ed new file mode 100644 index 00000000000..2a5376a2384 --- /dev/null +++ b/ld/testsuite/ld-archive/abcn.ed @@ -0,0 +1,6 @@ +#?.*: in function `cc': +.*: undefined reference to `aa' +#?.*: undefined reference to `aa' +.*: undefined reference to `bb' +#?.*: undefined reference to `bb' +#?.*: final link failed diff --git a/ld/testsuite/ld-archive/abtctg.vd b/ld/testsuite/ld-archive/abtctg.vd new file mode 100644 index 00000000000..9ad6e7720ec --- /dev/null +++ b/ld/testsuite/ld-archive/abtctg.vd @@ -0,0 +1,28 @@ +#... +using ..ternal linker script:.* +================================================== +#... +================================================== +.*: mode .* +attempt to open tmpdir/abt\.a succeeded +tmpdir/abt\.a +attempt to open tmpdir/abct\.a succeeded +tmpdir/abct\.a +Archive member included to satisfy reference by file \(symbol\) + +tmpdir/abc\.o +\(ff\) +tmpdir/abc\.o +tmpdir/abt\.a +tmpdir/a\.o +tmpdir/abc\.o \(aa\) +tmpdir/a\.o +tmpdir/b\.o +tmpdir/abc\.o \(bb\) +tmpdir/b\.o +tmpdir/abct\.a +!(:?\()?tmpdir/.* +#... +START GROUP +LOAD tmpdir/abt\.a +LOAD tmpdir/abct\.a +END GROUP +!LOAD .* +#pass diff --git a/ld/testsuite/ld-archive/archive.exp b/ld/testsuite/ld-archive/archive.exp index 490db9e7b34..861405b2ae8 100644 --- a/ld/testsuite/ld-archive/archive.exp +++ b/ld/testsuite/ld-archive/archive.exp @@ -20,7 +20,8 @@ remote_file host delete \ "tmpdir/ab.a" "tmpdir/cd.a" "tmpdir/abt.a" "tmpdir/cdt.a" \ - "tmpdir/abn.a" "tmpdir/abnt.a" + "tmpdir/abn.a" "tmpdir/abnt.a" "tmpdir/abc.a" "tmpdir/abct.a" \ + "tmpdir/abcn.a" "tmpdir/abcnt.a" run_ld_link_tests { {"First regular archive create" "" "" "" {a.s b.s x.s} {} "ab.a" } @@ -29,6 +30,10 @@ run_ld_link_tests { {"Second thin archive create" "T" "" "" {c.s d.s y.s} {} "cdt.a" } {"Regular archive w/o index create" "S" "" "" {a.s b.s x.s} {} "abn.a" } {"Thin archive w/o index create" "ST" "" "" {a.s b.s x.s} {} "abnt.a" } + {"Other regular archive create" "" "" "" {abc.s} {} "abc.a" } + {"Other thin archive create" "T" "" "" {abc.s} {} "abct.a" } + {"Other regular archive w/o index create" "S" "" "" {abc.s} {} "abcn.a" } + {"Other thin archive w/o index create" "ST" "" "" {abc.s} {} "abcnt.a"} } set old_ldflags $LDFLAGS @@ -110,6 +115,47 @@ run_ld_link_tests [list \ ] \ ] +# Group archive tests. +run_ld_link_tests [list \ + [list "Regular non-group archive link reject" \ + "-e ff tmpdir/ab.a" "tmpdir/abc.a" \ + "" {} \ + {{ld abcn.ed}} \ + "abcn" \ + ] \ + [list "Thin non-group archive link reject" \ + "-e ff tmpdir/abt.a" "tmpdir/abct.a" \ + "" {} \ + {{ld abcn.ed}} \ + "abtctn" \ + ] \ + [list "Regular group archive link accept" \ + "-e ff -\\( tmpdir/ab.a" "tmpdir/abc.a -\\) --verbose --print-map" \ + "" {} \ + [ld_archive_filter_tests {{ld abcg.vd} \ + {nm "" abc.nd} \ + {nm "" nx.nd}}] \ + "abcg" \ + ] \ +] +setup_xfail "binutils/33484" "alpha*-*-linux*ecoff*" "alpha*-*-osf*" +setup_xfail "binutils/33485" "cris-*-*aout*" "i\[3-7\]86-*-bsd*" \ + "i\[3-7\]86-*-msdos*" "ns32k-*-*" "pdp11-*-*" +setup_xfail "binutils/33600" "alpha*-*-*vms*" +if { [is_xcoff_format] } { + setup_xfail "binutils/33600" "*-*-*" +} +run_ld_link_tests [list \ + [list "Thin group archive link accept" \ + "-e ff -\\( tmpdir/abt.a" "tmpdir/abct.a -\\) --verbose --print-map" \ + "" {} \ + [ld_archive_filter_tests {{ld abtctg.vd} \ + {nm "" abc.nd} \ + {nm "" nx.nd}}] \ + "abtctg" \ + ] \ +] + # Dual archive tests. run_ld_link_tests [list \ [list "Regular archive plus regular link" \