From 3bd52c2885dc3ed71bce8b94989e6b53914f9337 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Sun, 23 Sep 2007 05:35:51 +0000 Subject: [PATCH] Add two file test. --- gold/testsuite/Makefile.am | 115 +++++++++++- gold/testsuite/Makefile.in | 268 ++++++++++++++++++++++++++- gold/testsuite/two_file_test.h | 61 ++++++ gold/testsuite/two_file_test_1.cc | 168 +++++++++++++++++ gold/testsuite/two_file_test_2.cc | 94 ++++++++++ gold/testsuite/two_file_test_main.cc | 52 ++++++ 6 files changed, 743 insertions(+), 15 deletions(-) create mode 100644 gold/testsuite/two_file_test.h create mode 100644 gold/testsuite/two_file_test_1.cc create mode 100644 gold/testsuite/two_file_test_2.cc create mode 100644 gold/testsuite/two_file_test_main.cc diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am index ce2000e659c..1ee388fa8dc 100644 --- a/gold/testsuite/Makefile.am +++ b/gold/testsuite/Makefile.am @@ -17,17 +17,27 @@ INCLUDES = -D_GNU_SOURCE \ if GCC if NATIVE_LINKER +NATIVE_PROGS = \ + constructor_test \ + constructor_static_test \ + two_file_test \ + two_file_shared_1_test \ + two_file_shared_2_test \ + two_file_same_shared_test \ + two_file_separate_shared_12_test \ + two_file_separate_shared_21_test \ + two_file_shared_1_nonpic_test \ + two_file_shared_2_nonpic_test \ + two_file_same_shared_nonpic_test \ + two_file_separate_shared_12_nonpic_test \ + two_file_separate_shared_21_nonpic_test + NATIVE_TESTING = \ basic_test \ basic_pic_test \ basic_static_test \ basic_static_pic_test \ - constructor_test \ - constructor_static_test - -NATIVE_PROGS = \ - constructor_test \ - constructor_static_test + $(NATIVE_PROGS) endif endif @@ -74,5 +84,98 @@ constructor_static_test_SOURCES = constructor_test.cc constructor_static_test_DEPENDENCIES = gcctestdir/ld constructor_static_test_LDFLAGS = -Bgcctestdir/ -static +two_file_test_SOURCES = \ + two_file_test_1.cc \ + two_file_test_2.cc \ + two_file_test_main.cc \ + two_file_test.h +two_file_test_DEPENDENCIES = gcctestdir/ld +two_file_test_LDFLAGS = -Bgcctestdir/ + +two_file_shared_1_test_SOURCES = two_file_test_2.cc two_file_test_main.cc +two_file_shared_1_test_DEPENDENCIES = gcctestdir/ld two_file_shared_1.so +two_file_shared_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. +two_file_shared_1_test_LDADD = two_file_shared_1.so + +two_file_shared_2_test_SOURCES = two_file_test_1.cc two_file_test_main.cc +two_file_shared_2_test_DEPENDENCIES = gcctestdir/ld two_file_shared_2.so +two_file_shared_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. +two_file_shared_2_test_LDADD = two_file_shared_2.so + +two_file_same_shared_test_SOURCES = two_file_test_main.cc +two_file_same_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared.so +two_file_same_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. +two_file_same_shared_test_LDADD = two_file_shared.so + +two_file_separate_shared_12_test_SOURCES = two_file_test_main.cc +two_file_separate_shared_12_test_DEPENDENCIES = \ + gcctestdir/ld two_file_shared_1.so two_file_shared_2.so +two_file_separate_shared_12_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. +two_file_separate_shared_12_test_LDADD = \ + two_file_shared_1.so two_file_shared_2.so + +two_file_separate_shared_21_test_SOURCES = two_file_test_main.cc +two_file_separate_shared_21_test_DEPENDENCIES = \ + gcctestdir/ld two_file_shared_1.so two_file_shared_2.so +two_file_separate_shared_21_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. +two_file_separate_shared_21_test_LDADD = \ + two_file_shared_2.so two_file_shared_1.so + +# FIXME: The nonpic tests will fail on platforms which can not put +# non-PIC code into shared libraries; how should we handle this? + +two_file_shared_1_nonpic_test_SOURCES = \ + two_file_test_2.cc two_file_test_main.cc +two_file_shared_1_nonpic_test_DEPENDENCIES = \ + gcctestdir/ld two_file_shared_1_nonpic.so +two_file_shared_1_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. +two_file_shared_1_nonpic_test_LDADD = two_file_shared_1_nonpic.so + +two_file_shared_2_nonpic_test_SOURCES = \ + two_file_test_1.cc two_file_test_main.cc +two_file_shared_2_nonpic_test_DEPENDENCIES = \ + gcctestdir/ld two_file_shared_2_nonpic.so +two_file_shared_2_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. +two_file_shared_2_nonpic_test_LDADD = two_file_shared_2_nonpic.so + +two_file_same_shared_nonpic_test_SOURCES = two_file_test_main.cc +two_file_same_shared_nonpic_test_DEPENDENCIES = \ + gcctestdir/ld two_file_shared_nonpic.so +two_file_same_shared_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. +two_file_same_shared_nonpic_test_LDADD = two_file_shared_nonpic.so + +two_file_separate_shared_12_nonpic_test_SOURCES = two_file_test_main.cc +two_file_separate_shared_12_nonpic_test_DEPENDENCIES = \ + gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so +two_file_separate_shared_12_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. +two_file_separate_shared_12_nonpic_test_LDADD = \ + two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so + +two_file_separate_shared_21_nonpic_test_SOURCES = two_file_test_main.cc +two_file_separate_shared_21_nonpic_test_DEPENDENCIES = \ + gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so +two_file_separate_shared_21_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. +two_file_separate_shared_21_nonpic_test_LDADD = \ + two_file_shared_2_nonpic.so two_file_shared_1_nonpic.so + +two_file_test_1_pic.o: two_file_test_1.cc + $(CXXCOMPILE) -c -fpic -o $@ $< +two_file_test_2_pic.o: two_file_test_2.cc + $(CXXCOMPILE) -c -fpic -o $@ $< + +two_file_shared_1.so: two_file_test_1_pic.o + $(CXXLINK) -shared two_file_test_1_pic.o +two_file_shared_2.so: two_file_test_2_pic.o + $(CXXLINK) -shared two_file_test_2_pic.o +two_file_shared.so: two_file_test_1_pic.o two_file_test_2_pic.o + $(CXXLINK) -shared two_file_test_1_pic.o two_file_test_2_pic.o + +two_file_shared_1_nonpic.so: two_file_test_1.o + $(CXXLINK) -shared two_file_test_1.o +two_file_shared_2_nonpic.so: two_file_test_2.o + $(CXXLINK) -shared two_file_test_2.o +two_file_shared_nonpic.so: two_file_test_1.o two_file_test_2.o + $(CXXLINK) -shared two_file_test_1.o two_file_test_2.o + endif endif diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in index 887681e11c8..24eda432fa2 100644 --- a/gold/testsuite/Makefile.in +++ b/gold/testsuite/Makefile.in @@ -50,6 +50,9 @@ check_PROGRAMS = object_unittest$(EXEEXT) $(am__EXEEXT_1) @GCC_FALSE@ ../libgold.a @NATIVE_LINKER_FALSE@constructor_static_test_DEPENDENCIES = \ @NATIVE_LINKER_FALSE@ libgoldtest.a ../libgold.a +@GCC_FALSE@two_file_test_DEPENDENCIES = libgoldtest.a ../libgold.a +@NATIVE_LINKER_FALSE@two_file_test_DEPENDENCIES = libgoldtest.a \ +@NATIVE_LINKER_FALSE@ ../libgold.a subdir = testsuite DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -73,7 +76,18 @@ am_libgoldtest_a_OBJECTS = test.$(OBJEXT) testmain.$(OBJEXT) \ libgoldtest_a_OBJECTS = $(am_libgoldtest_a_OBJECTS) @GCC_TRUE@@NATIVE_LINKER_TRUE@am__EXEEXT_1 = \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ constructor_test$(EXEEXT) \ -@GCC_TRUE@@NATIVE_LINKER_TRUE@ constructor_static_test$(EXEEXT) +@GCC_TRUE@@NATIVE_LINKER_TRUE@ constructor_static_test$(EXEEXT) \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_test$(EXEEXT) \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_shared_1_test$(EXEEXT) \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_shared_2_test$(EXEEXT) \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_same_shared_test$(EXEEXT) \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_separate_shared_12_test$(EXEEXT) \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_separate_shared_21_test$(EXEEXT) \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_shared_1_nonpic_test$(EXEEXT) \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_shared_2_nonpic_test$(EXEEXT) \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_same_shared_nonpic_test$(EXEEXT) \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_separate_shared_12_nonpic_test$(EXEEXT) \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_separate_shared_21_nonpic_test$(EXEEXT) am__constructor_static_test_SOURCES_DIST = constructor_test.cc @GCC_TRUE@@NATIVE_LINKER_TRUE@am_constructor_static_test_OBJECTS = \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ constructor_test.$(OBJEXT) @@ -89,6 +103,75 @@ am_object_unittest_OBJECTS = object_unittest.$(OBJEXT) object_unittest_OBJECTS = $(am_object_unittest_OBJECTS) object_unittest_LDADD = $(LDADD) object_unittest_DEPENDENCIES = libgoldtest.a ../libgold.a +am__two_file_same_shared_nonpic_test_SOURCES_DIST = \ + two_file_test_main.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@am_two_file_same_shared_nonpic_test_OBJECTS = \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_test_main.$(OBJEXT) +two_file_same_shared_nonpic_test_OBJECTS = \ + $(am_two_file_same_shared_nonpic_test_OBJECTS) +am__two_file_same_shared_test_SOURCES_DIST = two_file_test_main.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@am_two_file_same_shared_test_OBJECTS = \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_test_main.$(OBJEXT) +two_file_same_shared_test_OBJECTS = \ + $(am_two_file_same_shared_test_OBJECTS) +am__two_file_separate_shared_12_nonpic_test_SOURCES_DIST = \ + two_file_test_main.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@am_two_file_separate_shared_12_nonpic_test_OBJECTS = \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_test_main.$(OBJEXT) +two_file_separate_shared_12_nonpic_test_OBJECTS = \ + $(am_two_file_separate_shared_12_nonpic_test_OBJECTS) +am__two_file_separate_shared_12_test_SOURCES_DIST = \ + two_file_test_main.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@am_two_file_separate_shared_12_test_OBJECTS = \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_test_main.$(OBJEXT) +two_file_separate_shared_12_test_OBJECTS = \ + $(am_two_file_separate_shared_12_test_OBJECTS) +am__two_file_separate_shared_21_nonpic_test_SOURCES_DIST = \ + two_file_test_main.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@am_two_file_separate_shared_21_nonpic_test_OBJECTS = \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_test_main.$(OBJEXT) +two_file_separate_shared_21_nonpic_test_OBJECTS = \ + $(am_two_file_separate_shared_21_nonpic_test_OBJECTS) +am__two_file_separate_shared_21_test_SOURCES_DIST = \ + two_file_test_main.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@am_two_file_separate_shared_21_test_OBJECTS = \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_test_main.$(OBJEXT) +two_file_separate_shared_21_test_OBJECTS = \ + $(am_two_file_separate_shared_21_test_OBJECTS) +am__two_file_shared_1_nonpic_test_SOURCES_DIST = two_file_test_2.cc \ + two_file_test_main.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@am_two_file_shared_1_nonpic_test_OBJECTS = \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_test_2.$(OBJEXT) \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_test_main.$(OBJEXT) +two_file_shared_1_nonpic_test_OBJECTS = \ + $(am_two_file_shared_1_nonpic_test_OBJECTS) +am__two_file_shared_1_test_SOURCES_DIST = two_file_test_2.cc \ + two_file_test_main.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@am_two_file_shared_1_test_OBJECTS = \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_test_2.$(OBJEXT) \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_test_main.$(OBJEXT) +two_file_shared_1_test_OBJECTS = $(am_two_file_shared_1_test_OBJECTS) +am__two_file_shared_2_nonpic_test_SOURCES_DIST = two_file_test_1.cc \ + two_file_test_main.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@am_two_file_shared_2_nonpic_test_OBJECTS = \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_test_1.$(OBJEXT) \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_test_main.$(OBJEXT) +two_file_shared_2_nonpic_test_OBJECTS = \ + $(am_two_file_shared_2_nonpic_test_OBJECTS) +am__two_file_shared_2_test_SOURCES_DIST = two_file_test_1.cc \ + two_file_test_main.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@am_two_file_shared_2_test_OBJECTS = \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_test_1.$(OBJEXT) \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_test_main.$(OBJEXT) +two_file_shared_2_test_OBJECTS = $(am_two_file_shared_2_test_OBJECTS) +am__two_file_test_SOURCES_DIST = two_file_test_1.cc two_file_test_2.cc \ + two_file_test_main.cc two_file_test.h +@GCC_TRUE@@NATIVE_LINKER_TRUE@am_two_file_test_OBJECTS = \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_test_1.$(OBJEXT) \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_test_2.$(OBJEXT) \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_test_main.$(OBJEXT) +two_file_test_OBJECTS = $(am_two_file_test_OBJECTS) +two_file_test_LDADD = $(LDADD) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/../depcomp am__depfiles_maybe = depfiles @@ -97,12 +180,37 @@ CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libgoldtest_a_SOURCES) $(constructor_static_test_SOURCES) \ - $(constructor_test_SOURCES) $(object_unittest_SOURCES) + $(constructor_test_SOURCES) $(object_unittest_SOURCES) \ + $(two_file_same_shared_nonpic_test_SOURCES) \ + $(two_file_same_shared_test_SOURCES) \ + $(two_file_separate_shared_12_nonpic_test_SOURCES) \ + $(two_file_separate_shared_12_test_SOURCES) \ + $(two_file_separate_shared_21_nonpic_test_SOURCES) \ + $(two_file_separate_shared_21_test_SOURCES) \ + $(two_file_shared_1_nonpic_test_SOURCES) \ + $(two_file_shared_1_test_SOURCES) \ + $(two_file_shared_2_nonpic_test_SOURCES) \ + $(two_file_shared_2_test_SOURCES) $(two_file_test_SOURCES) DIST_SOURCES = $(libgoldtest_a_SOURCES) \ $(am__constructor_static_test_SOURCES_DIST) \ $(am__constructor_test_SOURCES_DIST) \ - $(object_unittest_SOURCES) + $(object_unittest_SOURCES) \ + $(am__two_file_same_shared_nonpic_test_SOURCES_DIST) \ + $(am__two_file_same_shared_test_SOURCES_DIST) \ + $(am__two_file_separate_shared_12_nonpic_test_SOURCES_DIST) \ + $(am__two_file_separate_shared_12_test_SOURCES_DIST) \ + $(am__two_file_separate_shared_21_nonpic_test_SOURCES_DIST) \ + $(am__two_file_separate_shared_21_test_SOURCES_DIST) \ + $(am__two_file_shared_1_nonpic_test_SOURCES_DIST) \ + $(am__two_file_shared_1_test_SOURCES_DIST) \ + $(am__two_file_shared_2_nonpic_test_SOURCES_DIST) \ + $(am__two_file_shared_2_test_SOURCES_DIST) \ + $(am__two_file_test_SOURCES_DIST) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -233,17 +341,27 @@ INCLUDES = -D_GNU_SOURCE \ -DLOCALEDIR="\"$(datadir)/locale\"" \ @INCINTL@ +@GCC_TRUE@@NATIVE_LINKER_TRUE@NATIVE_PROGS = \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ constructor_test \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ constructor_static_test \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_test \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_shared_1_test \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_shared_2_test \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_same_shared_test \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_separate_shared_12_test \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_separate_shared_21_test \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_shared_1_nonpic_test \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_shared_2_nonpic_test \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_same_shared_nonpic_test \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_separate_shared_12_nonpic_test \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_separate_shared_21_nonpic_test + @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_test \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ basic_static_pic_test \ -@GCC_TRUE@@NATIVE_LINKER_TRUE@ constructor_test \ -@GCC_TRUE@@NATIVE_LINKER_TRUE@ constructor_static_test - -@GCC_TRUE@@NATIVE_LINKER_TRUE@NATIVE_PROGS = \ -@GCC_TRUE@@NATIVE_LINKER_TRUE@ constructor_test \ -@GCC_TRUE@@NATIVE_LINKER_TRUE@ constructor_static_test +@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(NATIVE_PROGS) TESTS = object_unittest $(NATIVE_TESTING) check_LIBRARIES = libgoldtest.a @@ -256,6 +374,83 @@ object_unittest_SOURCES = object_unittest.cc @GCC_TRUE@@NATIVE_LINKER_TRUE@constructor_static_test_SOURCES = constructor_test.cc @GCC_TRUE@@NATIVE_LINKER_TRUE@constructor_static_test_DEPENDENCIES = gcctestdir/ld @GCC_TRUE@@NATIVE_LINKER_TRUE@constructor_static_test_LDFLAGS = -Bgcctestdir/ -static +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_test_SOURCES = \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_test_1.cc \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_test_2.cc \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_test_main.cc \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_test.h + +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_test_DEPENDENCIES = gcctestdir/ld +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_test_LDFLAGS = -Bgcctestdir/ +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_shared_1_test_SOURCES = two_file_test_2.cc two_file_test_main.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_shared_1_test_DEPENDENCIES = gcctestdir/ld two_file_shared_1.so +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_shared_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_shared_1_test_LDADD = two_file_shared_1.so +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_shared_2_test_SOURCES = two_file_test_1.cc two_file_test_main.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_shared_2_test_DEPENDENCIES = gcctestdir/ld two_file_shared_2.so +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_shared_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_shared_2_test_LDADD = two_file_shared_2.so +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_same_shared_test_SOURCES = two_file_test_main.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_same_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared.so +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_same_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_same_shared_test_LDADD = two_file_shared.so +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_separate_shared_12_test_SOURCES = two_file_test_main.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_separate_shared_12_test_DEPENDENCIES = \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ gcctestdir/ld two_file_shared_1.so two_file_shared_2.so + +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_separate_shared_12_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_separate_shared_12_test_LDADD = \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_shared_1.so two_file_shared_2.so + +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_separate_shared_21_test_SOURCES = two_file_test_main.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_separate_shared_21_test_DEPENDENCIES = \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ gcctestdir/ld two_file_shared_1.so two_file_shared_2.so + +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_separate_shared_21_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_separate_shared_21_test_LDADD = \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_shared_2.so two_file_shared_1.so + + +# FIXME: The nonpic tests will fail on platforms which can not put +# non-PIC code into shared libraries; how should we handle this? +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_shared_1_nonpic_test_SOURCES = \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_test_2.cc two_file_test_main.cc + +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_shared_1_nonpic_test_DEPENDENCIES = \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ gcctestdir/ld two_file_shared_1_nonpic.so + +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_shared_1_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_shared_1_nonpic_test_LDADD = two_file_shared_1_nonpic.so +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_shared_2_nonpic_test_SOURCES = \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_test_1.cc two_file_test_main.cc + +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_shared_2_nonpic_test_DEPENDENCIES = \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ gcctestdir/ld two_file_shared_2_nonpic.so + +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_shared_2_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_shared_2_nonpic_test_LDADD = two_file_shared_2_nonpic.so +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_same_shared_nonpic_test_SOURCES = two_file_test_main.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_same_shared_nonpic_test_DEPENDENCIES = \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ gcctestdir/ld two_file_shared_nonpic.so + +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_same_shared_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_same_shared_nonpic_test_LDADD = two_file_shared_nonpic.so +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_separate_shared_12_nonpic_test_SOURCES = two_file_test_main.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_separate_shared_12_nonpic_test_DEPENDENCIES = \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so + +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_separate_shared_12_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_separate_shared_12_nonpic_test_LDADD = \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so + +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_separate_shared_21_nonpic_test_SOURCES = two_file_test_main.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_separate_shared_21_nonpic_test_DEPENDENCIES = \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so + +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_separate_shared_21_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_separate_shared_21_nonpic_test_LDADD = \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_shared_2_nonpic.so two_file_shared_1_nonpic.so + all: all-am .SUFFIXES: @@ -308,6 +503,39 @@ constructor_test$(EXEEXT): $(constructor_test_OBJECTS) $(constructor_test_DEPEND object_unittest$(EXEEXT): $(object_unittest_OBJECTS) $(object_unittest_DEPENDENCIES) @rm -f object_unittest$(EXEEXT) $(CXXLINK) $(object_unittest_LDFLAGS) $(object_unittest_OBJECTS) $(object_unittest_LDADD) $(LIBS) +two_file_same_shared_nonpic_test$(EXEEXT): $(two_file_same_shared_nonpic_test_OBJECTS) $(two_file_same_shared_nonpic_test_DEPENDENCIES) + @rm -f two_file_same_shared_nonpic_test$(EXEEXT) + $(CXXLINK) $(two_file_same_shared_nonpic_test_LDFLAGS) $(two_file_same_shared_nonpic_test_OBJECTS) $(two_file_same_shared_nonpic_test_LDADD) $(LIBS) +two_file_same_shared_test$(EXEEXT): $(two_file_same_shared_test_OBJECTS) $(two_file_same_shared_test_DEPENDENCIES) + @rm -f two_file_same_shared_test$(EXEEXT) + $(CXXLINK) $(two_file_same_shared_test_LDFLAGS) $(two_file_same_shared_test_OBJECTS) $(two_file_same_shared_test_LDADD) $(LIBS) +two_file_separate_shared_12_nonpic_test$(EXEEXT): $(two_file_separate_shared_12_nonpic_test_OBJECTS) $(two_file_separate_shared_12_nonpic_test_DEPENDENCIES) + @rm -f two_file_separate_shared_12_nonpic_test$(EXEEXT) + $(CXXLINK) $(two_file_separate_shared_12_nonpic_test_LDFLAGS) $(two_file_separate_shared_12_nonpic_test_OBJECTS) $(two_file_separate_shared_12_nonpic_test_LDADD) $(LIBS) +two_file_separate_shared_12_test$(EXEEXT): $(two_file_separate_shared_12_test_OBJECTS) $(two_file_separate_shared_12_test_DEPENDENCIES) + @rm -f two_file_separate_shared_12_test$(EXEEXT) + $(CXXLINK) $(two_file_separate_shared_12_test_LDFLAGS) $(two_file_separate_shared_12_test_OBJECTS) $(two_file_separate_shared_12_test_LDADD) $(LIBS) +two_file_separate_shared_21_nonpic_test$(EXEEXT): $(two_file_separate_shared_21_nonpic_test_OBJECTS) $(two_file_separate_shared_21_nonpic_test_DEPENDENCIES) + @rm -f two_file_separate_shared_21_nonpic_test$(EXEEXT) + $(CXXLINK) $(two_file_separate_shared_21_nonpic_test_LDFLAGS) $(two_file_separate_shared_21_nonpic_test_OBJECTS) $(two_file_separate_shared_21_nonpic_test_LDADD) $(LIBS) +two_file_separate_shared_21_test$(EXEEXT): $(two_file_separate_shared_21_test_OBJECTS) $(two_file_separate_shared_21_test_DEPENDENCIES) + @rm -f two_file_separate_shared_21_test$(EXEEXT) + $(CXXLINK) $(two_file_separate_shared_21_test_LDFLAGS) $(two_file_separate_shared_21_test_OBJECTS) $(two_file_separate_shared_21_test_LDADD) $(LIBS) +two_file_shared_1_nonpic_test$(EXEEXT): $(two_file_shared_1_nonpic_test_OBJECTS) $(two_file_shared_1_nonpic_test_DEPENDENCIES) + @rm -f two_file_shared_1_nonpic_test$(EXEEXT) + $(CXXLINK) $(two_file_shared_1_nonpic_test_LDFLAGS) $(two_file_shared_1_nonpic_test_OBJECTS) $(two_file_shared_1_nonpic_test_LDADD) $(LIBS) +two_file_shared_1_test$(EXEEXT): $(two_file_shared_1_test_OBJECTS) $(two_file_shared_1_test_DEPENDENCIES) + @rm -f two_file_shared_1_test$(EXEEXT) + $(CXXLINK) $(two_file_shared_1_test_LDFLAGS) $(two_file_shared_1_test_OBJECTS) $(two_file_shared_1_test_LDADD) $(LIBS) +two_file_shared_2_nonpic_test$(EXEEXT): $(two_file_shared_2_nonpic_test_OBJECTS) $(two_file_shared_2_nonpic_test_DEPENDENCIES) + @rm -f two_file_shared_2_nonpic_test$(EXEEXT) + $(CXXLINK) $(two_file_shared_2_nonpic_test_LDFLAGS) $(two_file_shared_2_nonpic_test_OBJECTS) $(two_file_shared_2_nonpic_test_LDADD) $(LIBS) +two_file_shared_2_test$(EXEEXT): $(two_file_shared_2_test_OBJECTS) $(two_file_shared_2_test_DEPENDENCIES) + @rm -f two_file_shared_2_test$(EXEEXT) + $(CXXLINK) $(two_file_shared_2_test_LDFLAGS) $(two_file_shared_2_test_OBJECTS) $(two_file_shared_2_test_LDADD) $(LIBS) +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) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -320,6 +548,9 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testfile.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testmain.Po@am__quote@ +@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@ .cc.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @@ -595,6 +826,25 @@ uninstall-am: uninstall-info-am @GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Bgcctestdir/ basic_pic_test.o @GCC_TRUE@@NATIVE_LINKER_TRUE@basic_static_pic_test: basic_pic_test.o gcctestdir/ld @GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Bgcctestdir/ -static basic_pic_test.o + +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_test_1_pic.o: two_file_test_1.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -c -fpic -o $@ $< +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_test_2_pic.o: two_file_test_2.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -c -fpic -o $@ $< + +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_shared_1.so: two_file_test_1_pic.o +@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -shared two_file_test_1_pic.o +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_shared_2.so: two_file_test_2_pic.o +@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -shared two_file_test_2_pic.o +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_shared.so: two_file_test_1_pic.o two_file_test_2_pic.o +@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -shared two_file_test_1_pic.o two_file_test_2_pic.o + +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_shared_1_nonpic.so: two_file_test_1.o +@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -shared two_file_test_1.o +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_shared_2_nonpic.so: two_file_test_2.o +@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -shared two_file_test_2.o +@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_shared_nonpic.so: two_file_test_1.o two_file_test_2.o +@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -shared two_file_test_1.o two_file_test_2.o # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/gold/testsuite/two_file_test.h b/gold/testsuite/two_file_test.h new file mode 100644 index 00000000000..72c2576cfa5 --- /dev/null +++ b/gold/testsuite/two_file_test.h @@ -0,0 +1,61 @@ +// two_file_test.h -- a two file test case for gold, header file -*- C++ -*- + +// Copyright 2006, 2007 Free Software Foundation, Inc. +// Written by Ian Lance Taylor . + +// 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 tests references between files. This is the shared header +// file. See two_file_test_1.cc for details. + +extern bool t1(); +extern int t1_2(); + +extern bool t2(); +extern int v2; + +extern bool t3(); +extern int v3; + +extern bool t4(); +extern char v4[]; + +extern bool t5(); +extern char v5[]; + +extern bool t6(); + +extern bool t7(); + +extern bool t8(); + +extern bool t9(); + +extern bool t10(); +extern int f10(); + +extern bool t11(); +extern int f11a(); +extern int f11b(int (*)()); + +extern bool t12(); +extern bool (*f12())(); + +extern bool t13(); +inline void f13i() { } +extern void (*f13())(); diff --git a/gold/testsuite/two_file_test_1.cc b/gold/testsuite/two_file_test_1.cc new file mode 100644 index 00000000000..8857db41570 --- /dev/null +++ b/gold/testsuite/two_file_test_1.cc @@ -0,0 +1,168 @@ +// two_file_test_1.cc -- a two file test case for gold, file 1 of 2 + +// Copyright 2006, 2007 Free Software Foundation, Inc. +// Written by Ian Lance Taylor . + +// 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 tests references between files. This is file 1, and +// two_file_test_2.cc is file 2. We test in several different ways: + +// Files 1 and 2 linked together in executable. +// File 1 in executable, file 2 in shared library. +// File 1 in shared library, file 2 in executable. +// Files 1 and 2 linked together in shared library. +// Files 1 and 2 in different shared libraries. + +// We test the following cases. + +// 1 Code in file 1 calls code in file 2. +// 2 Code in file 1 refers to global data in file 2. +// 3 Code in file 1 referes to common symbol in file 2. +// 4 Code in file 1 refers to offset within global data in file 2. +// 5 Code in file 1 refers to offset within common symbol in file 2. +// 6 Data in file 1 refers to global data in file 2. +// 7 Data in file 1 refers to common symbol in file 2. +// 8 Data in file 1 refers to offset within global data in file 2. +// 9 Data in file 1 refers to offset within common symbol in file 2. +// 10 Data in file 1 refers to function in file 2. +// 11 Pass function pointer from file 1 to file 2. +// 12 Compare address of function for equality in both files. +// 13 Compare address of inline function for equality in both files. + +#include "two_file_test.h" + +// 1 Code in file 1 calls code in file 2. + +bool +t1() +{ + return t1_2() == 123; +} + +// 2 Code in file 1 refers to global data in file 2. + +bool +t2() +{ + return v2 == 456; +} + +// 3 Code in file 1 referes to common symbol in file 2. + +bool +t3() +{ + return v3 == 789; +} + +// 4 Code in file 1 refers to offset within global data in file 2. + +bool +t4() +{ + return v4[5] == ','; +} + +// 5 Code in file 1 refers to offset within common symbol in file 2. + +bool +t5() +{ + return v5[7] == 'w'; +} + +// 6 Data in file 1 refers to global data in file 2. + +int* p6 = &v2; + +bool +t6() +{ + return *p6 == 456; +} + +// 7 Data in file 1 refers to common symbol in file 2. + +int* p7 = &v3; + +bool +t7() +{ + return *p7 == 789; +} + +// 8 Data in file 1 refers to offset within global data in file 2. + +char* p8 = &v4[6]; + +bool +t8() +{ + return *p8 == ' '; +} + +// 9 Data in file 1 refers to offset within common symbol in file 2. + +char* p9 = &v5[8]; + +bool +t9() +{ + return *p9 == 'o'; +} + +// 10 Data in file 1 refers to function in file 2. + +int (*pfn)() = &f10; + +bool +t10() +{ + return (*pfn)() == 135; +} + +// 11 Pass function pointer from file 1 to file 2. + +int +f11a() +{ + return 246; +} + +bool +t11() +{ + return f11b(&f11a) == 246; +} + +// 12 Compare address of function for equality in both files. + +bool +t12() +{ + return &t12 == f12(); +} + +// 13 Compare address of inline function for equality in both files. + +bool +t13() +{ + return &f13i == f13(); +} diff --git a/gold/testsuite/two_file_test_2.cc b/gold/testsuite/two_file_test_2.cc new file mode 100644 index 00000000000..631c89b58ec --- /dev/null +++ b/gold/testsuite/two_file_test_2.cc @@ -0,0 +1,94 @@ +// two_file_test_2.cc -- a two file test case for gold, file 2 of 2 + +// Copyright 2006, 2007 Free Software Foundation, Inc. +// Written by Ian Lance Taylor . + +// 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 tests references between files. This is file 2, and +// two_file_test_1.cc is file 1. See file 1 for details. + +#include "two_file_test.h" + +// 1 Code in file 1 calls code in file 2. + +int +t1_2() +{ + return 123; +} + +// 2 Code in file 1 refers to global data in file 2. + +int v2 = 456; + +// 3 Code in file 1 referes to common symbol in file 2. This is +// initialized at runtime to 789. + +int v3; + +// 4 Code in file 1 refers to offset within global data in file 2. + +char v4[] = "Hello, world"; + +// 5 Code in file 1 refers to offset within common symbol in file 2. +// This is initialized at runtime to a copy of v4. + +char v5[13]; + +// 6 Data in file 1 refers to global data in file 2. This reuses v2. + +// 7 Data in file 1 refers to common symbol in file 2. This reuses v3. + +// 8 Data in file 1 refers to offset within global data in file 2. +// This reuses v4. + +// 9 Data in file 1 refers to offset within common symbol in file 2. +// This reuses v5. + +// 10 Data in file 1 refers to function in file 2. + +int +f10() +{ + return 135; +} + +// 11 Pass function pointer from file 1 to file 2. + +int +f11b(int (*pfn)()) +{ + return (*pfn)(); +} + +// 12 Compare address of function for equality in both files. + +bool +(*f12())() +{ + return &t12; +} + +// 13 Compare address of inline function for equality in both files. + +void +(*f13())() +{ + return &f13i; +} diff --git a/gold/testsuite/two_file_test_main.cc b/gold/testsuite/two_file_test_main.cc new file mode 100644 index 00000000000..cd532abd3f1 --- /dev/null +++ b/gold/testsuite/two_file_test_main.cc @@ -0,0 +1,52 @@ +// two_file_test_main.cc -- a two file test case for gold, main function + +// Copyright 2006, 2007 Free Software Foundation, Inc. +// Written by Ian Lance Taylor . + +// 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 tests references between files. This is the main file. See +// two_file_test_1.cc for details. + +#include + +#include "two_file_test.h" + +int +main() +{ + // Initialize common data. + v3 = 789; + for (int i = 0; i < 13; ++i) + v5[i] = v4[i]; + + assert(t1()); + assert(t2()); + assert(t3()); + assert(t4()); + assert(t5()); + assert(t6()); + assert(t7()); + assert(t8()); + assert(t9()); + assert(t10()); + assert(t11()); + assert(t12()); + assert(t13()); + return 0; +} -- 2.30.2