Handle symbols defined/referenced only within IR
[deliverable/binutils-gdb.git] / ld / testsuite / ld-plugin / lto.exp
index fb951dfce34eeef3845be6188d8c2f4b77133346..6330a178abaa8e0ba4287fc8698d7acddc350393 100644 (file)
@@ -1,5 +1,5 @@
 # Expect script for ld-plugin LTO tests
-#   Copyright (C) 2011-2015 Free Software Foundation, Inc.
+#   Copyright (C) 2011-2016 Free Software Foundation, Inc.
 #
 # This file is part of the GNU Binutils.
 #
@@ -408,9 +408,20 @@ if { [at_least_gcc_version 4 7] } {
           || [istarget "x86_64-*-linux*"]
           || [istarget "amd64-*-linux*"]) } {
        set testname "PR ld/12365"
-       set exec_output [run_host_cmd "$CC" "-O2 -flto -flto-partition=none -fuse-linker-plugin tmpdir/pr12365a.o tmpdir/pr12365b.o tmpdir/pr12365c.o"]
+       set exec_output [run_host_cmd "$CC" "-O2 -flto -flto-partition=none -fuse-linker-plugin -o tmpdir/pr12365 tmpdir/pr12365a.o tmpdir/pr12365b.o tmpdir/pr12365c.o"]
        if { [ regexp "undefined reference to `my_bcopy'" $exec_output ] } {
+           # Linker should catch the reference to undefined `my_bcopy'
+           # error caused by a GCC bug.
            pass $testname
+       } elseif { [ string match "" $exec_output ] } {
+           global READELF
+           set exec_output [run_host_cmd "$READELF" "-s -W tmpdir/pr12365"]
+           if { [ regexp "my_bcopy" $exec_output ] } {
+               # Verify that there is no `my_bcopy' symbol in executable.
+               fail $testname
+           } {
+               pass $testname
+           }
        } {
            fail $testname
        }
This page took 0.024071 seconds and 4 git commands to generate.