THREADSLIB = -lpthread
endif
+check_SCRIPTS = debug_msg.sh
+check_DATA =
+
TESTS = object_unittest
-check_SCRIPTS =
if GCC
+TESTS += debug_msg.sh
+
+check_DATA += debug_msg.err
+
if NATIVE_LINKER
NATIVE_PROGS = \
if GCC
+debug_msg.o: debug_msg.cc
+ $(CXXCOMPILE) -O0 -c -w -o $@ $(srcdir)/debug_msg.cc
+debug_msg.err: debug_msg.o
+ if $(CXXLINK) -Bgcctestdir/ -o debug_msg debug_msg.o 2>debug_msg.err; \
+ then \
+ echo 2>&1 "Link of debug_msg.o should have failed"; \
+ exit 1; \
+ fi
+
if NATIVE_LINKER
gcctestdir/ld: ../ld-new
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
-@FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_1 = \
+@GCC_TRUE@am__append_1 = debug_msg.sh
+@GCC_TRUE@am__append_2 = debug_msg.err
+@FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_3 = \
@FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_shared_1_nonpic_test \
@FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_shared_2_nonpic_test \
@FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_same_shared_nonpic_test \
@FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_separate_shared_12_nonpic_test \
@FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_separate_shared_21_nonpic_test
-@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@am__append_2 = \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@am__append_4 = \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ tls_test \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ tls_pic_test \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ tls_shared_test
-@GCC_TRUE@@NATIVE_LINKER_TRUE@@STATIC_TLS_TRUE@@TLS_TRUE@am__append_3 = \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@STATIC_TLS_TRUE@@TLS_TRUE@am__append_5 = \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@STATIC_TLS_TRUE@@TLS_TRUE@ tls_static_test \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@STATIC_TLS_TRUE@@TLS_TRUE@ tls_static_pic_test
-@FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@am__append_4 = \
+@FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@am__append_6 = \
@FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ tls_shared_nonpic_test
check_PROGRAMS = object_unittest$(EXEEXT) $(am__EXEEXT_5)
@INCINTL@
@THREADS_TRUE@THREADSLIB = -lpthread
-TESTS = object_unittest $(NATIVE_TESTING)
-check_SCRIPTS =
+check_SCRIPTS = debug_msg.sh
+check_DATA = $(am__append_2)
+TESTS = object_unittest $(am__append_1) $(NATIVE_TESTING)
@GCC_TRUE@@NATIVE_LINKER_TRUE@NATIVE_PROGS = constructor_test \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ constructor_static_test \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_test \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_same_shared_test \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_separate_shared_12_test \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_separate_shared_21_test \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ weak_test $(am__append_1) \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(am__append_2) $(am__append_3) \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(am__append_4)
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ weak_test $(am__append_3) \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(am__append_4) $(am__append_5) \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(am__append_6)
@GCC_TRUE@@NATIVE_LINKER_TRUE@NATIVE_TESTING = \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ basic_test \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ basic_pic_test \
done
check-am: all-am
$(MAKE) $(AM_MAKEFLAGS) $(check_LIBRARIES) $(check_PROGRAMS) \
- $(check_SCRIPTS)
+ $(check_SCRIPTS) $(check_DATA)
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
check: check-am
all-am: Makefile
tags uninstall uninstall-am uninstall-info-am
+@GCC_TRUE@debug_msg.o: debug_msg.cc
+@GCC_TRUE@ $(CXXCOMPILE) -O0 -c -w -o $@ $(srcdir)/debug_msg.cc
+@GCC_TRUE@debug_msg.err: debug_msg.o
+@GCC_TRUE@ if $(CXXLINK) -Bgcctestdir/ -o debug_msg debug_msg.o 2>debug_msg.err; \
+@GCC_TRUE@ then \
+@GCC_TRUE@ echo 2>&1 "Link of debug_msg.o should have failed"; \
+@GCC_TRUE@ exit 1; \
+@GCC_TRUE@ fi
+
@GCC_TRUE@@NATIVE_LINKER_TRUE@gcctestdir/ld: ../ld-new
@GCC_TRUE@@NATIVE_LINKER_TRUE@ test -d gcctestdir || mkdir -p gcctestdir
@GCC_TRUE@@NATIVE_LINKER_TRUE@ rm -f gcctestdir/ld
--- /dev/null
+// debug_msg.cc -- a test case for printing debug info for missing symbols.
+
+// Copyright 2006, 2007 Free Software Foundation, Inc.
+// Written by Ian Lance Taylor <iant@google.com>.
+
+// This file is part of gold.
+
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+// MA 02110-1301, USA.
+
+// This file is constructed to have undefined references. In
+// debug_msg.sh, we will try to link this file, and analyze the
+// error messages that are produced.
+
+extern int undef_int;
+extern float undef_float;
+extern void undef_fn1();
+extern void undef_fn2();
+
+int* badref1 = &undef_int;
+static float* badref2 = &undef_float;
+void (*fn_array[])() =
+{
+ undef_fn1,
+ undef_fn2
+};
+
+template<class Foo>
+int testfn(Foo x)
+{
+ undef_fn1();
+ undef_fn2();
+ return undef_int;
+}
+
+class Base
+{
+ virtual void virtfn() { undef_fn1(); }
+};
+
+class Derived : public Base
+{
+ virtual void virtfn() { undef_fn2(); }
+};
+
+int main()
+{
+ testfn(5);
+ testfn(4.0);
+
+ Base b;
+ Derived d;
+
+ return 0;
+}
--- /dev/null
+#!/bin/sh
+
+# debug_msg.sh -- a test case for printing debug info for missing symbols.
+
+# Copyright 2006, 2007 Free Software Foundation, Inc.
+# Written by Ian Lance Taylor <iant@google.com>.
+
+# This file is part of gold.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+
+# This file goes with debug_msg.cc, a C++ source file constructed to
+# have undefined references. We compile that file with debug
+# information and then try to link it, and make sure the proper errors
+# are displayed. The errors will be found in debug_msg.err.
+
+check()
+{
+ if ! grep -q "$1" debug_msg.err
+ then
+ echo "Did not find expected error:"
+ echo " $1"
+ echo ""
+ echo "Actual error output below:"
+ cat debug_msg.err
+ exit 1
+ fi
+}
+
+# We don't know how the compiler might order these variables, so we
+# can't test for the actual offset from .data, hence the regexp.
+check "debug_msg.o: in function fn_array:debug_msg.cc(.data+0x[0-9a-fA-F]*): undefined reference to 'undef_fn1()'"
+check "debug_msg.o: in function fn_array:debug_msg.cc(.data+0x[0-9a-fA-F]*): undefined reference to 'undef_fn2()'"
+check "debug_msg.o: in function badref1:debug_msg.cc(.data+0x[0-9a-fA-F]*): undefined reference to 'undef_int'"
+
+check "debug_msg.o: in function Base::virtfn():${srcdir}/debug_msg.cc:50: undefined reference to 'undef_fn1()'"
+check "debug_msg.o: in function Derived::virtfn():${srcdir}/debug_msg.cc:55: undefined reference to 'undef_fn2()'"
+check "debug_msg.o: in function int testfn<int>(int):${srcdir}/debug_msg.cc:43: undefined reference to 'undef_fn1()'"
+check "debug_msg.o: in function int testfn<int>(int):${srcdir}/debug_msg.cc:44: undefined reference to 'undef_fn2()'"
+check "debug_msg.o: in function int testfn<int>(int):${srcdir}/debug_msg.cc:45: undefined reference to 'undef_int'"
+check "debug_msg.o: in function int testfn<double>(double):${srcdir}/debug_msg.cc:43: undefined reference to 'undef_fn1()'"
+check "debug_msg.o: in function int testfn<double>(double):${srcdir}/debug_msg.cc:44: undefined reference to 'undef_fn2()'"
+check "debug_msg.o: in function int testfn<double>(double):${srcdir}/debug_msg.cc:45: undefined reference to 'undef_int'"
+
+exit 0