aboutsummaryrefslogtreecommitdiff
path: root/gold/testsuite
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2011-06-08 04:24:59 +0000
committerCary Coutant <ccoutant@google.com>2011-06-08 04:24:59 +0000
commita5ee4d5d1e92a48c988c6be740f17e4d4f9b166c (patch)
tree847feec6d10af6480fb1f4bc12d75107eaf5e8e4 /gold/testsuite
parent5146f4485680b0029143c2e17bf5393dd4b89792 (diff)
downloadgdb-a5ee4d5d1e92a48c988c6be740f17e4d4f9b166c.zip
gdb-a5ee4d5d1e92a48c988c6be740f17e4d4f9b166c.tar.gz
gdb-a5ee4d5d1e92a48c988c6be740f17e4d4f9b166c.tar.bz2
* testsuite/Makefile.am: Add incremental_copy_test,
incremental_common_test_1. * testsuite/Makefile.in: Regenerate. * testsuite/common_test_1_v1.c: New source file. * testsuite/common_test_1_v2.c: New source file. * testsuite/copy_test_v1.cc: New source file.
Diffstat (limited to 'gold/testsuite')
-rw-r--r--gold/testsuite/Makefile.am16
-rw-r--r--gold/testsuite/Makefile.in60
-rw-r--r--gold/testsuite/common_test_1_v1.c79
-rw-r--r--gold/testsuite/common_test_1_v2.c77
-rw-r--r--gold/testsuite/copy_test_v1.cc47
5 files changed, 276 insertions, 3 deletions
diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am
index a068fa7..8a05ac8 100644
--- a/gold/testsuite/Makefile.am
+++ b/gold/testsuite/Makefile.am
@@ -1851,6 +1851,22 @@ incremental_test_4: two_file_test_1.o two_file_test_1b.o two_file_test_2_v1.o \
cp -f two_file_test_2.o two_file_test_tmp_4.o
$(CXXLINK) -Wl,--incremental-update,--incremental-base=incremental_test_4.base -Bgcctestdir/ two_file_test_1.o two_file_test_1b.o two_file_test_tmp_4.o two_file_test_main.o
+check_PROGRAMS += incremental_copy_test
+incremental_copy_test: copy_test_v1.o copy_test.o copy_test_1.so copy_test_2.so
+ cp -f copy_test_v1.o copy_test_tmp.o
+ $(CXXLINK) -Wl,--incremental-full -Bgcctestdir/ -Wl,-R,. copy_test_tmp.o copy_test_1.so copy_test_2.so
+ @sleep 1
+ cp -f copy_test.o copy_test_tmp.o
+ $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ -Wl,-R,. copy_test_tmp.o copy_test_1.so copy_test_2.so
+
+check_PROGRAMS += incremental_common_test_1
+incremental_common_test_1: common_test_1_v1.o common_test_1_v2.o gcctestdir/ld
+ cp -f common_test_1_v1.o common_test_1_tmp.o
+ $(CXXLINK) -Wl,--incremental-full -Bgcctestdir/ common_test_1_tmp.o
+ @sleep 1
+ cp -f common_test_1_v2.o common_test_1_tmp.o
+ $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ common_test_1_tmp.o
+
endif DEFAULT_TARGET_X86_64
endif GCC
diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in
index c4b2ea0..f8836d5 100644
--- a/gold/testsuite/Makefile.in
+++ b/gold/testsuite/Makefile.in
@@ -435,7 +435,9 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
# Incremental linking is currently supported only on the x86_64 target.
@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_35 = incremental_test_2 \
@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_test_3 \
-@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_test_4
+@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_test_4 \
+@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_copy_test \
+@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_common_test_1
@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_36 = two_file_test_tmp_2.o \
@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_test_tmp_3.o \
@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_test_4.base \
@@ -683,7 +685,9 @@ libgoldtest_a_OBJECTS = $(am_libgoldtest_a_OBJECTS)
@GCC_TRUE@@NATIVE_LINKER_TRUE@am__EXEEXT_22 = start_lib_test$(EXEEXT)
@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@am__EXEEXT_23 = incremental_test_2$(EXEEXT) \
@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_test_3$(EXEEXT) \
-@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_test_4$(EXEEXT)
+@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_test_4$(EXEEXT) \
+@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_copy_test$(EXEEXT) \
+@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_common_test_1$(EXEEXT)
basic_pic_test_SOURCES = basic_pic_test.c
basic_pic_test_OBJECTS = basic_pic_test.$(OBJEXT)
basic_pic_test_LDADD = $(LDADD)
@@ -1008,6 +1012,19 @@ ifuncmain7pie_DEPENDENCIES = libgoldtest.a ../libgold.a \
ifuncmain7static_OBJECTS = $(am_ifuncmain7static_OBJECTS)
ifuncmain7static_LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(ifuncmain7static_LDFLAGS) $(LDFLAGS) -o $@
+incremental_common_test_1_SOURCES = incremental_common_test_1.c
+incremental_common_test_1_OBJECTS = \
+ incremental_common_test_1.$(OBJEXT)
+incremental_common_test_1_LDADD = $(LDADD)
+incremental_common_test_1_DEPENDENCIES = libgoldtest.a ../libgold.a \
+ ../../libiberty/libiberty.a $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+incremental_copy_test_SOURCES = incremental_copy_test.c
+incremental_copy_test_OBJECTS = incremental_copy_test.$(OBJEXT)
+incremental_copy_test_LDADD = $(LDADD)
+incremental_copy_test_DEPENDENCIES = libgoldtest.a ../libgold.a \
+ ../../libiberty/libiberty.a $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
incremental_test_2_SOURCES = incremental_test_2.c
incremental_test_2_OBJECTS = incremental_test_2.$(OBJEXT)
incremental_test_2_LDADD = $(LDADD)
@@ -1504,7 +1521,8 @@ SOURCES = $(libgoldtest_a_SOURCES) basic_pic_test.c basic_pie_test.c \
$(ifuncmain5static_SOURCES) ifuncmain5staticpic.c \
ifuncmain6pie.c $(ifuncmain7_SOURCES) ifuncmain7pic.c \
ifuncmain7picstatic.c ifuncmain7pie.c \
- $(ifuncmain7static_SOURCES) incremental_test_2.c \
+ $(ifuncmain7static_SOURCES) incremental_common_test_1.c \
+ incremental_copy_test.c incremental_test_2.c \
incremental_test_3.c incremental_test_4.c $(initpri1_SOURCES) \
$(justsyms_SOURCES) $(large_SOURCES) local_labels_test.c \
many_sections_r_test.c $(many_sections_test_SOURCES) \
@@ -2577,6 +2595,24 @@ ifuncmain7$(EXEEXT): $(ifuncmain7_OBJECTS) $(ifuncmain7_DEPENDENCIES)
ifuncmain7static$(EXEEXT): $(ifuncmain7static_OBJECTS) $(ifuncmain7static_DEPENDENCIES)
@rm -f ifuncmain7static$(EXEEXT)
$(ifuncmain7static_LINK) $(ifuncmain7static_OBJECTS) $(ifuncmain7static_LDADD) $(LIBS)
+@DEFAULT_TARGET_X86_64_FALSE@incremental_common_test_1$(EXEEXT): $(incremental_common_test_1_OBJECTS) $(incremental_common_test_1_DEPENDENCIES)
+@DEFAULT_TARGET_X86_64_FALSE@ @rm -f incremental_common_test_1$(EXEEXT)
+@DEFAULT_TARGET_X86_64_FALSE@ $(LINK) $(incremental_common_test_1_OBJECTS) $(incremental_common_test_1_LDADD) $(LIBS)
+@GCC_FALSE@incremental_common_test_1$(EXEEXT): $(incremental_common_test_1_OBJECTS) $(incremental_common_test_1_DEPENDENCIES)
+@GCC_FALSE@ @rm -f incremental_common_test_1$(EXEEXT)
+@GCC_FALSE@ $(LINK) $(incremental_common_test_1_OBJECTS) $(incremental_common_test_1_LDADD) $(LIBS)
+@NATIVE_LINKER_FALSE@incremental_common_test_1$(EXEEXT): $(incremental_common_test_1_OBJECTS) $(incremental_common_test_1_DEPENDENCIES)
+@NATIVE_LINKER_FALSE@ @rm -f incremental_common_test_1$(EXEEXT)
+@NATIVE_LINKER_FALSE@ $(LINK) $(incremental_common_test_1_OBJECTS) $(incremental_common_test_1_LDADD) $(LIBS)
+@DEFAULT_TARGET_X86_64_FALSE@incremental_copy_test$(EXEEXT): $(incremental_copy_test_OBJECTS) $(incremental_copy_test_DEPENDENCIES)
+@DEFAULT_TARGET_X86_64_FALSE@ @rm -f incremental_copy_test$(EXEEXT)
+@DEFAULT_TARGET_X86_64_FALSE@ $(LINK) $(incremental_copy_test_OBJECTS) $(incremental_copy_test_LDADD) $(LIBS)
+@GCC_FALSE@incremental_copy_test$(EXEEXT): $(incremental_copy_test_OBJECTS) $(incremental_copy_test_DEPENDENCIES)
+@GCC_FALSE@ @rm -f incremental_copy_test$(EXEEXT)
+@GCC_FALSE@ $(LINK) $(incremental_copy_test_OBJECTS) $(incremental_copy_test_LDADD) $(LIBS)
+@NATIVE_LINKER_FALSE@incremental_copy_test$(EXEEXT): $(incremental_copy_test_OBJECTS) $(incremental_copy_test_DEPENDENCIES)
+@NATIVE_LINKER_FALSE@ @rm -f incremental_copy_test$(EXEEXT)
+@NATIVE_LINKER_FALSE@ $(LINK) $(incremental_copy_test_OBJECTS) $(incremental_copy_test_LDADD) $(LIBS)
@DEFAULT_TARGET_X86_64_FALSE@incremental_test_2$(EXEEXT): $(incremental_test_2_OBJECTS) $(incremental_test_2_DEPENDENCIES)
@DEFAULT_TARGET_X86_64_FALSE@ @rm -f incremental_test_2$(EXEEXT)
@DEFAULT_TARGET_X86_64_FALSE@ $(LINK) $(incremental_test_2_OBJECTS) $(incremental_test_2_LDADD) $(LIBS)
@@ -2971,6 +3007,8 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ifuncmain7pic.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ifuncmain7picstatic.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ifuncmain7pie.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/incremental_common_test_1.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/incremental_copy_test.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/incremental_test_2.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/incremental_test_3.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/incremental_test_4.Po@am__quote@
@@ -3652,6 +3690,10 @@ incremental_test_3.log: incremental_test_3$(EXEEXT)
@p='incremental_test_3$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
incremental_test_4.log: incremental_test_4$(EXEEXT)
@p='incremental_test_4$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
+incremental_copy_test.log: incremental_copy_test$(EXEEXT)
+ @p='incremental_copy_test$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
+incremental_common_test_1.log: incremental_common_test_1$(EXEEXT)
+ @p='incremental_common_test_1$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
.test.log:
@p='$<'; $(am__check_pre) $(TEST_LOG_COMPILE) "$$tst" $(am__check_post)
@am__EXEEXT_TRUE@.test$(EXEEXT).log:
@@ -4615,6 +4657,18 @@ uninstall-am:
@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ @sleep 1
@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ cp -f two_file_test_2.o two_file_test_tmp_4.o
@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Wl,--incremental-update,--incremental-base=incremental_test_4.base -Bgcctestdir/ two_file_test_1.o two_file_test_1b.o two_file_test_tmp_4.o two_file_test_main.o
+@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@incremental_copy_test: copy_test_v1.o copy_test.o copy_test_1.so copy_test_2.so
+@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ cp -f copy_test_v1.o copy_test_tmp.o
+@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Wl,--incremental-full -Bgcctestdir/ -Wl,-R,. copy_test_tmp.o copy_test_1.so copy_test_2.so
+@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ @sleep 1
+@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ cp -f copy_test.o copy_test_tmp.o
+@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ -Wl,-R,. copy_test_tmp.o copy_test_1.so copy_test_2.so
+@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@incremental_common_test_1: common_test_1_v1.o common_test_1_v2.o gcctestdir/ld
+@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ cp -f common_test_1_v1.o common_test_1_tmp.o
+@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Wl,--incremental-full -Bgcctestdir/ common_test_1_tmp.o
+@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ @sleep 1
+@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ cp -f common_test_1_v2.o common_test_1_tmp.o
+@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ common_test_1_tmp.o
@NATIVE_OR_CROSS_LINKER_TRUE@script_test_10.o: script_test_10.s
@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_AS) -o $@ $<
@NATIVE_OR_CROSS_LINKER_TRUE@script_test_10: $(srcdir)/script_test_10.t script_test_10.o gcctestdir/ld
diff --git a/gold/testsuite/common_test_1_v1.c b/gold/testsuite/common_test_1_v1.c
new file mode 100644
index 0000000..86abc40
--- /dev/null
+++ b/gold/testsuite/common_test_1_v1.c
@@ -0,0 +1,79 @@
+/* common_test_1_v1.c -- test common symbol sorting
+
+ Copyright 2008, 2011 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 is a test of a common symbol in the main program and a
+ versioned symbol in a shared library. The common symbol in the
+ main program should override the shared library symbol.
+
+ This file is a modified version of the real test case, to be used
+ while testing the --incremental option. */
+
+#include <assert.h>
+
+/* Common symbols should be sorted by size, largest first, and then by
+ alignment, largest first. We mix up the names, because gas seems
+ to sort common symbols roughly by name. */
+
+int c9[90];
+int c8[80];
+int c7[70];
+int c6[60];
+int c5[10];
+int c4[20];
+int c3[30];
+int c2[40];
+int c1[50];
+
+int a1 __attribute__ ((aligned (1 << 9)));
+int a2 __attribute__ ((aligned (1 << 8)));
+int a3 __attribute__ ((aligned (1 << 7)));
+int a4 __attribute__ ((aligned (1 << 6)));
+int a5 __attribute__ ((aligned (1 << 1)));
+int a6 __attribute__ ((aligned (1 << 2)));
+int a7 __attribute__ ((aligned (1 << 3)));
+int a8 __attribute__ ((aligned (1 << 4)));
+int a9 __attribute__ ((aligned (1 << 5)));
+
+int
+main (int argc __attribute__ ((unused)), char** argv __attribute__ ((unused)))
+{
+ /* These tests are deliberately incorrect. */
+ assert (c5 < c4);
+ assert (c4 < c3);
+ assert (c3 < c2);
+ assert (c2 < c1);
+ assert (c1 < c6);
+ assert (c6 < c7);
+ assert (c7 < c8);
+ assert (c8 < c9);
+
+ assert (&a1 > &a2);
+ assert (&a2 > &a3);
+ assert (&a3 > &a4);
+ assert (&a4 > &a9);
+ assert (&a9 > &a8);
+ assert (&a8 > &a7);
+ assert (&a7 > &a6);
+ assert (&a6 > &a5);
+
+ return 0;
+}
diff --git a/gold/testsuite/common_test_1_v2.c b/gold/testsuite/common_test_1_v2.c
new file mode 100644
index 0000000..c66a647
--- /dev/null
+++ b/gold/testsuite/common_test_1_v2.c
@@ -0,0 +1,77 @@
+/* common_test_1_v2.c -- test common symbol sorting
+
+ Copyright 2008 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 is a test of a common symbol in the main program and a
+ versioned symbol in a shared library. The common symbol in the
+ main program should override the shared library symbol. */
+
+#include <assert.h>
+
+/* Common symbols should be sorted by size, largest first, and then by
+ alignment, largest first. We mix up the names, because gas seems
+ to sort common symbols roughly by name. */
+
+int c9[90];
+int c8[80];
+int c7[70];
+int c6[60];
+int c5[10];
+int c4[20];
+int c3[30];
+int c2[40];
+int c1[50];
+
+int a1 __attribute__ ((aligned (1 << 9)));
+int a2 __attribute__ ((aligned (1 << 8)));
+int a3 __attribute__ ((aligned (1 << 7)));
+int a4 __attribute__ ((aligned (1 << 6)));
+int a5 __attribute__ ((aligned (1 << 1)));
+int a6 __attribute__ ((aligned (1 << 2)));
+int a7 __attribute__ ((aligned (1 << 3)));
+int a8 __attribute__ ((aligned (1 << 4)));
+int a9 __attribute__ ((aligned (1 << 5)));
+
+int
+main (int argc __attribute__ ((unused)), char** argv __attribute__ ((unused)))
+{
+ // After an incremental update, all guarantees about ordering
+ // are null.
+ assert (c5 != c4);
+ assert (c4 != c3);
+ assert (c3 != c2);
+ assert (c2 != c1);
+ assert (c1 != c6);
+ assert (c6 != c7);
+ assert (c7 != c8);
+ assert (c8 != c9);
+
+ assert (&a1 != &a2);
+ assert (&a2 != &a3);
+ assert (&a3 != &a4);
+ assert (&a4 != &a9);
+ assert (&a9 != &a8);
+ assert (&a8 != &a7);
+ assert (&a7 != &a6);
+ assert (&a6 != &a5);
+
+ return 0;
+}
diff --git a/gold/testsuite/copy_test_v1.cc b/gold/testsuite/copy_test_v1.cc
new file mode 100644
index 0000000..63f7dfd
--- /dev/null
+++ b/gold/testsuite/copy_test_v1.cc
@@ -0,0 +1,47 @@
+// copy_test_v1.cc -- test copy relocs for gold
+
+// Copyright 2008, 2011 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 source file is used for testing the --incremental option.
+// The object built from this source will be incrementally updated
+// with the correct object built from copy_test.cc.
+
+#include <cassert>
+#include <stdint.h>
+
+// Misalign the BSS section.
+static char c;
+
+// From copy_test_1.cc.
+extern char b;
+
+// From copy_test_2.cc.
+extern long long l;
+
+int
+main()
+{
+ assert(c == 0);
+ assert(b == 1);
+ assert(l == 3); // Deliberately incorrect.
+ assert((reinterpret_cast<uintptr_t>(&l) & 0x7) == 0);
+ return 0;
+}