-DLOCALEDIR="\"$(datadir)/locale\"" \
@INCINTL@
+TESTS = object_unittest
+check_SCRIPTS =
+
if GCC
+
if NATIVE_LINKER
NATIVE_PROGS = \
exception_shared_2_test \
exception_same_shared_test \
exception_separate_shared_12_test \
- exception_separate_shared_21_test
+ exception_separate_shared_21_test \
+ weak_test
if FN_PTRS_IN_SO_WITHOUT_PIC
endif
endif
-TESTS = object_unittest $(NATIVE_TESTING)
+TESTS += $(NATIVE_TESTING)
check_LIBRARIES = libgoldtest.a
libgoldtest_a_SOURCES = test.cc testmain.cc testfile.cc
object_unittest_SOURCES = object_unittest.cc
if GCC
+
if NATIVE_LINKER
gcctestdir/ld: ../ld-new
exception_shared.so: exception_test_1_pic.o exception_test_2_pic.o
$(CXXLINK) -shared exception_test_1_pic.o exception_test_2_pic.o
+weak_test_SOURCES = weak_test.cc
+weak_test_LDFLAGS = -Bgcctestdir/
+
if TLS
tls_test_SOURCES = tls_test.cc tls_test_file2.cc tls_test_main.cc tls_test.h
@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_same_shared_test$(EXEEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_separate_shared_12_test$(EXEEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_separate_shared_21_test$(EXEEXT) \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ weak_test$(EXEEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(am__EXEEXT_1) $(am__EXEEXT_2) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(am__EXEEXT_3) $(am__EXEEXT_4)
am__constructor_static_test_SOURCES_DIST = constructor_test.cc
@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_test_main.$(OBJEXT)
two_file_test_OBJECTS = $(am_two_file_test_OBJECTS)
two_file_test_LDADD = $(LDADD)
+am__weak_test_SOURCES_DIST = weak_test.cc
+@GCC_TRUE@@NATIVE_LINKER_TRUE@am_weak_test_OBJECTS = \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ weak_test.$(OBJEXT)
+weak_test_OBJECTS = $(am_weak_test_OBJECTS)
+weak_test_LDADD = $(LDADD)
+weak_test_DEPENDENCIES = libgoldtest.a ../libgold.a \
+ ../../libiberty/libiberty.a $(am__DEPENDENCIES_1)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/../depcomp
am__depfiles_maybe = depfiles
$(two_file_shared_1_test_SOURCES) \
$(two_file_shared_2_nonpic_test_SOURCES) \
$(two_file_shared_2_test_SOURCES) \
- $(two_file_static_test_SOURCES) $(two_file_test_SOURCES)
+ $(two_file_static_test_SOURCES) $(two_file_test_SOURCES) \
+ $(weak_test_SOURCES)
DIST_SOURCES = $(libgoldtest_a_SOURCES) \
$(am__constructor_static_test_SOURCES_DIST) \
$(am__constructor_test_SOURCES_DIST) \
$(am__two_file_shared_2_nonpic_test_SOURCES_DIST) \
$(am__two_file_shared_2_test_SOURCES_DIST) \
$(am__two_file_static_test_SOURCES_DIST) \
- $(am__two_file_test_SOURCES_DIST)
+ $(am__two_file_test_SOURCES_DIST) \
+ $(am__weak_test_SOURCES_DIST)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-DLOCALEDIR="\"$(datadir)/locale\"" \
@INCINTL@
+TESTS = object_unittest $(NATIVE_TESTING)
+check_SCRIPTS =
@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@ $(am__append_1) $(am__append_2) \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(am__append_3) $(am__append_4)
+@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@NATIVE_TESTING = \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ basic_test \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ basic_pic_test \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ basic_static_pic_test \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(NATIVE_PROGS)
-TESTS = object_unittest $(NATIVE_TESTING)
check_LIBRARIES = libgoldtest.a
libgoldtest_a_SOURCES = test.cc testmain.cc testfile.cc
DEPENDENCIES = \
@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_separate_shared_21_test_LDADD = \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_shared_2.so exception_shared_1.so
+@GCC_TRUE@@NATIVE_LINKER_TRUE@weak_test_SOURCES = weak_test.cc
+@GCC_TRUE@@NATIVE_LINKER_TRUE@weak_test_LDFLAGS = -Bgcctestdir/
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@tls_test_SOURCES = tls_test.cc tls_test_file2.cc tls_test_main.cc tls_test.h
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@tls_test_DEPENDENCIES = gcctestdir/ld
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@tls_test_LDFLAGS = -Bgcctestdir/
two_file_test$(EXEEXT): $(two_file_test_OBJECTS) $(two_file_test_DEPENDENCIES)
@rm -f two_file_test$(EXEEXT)
$(CXXLINK) $(two_file_test_LDFLAGS) $(two_file_test_OBJECTS) $(two_file_test_LDADD) $(LIBS)
+weak_test$(EXEEXT): $(weak_test_OBJECTS) $(weak_test_DEPENDENCIES)
+ @rm -f weak_test$(EXEEXT)
+ $(CXXLINK) $(weak_test_LDFLAGS) $(weak_test_OBJECTS) $(weak_test_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/two_file_test_1.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/two_file_test_2.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/two_file_test_main.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/weak_test.Po@am__quote@
.cc.o:
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
fi; \
done
check-am: all-am
- $(MAKE) $(AM_MAKEFLAGS) $(check_LIBRARIES) $(check_PROGRAMS)
+ $(MAKE) $(AM_MAKEFLAGS) $(check_LIBRARIES) $(check_PROGRAMS) \
+ $(check_SCRIPTS)
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
check: check-am
all-am: Makefile
--- /dev/null
+// weak_test.cc -- test handling of weak symbols for gold
+
+// 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 provides a set of test functions for TLS variables. The
+// functions are called by a main function in tls_test_main.cc. This
+// lets us test TLS access from a shared library. We currently don't
+// bother to test TLS access between two different files, on the
+// theory that that is no more complicated than ordinary variable
+// access between files.
+
+// We test that we correctly deal with weak symbols defined in
+// other libraries (in this case, libc). We need to make sure we
+// copy the associated GLOBAL reloc when we copy a WEAK reloc.
+
+
+#include <cstdio>
+
+int
+main()
+{
+ extern char** environ; // defined in libc
+ if (environ == NULL)
+ {
+ fprintf(stderr, "FAILED the environ test: environ is NULL\n");
+ return 1;
+ }
+ return 0;
+}