]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - ld/testsuite/ld-plugin/lto.exp
Skip an archive element if not added by linker
[thirdparty/binutils-gdb.git] / ld / testsuite / ld-plugin / lto.exp
index 6330a178abaa8e0ba4287fc8698d7acddc350393..7a13abbfdb60404d4bef4a8e7fea64c9207bc84c 100644 (file)
@@ -460,4 +460,89 @@ if { [is_elf_format] } {
     run_ld_link_exec_tests [] $lto_run_elf_tests
 }
 
+proc pr20103 {cflags libs} {
+    global CC
+
+    set testname "PR ld/20103 ($cflags $libs)"
+    set exec_output [run_host_cmd "$CC" "$cflags $libs"]
+    if { [ regexp "undefined reference to `dead'" $exec_output ] } {
+        pass "$testname (1)"
+    } {
+        fail "$testname (1)"
+    }
+    if { [ regexp "plugin needed to handle lto object" $exec_output ] } {
+        fail "$testname (2)"
+    } {
+        pass "$testname (2)"
+    }
+}
+
+if { [check_lto_fat_available] } {
+    run_cc_link_tests [list \
+       [list \
+           "Build fatpr20103a.a" \
+           "$plug_opt" "-flto -ffat-lto-objects" \
+           {pr20103a.c} {} "fatpr20103a.a"
+       ] \
+       [list \
+           "Build fatpr20103b.a" \
+           "$plug_opt" "-flto -ffat-lto-objects" \
+           {pr20103b.c} {} "fatpr20103b.a"
+       ] \
+       [list \
+           "Build fatpr20103c.a" \
+           "$plug_opt" "-flto -ffat-lto-objects" \
+           {pr20103c.c} {} "fatpr20103c.a" \
+       ] \
+       [list \
+           "Build thinpr20103a.a" \
+           "$plug_opt" "-flto -fno-fat-lto-objects" \
+           {pr20103a.c} {} "thinpr20103a.a"
+       ] \
+       [list \
+           "Build thinpr20103b.a" \
+           "$plug_opt" "-flto -fno-fat-lto-objects" \
+           {pr20103b.c} {} "thinpr20103b.a"
+       ] \
+       [list \
+           "Build thinpr20103c.a" \
+           "$plug_opt" "-flto -fno-fat-lto-objects" \
+           {pr20103c.c} {} "thinpr20103c.a" \
+       ] \
+       [list \
+           "Build pr20103a" \
+           "-O2 -flto -Wl,--start-group tmpdir/thinpr20103a.a tmpdir/thinpr20103b.a tmpdir/thinpr20103c.a -Wl,--end-group" \
+           "-O2 -flto" \
+           {dummy.c} {} "pr20103a" \
+       ] \
+       [list \
+           "Build pr20103b" \
+           "-O2 -flto -Wl,--start-group tmpdir/fatpr20103a.a tmpdir/fatpr20103b.a tmpdir/fatpr20103c.a -Wl,--end-group" \
+           "-O2 -flto" \
+           {dummy.c} {} "pr20103b" \
+       ] \
+       [list \
+           "Build pr20103c" \
+           "-O2 -Wl,--start-group tmpdir/fatpr20103a.a tmpdir/fatpr20103b.a tmpdir/fatpr20103c.a -Wl,--end-group" \
+           "-O2" \
+           {dummy.c} {} "pr20103c" \
+       ] \
+    ]
+    pr20103 "-O2 -flto" "tmpdir/thinpr20103a.a tmpdir/thinpr20103b.a tmpdir/thinpr20103c.a"
+    pr20103 "-O2 -flto" "tmpdir/fatpr20103a.a tmpdir/fatpr20103b.a tmpdir/fatpr20103c.a"
+    pr20103 "-O2" "tmpdir/fatpr20103a.a tmpdir/fatpr20103b.a tmpdir/fatpr20103c.a"
+
+    if { [at_least_gcc_version 4 9] } {
+       run_cc_link_tests [list \
+           [list \
+               "Build pr20103d" \
+               "-O2 -Wl,--start-group tmpdir/thinpr20103a.a tmpdir/thinpr20103b.a tmpdir/thinpr20103c.a -Wl,--end-group" \
+               "-O2" \
+               {dummy.c} {} "pr20103d" \
+           ] \
+       ]
+       pr20103 "-O2" "tmpdir/thinpr20103a.a tmpdir/thinpr20103b.a tmpdir/thinpr20103c.a"
+    }
+}
+
 restore_notify