aboutsummaryrefslogtreecommitdiff
path: root/gold
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2008-09-29 21:23:02 +0000
committerCary Coutant <ccoutant@google.com>2008-09-29 21:23:02 +0000
commitfbd8a2572efc74ed0951e6b33b151bc13015e772 (patch)
tree6d2d573d901db9e7c01a7c102e691c04a4c0f414 /gold
parenteff458138e2978ee9a3aef4ebee40d53da11e764 (diff)
downloadbinutils-fbd8a2572efc74ed0951e6b33b151bc13015e772.zip
binutils-fbd8a2572efc74ed0951e6b33b151bc13015e772.tar.gz
binutils-fbd8a2572efc74ed0951e6b33b151bc13015e772.tar.bz2
* archive.cc (Archive::get_file_and_offset): Use filename instead
of name to get library path. (Archive::include_member): Unlock external member of a thin archive. * testsuite/Makefile.am (TEST_AR): New variable. (thin_archive_test_1): New test. (thin_archive_test_2): New test.
Diffstat (limited to 'gold')
-rw-r--r--gold/ChangeLog10
-rw-r--r--gold/archive.cc9
-rw-r--r--gold/testsuite/Makefile.am35
-rw-r--r--gold/testsuite/Makefile.in59
-rw-r--r--gold/testsuite/thin_archive_main.cc39
-rw-r--r--gold/testsuite/thin_archive_test_1.cc37
-rw-r--r--gold/testsuite/thin_archive_test_2.cc37
-rw-r--r--gold/testsuite/thin_archive_test_3.cc37
-rw-r--r--gold/testsuite/thin_archive_test_4.cc35
9 files changed, 294 insertions, 4 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index ff9dd44..54bbfb3 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,5 +1,15 @@
2008-09-29 Cary Coutant <ccoutant@google.com>
+ * archive.cc (Archive::get_file_and_offset): Use filename instead
+ of name to get library path.
+ (Archive::include_member): Unlock external member of a thin archive.
+
+ * testsuite/Makefile.am (TEST_AR): New variable.
+ (thin_archive_test_1): New test.
+ (thin_archive_test_2): New test.
+
+2008-09-29 Cary Coutant <ccoutant@google.com>
+
* mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
* object.cc (Sized_relobj::do_layout): Use constant invalid_address
instead of -1U.
diff --git a/gold/archive.cc b/gold/archive.cc
index 7fd1a17..7e2d143 100644
--- a/gold/archive.cc
+++ b/gold/archive.cc
@@ -459,11 +459,11 @@ Archive::get_file_and_offset(off_t off, Input_objects* input_objects,
// to the directory containing the archive.
if (!IS_ABSOLUTE_PATH(member_name->c_str()))
{
- const char* arch_path = this->name().c_str();
+ const char* arch_path = this->filename().c_str();
const char* basename = lbasename(arch_path);
if (basename > arch_path)
member_name->replace(0, 0,
- this->name().substr(0, basename - arch_path));
+ this->filename().substr(0, basename - arch_path));
}
if (nested_off > 0)
@@ -786,6 +786,11 @@ Archive::include_member(Symbol_table* symtab, Layout* layout,
obj->read_symbols(&sd);
obj->layout(symtab, layout, &sd);
obj->add_symbols(symtab, &sd);
+
+ // If this is an external member of a thin archive, unlock the file
+ // for the next task.
+ if (obj->offset() == 0)
+ obj->unlock(this->task_);
}
else
{
diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am
index 14efd73..57d96cd 100644
--- a/gold/testsuite/Makefile.am
+++ b/gold/testsuite/Makefile.am
@@ -22,6 +22,7 @@ TEST_READELF = $(top_builddir)/../binutils/readelf
TEST_OBJDUMP = $(top_builddir)/../binutils/objdump
TEST_CXXFILT = $(top_builddir)/../binutils/cxxfilt
TEST_STRIP = $(top_builddir)/../binutils/strip-new
+TEST_AR = $(top_builddir)/../binutils/ar
if PLUGINS
LIBDL = -ldl
@@ -902,6 +903,40 @@ script_test_4: basic_test.o gcctestdir/ld $(srcdir)/script_test_4.t
script_test_4.stdout: script_test_4
$(TEST_READELF) -SlW script_test_4 > script_test_4.stdout
+check_PROGRAMS += thin_archive_test_1
+thin_archive_test_1_SOURCES = thin_archive_main.cc
+thin_archive_test_1_DEPENDENCIES = gcctestdir/ld libthin1.a alt/libthin2.a
+thin_archive_test_1_LDFLAGS = -Bgcctestdir/ -Lalt
+thin_archive_test_1_LDADD = libthin1.a -lthin2
+
+check_PROGRAMS += thin_archive_test_2
+thin_archive_test_2_SOURCES = thin_archive_main.cc
+thin_archive_test_2_DEPENDENCIES = gcctestdir/ld libthinall.a
+thin_archive_test_2_LDFLAGS = -Bgcctestdir/ -L.
+thin_archive_test_2_LDADD = -lthinall
+
+libthin1.a: thin_archive_test_1.o alt/thin_archive_test_2.o
+ rm -f $@
+ $(TEST_AR) crT $@ $^
+alt/libthin2.a: thin_archive_test_3.o alt/thin_archive_test_4.o
+ rm -f $@
+ $(TEST_AR) crT $@ $^
+libthin3.a: thin_archive_test_1.o alt/thin_archive_test_4.o
+ rm -f $@
+ $(TEST_AR) crT $@ $^
+alt/libthin4.a: alt/thin_archive_test_2.o thin_archive_test_3.o
+ rm -f $@
+ $(TEST_AR) crT $@ $^
+libthinall.a: libthin3.a alt/libthin4.a
+ rm -f $@
+ $(TEST_AR) crT $@ $^
+alt/thin_archive_test_2.o: thin_archive_test_2.cc
+ test -d alt || mkdir -p alt
+ $(CXXCOMPILE) -c -o $@ $<
+alt/thin_archive_test_4.o: thin_archive_test_4.cc
+ test -d alt || mkdir -p alt
+ $(CXXCOMPILE) -c -o $@ $<
+
if PLUGINS
check_PROGRAMS += plugin_test_1
diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in
index 9860835..54b2364 100644
--- a/gold/testsuite/Makefile.in
+++ b/gold/testsuite/Makefile.in
@@ -248,7 +248,9 @@ check_PROGRAMS = object_unittest$(EXEEXT) binary_unittest$(EXEEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ relro_test relro_script_test \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_1 script_test_2 \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ justsyms binary_test \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_3
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_3 \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ thin_archive_test_1 \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ thin_archive_test_2
@GCC_FALSE@script_test_1_DEPENDENCIES = libgoldtest.a ../libgold.a \
@GCC_FALSE@ ../../libiberty/libiberty.a $(am__DEPENDENCIES_1) \
@GCC_FALSE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
@@ -281,6 +283,8 @@ check_PROGRAMS = object_unittest$(EXEEXT) binary_unittest$(EXEEXT) \
@NATIVE_LINKER_FALSE@ $(am__DEPENDENCIES_1) \
@NATIVE_LINKER_FALSE@ $(am__DEPENDENCIES_1) \
@NATIVE_LINKER_FALSE@ $(am__DEPENDENCIES_1)
+@GCC_FALSE@thin_archive_test_2_DEPENDENCIES =
+@NATIVE_LINKER_FALSE@thin_archive_test_2_DEPENDENCIES =
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@am__append_20 = \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_1 \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_2
@@ -389,7 +393,9 @@ libgoldtest_a_OBJECTS = $(am_libgoldtest_a_OBJECTS)
@GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_2$(EXEEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ justsyms$(EXEEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ binary_test$(EXEEXT) \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_3$(EXEEXT)
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_3$(EXEEXT) \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ thin_archive_test_1$(EXEEXT) \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ thin_archive_test_2$(EXEEXT)
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@am__EXEEXT_16 = plugin_test_1$(EXEEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_2$(EXEEXT)
basic_pic_test_SOURCES = basic_pic_test.c
@@ -599,6 +605,14 @@ script_test_3_LDADD = $(LDADD)
script_test_3_DEPENDENCIES = libgoldtest.a ../libgold.a \
../../libiberty/libiberty.a $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+am__thin_archive_test_1_SOURCES_DIST = thin_archive_main.cc
+@GCC_TRUE@@NATIVE_LINKER_TRUE@am_thin_archive_test_1_OBJECTS = \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ thin_archive_main.$(OBJEXT)
+thin_archive_test_1_OBJECTS = $(am_thin_archive_test_1_OBJECTS)
+am__thin_archive_test_2_SOURCES_DIST = thin_archive_main.cc
+@GCC_TRUE@@NATIVE_LINKER_TRUE@am_thin_archive_test_2_OBJECTS = \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ thin_archive_main.$(OBJEXT)
+thin_archive_test_2_OBJECTS = $(am_thin_archive_test_2_OBJECTS)
am__tls_pic_test_SOURCES_DIST = tls_test_main.cc
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@am_tls_pic_test_OBJECTS = tls_test_main.$(OBJEXT)
tls_pic_test_OBJECTS = $(am_tls_pic_test_OBJECTS)
@@ -839,6 +853,7 @@ SOURCES = $(libgoldtest_a_SOURCES) basic_pic_test.c \
$(protected_2_SOURCES) $(relro_script_test_SOURCES) \
$(relro_test_SOURCES) $(script_test_1_SOURCES) \
$(script_test_2_SOURCES) script_test_3.c \
+ $(thin_archive_test_1_SOURCES) $(thin_archive_test_2_SOURCES) \
$(tls_pic_test_SOURCES) $(tls_shared_gd_to_ie_test_SOURCES) \
$(tls_shared_gnu2_gd_to_ie_test_SOURCES) \
$(tls_shared_gnu2_test_SOURCES) $(tls_shared_ie_test_SOURCES) \
@@ -892,6 +907,8 @@ DIST_SOURCES = $(libgoldtest_a_SOURCES) basic_pic_test.c \
$(am__relro_test_SOURCES_DIST) \
$(am__script_test_1_SOURCES_DIST) \
$(am__script_test_2_SOURCES_DIST) script_test_3.c \
+ $(am__thin_archive_test_1_SOURCES_DIST) \
+ $(am__thin_archive_test_2_SOURCES_DIST) \
$(am__tls_pic_test_SOURCES_DIST) \
$(am__tls_shared_gd_to_ie_test_SOURCES_DIST) \
$(am__tls_shared_gnu2_gd_to_ie_test_SOURCES_DIST) \
@@ -1089,6 +1106,7 @@ TEST_READELF = $(top_builddir)/../binutils/readelf
TEST_OBJDUMP = $(top_builddir)/../binutils/objdump
TEST_CXXFILT = $(top_builddir)/../binutils/cxxfilt
TEST_STRIP = $(top_builddir)/../binutils/strip-new
+TEST_AR = $(top_builddir)/../binutils/ar
@PLUGINS_TRUE@LIBDL = -ldl
@THREADS_TRUE@THREADSLIB = -lpthread
@OMP_SUPPORT_TRUE@TLS_TEST_C_CFLAGS = -fopenmp
@@ -1418,6 +1436,14 @@ binary_unittest_SOURCES = binary_unittest.cc
@GCC_TRUE@@NATIVE_LINKER_TRUE@binary_test_SOURCES = binary_test.cc
@GCC_TRUE@@NATIVE_LINKER_TRUE@binary_test_DEPENDENCIES = gcctestdir/ld binary.txt
@GCC_TRUE@@NATIVE_LINKER_TRUE@binary_test_LDFLAGS = -Bgcctestdir/ -Wl,--format,binary,binary.txt,--format,elf
+@GCC_TRUE@@NATIVE_LINKER_TRUE@thin_archive_test_1_SOURCES = thin_archive_main.cc
+@GCC_TRUE@@NATIVE_LINKER_TRUE@thin_archive_test_1_DEPENDENCIES = gcctestdir/ld libthin1.a alt/libthin2.a
+@GCC_TRUE@@NATIVE_LINKER_TRUE@thin_archive_test_1_LDFLAGS = -Bgcctestdir/ -Lalt
+@GCC_TRUE@@NATIVE_LINKER_TRUE@thin_archive_test_1_LDADD = libthin1.a -lthin2
+@GCC_TRUE@@NATIVE_LINKER_TRUE@thin_archive_test_2_SOURCES = thin_archive_main.cc
+@GCC_TRUE@@NATIVE_LINKER_TRUE@thin_archive_test_2_DEPENDENCIES = gcctestdir/ld libthinall.a
+@GCC_TRUE@@NATIVE_LINKER_TRUE@thin_archive_test_2_LDFLAGS = -Bgcctestdir/ -L.
+@GCC_TRUE@@NATIVE_LINKER_TRUE@thin_archive_test_2_LDADD = -lthinall
all: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) all-am
@@ -1609,6 +1635,12 @@ script_test_2$(EXEEXT): $(script_test_2_OBJECTS) $(script_test_2_DEPENDENCIES)
@NATIVE_LINKER_FALSE@script_test_3$(EXEEXT): $(script_test_3_OBJECTS) $(script_test_3_DEPENDENCIES)
@NATIVE_LINKER_FALSE@ @rm -f script_test_3$(EXEEXT)
@NATIVE_LINKER_FALSE@ $(LINK) $(script_test_3_LDFLAGS) $(script_test_3_OBJECTS) $(script_test_3_LDADD) $(LIBS)
+thin_archive_test_1$(EXEEXT): $(thin_archive_test_1_OBJECTS) $(thin_archive_test_1_DEPENDENCIES)
+ @rm -f thin_archive_test_1$(EXEEXT)
+ $(CXXLINK) $(thin_archive_test_1_LDFLAGS) $(thin_archive_test_1_OBJECTS) $(thin_archive_test_1_LDADD) $(LIBS)
+thin_archive_test_2$(EXEEXT): $(thin_archive_test_2_OBJECTS) $(thin_archive_test_2_DEPENDENCIES)
+ @rm -f thin_archive_test_2$(EXEEXT)
+ $(CXXLINK) $(thin_archive_test_2_LDFLAGS) $(thin_archive_test_2_OBJECTS) $(thin_archive_test_2_LDADD) $(LIBS)
tls_pic_test$(EXEEXT): $(tls_pic_test_OBJECTS) $(tls_pic_test_DEPENDENCIES)
@rm -f tls_pic_test$(EXEEXT)
$(CXXLINK) $(tls_pic_test_LDFLAGS) $(tls_pic_test_OBJECTS) $(tls_pic_test_LDADD) $(LIBS)
@@ -1777,6 +1809,7 @@ 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)/thin_archive_main.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls_test.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls_test_file2.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls_test_main.Po@am__quote@
@@ -2385,6 +2418,28 @@ uninstall-am: uninstall-info-am
@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_4.t
@GCC_TRUE@@NATIVE_LINKER_TRUE@script_test_4.stdout: script_test_4
@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_READELF) -SlW script_test_4 > script_test_4.stdout
+
+@GCC_TRUE@@NATIVE_LINKER_TRUE@libthin1.a: thin_archive_test_1.o alt/thin_archive_test_2.o
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ rm -f $@
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_AR) crT $@ $^
+@GCC_TRUE@@NATIVE_LINKER_TRUE@alt/libthin2.a: thin_archive_test_3.o alt/thin_archive_test_4.o
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ rm -f $@
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_AR) crT $@ $^
+@GCC_TRUE@@NATIVE_LINKER_TRUE@libthin3.a: thin_archive_test_1.o alt/thin_archive_test_4.o
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ rm -f $@
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_AR) crT $@ $^
+@GCC_TRUE@@NATIVE_LINKER_TRUE@alt/libthin4.a: alt/thin_archive_test_2.o thin_archive_test_3.o
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ rm -f $@
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_AR) crT $@ $^
+@GCC_TRUE@@NATIVE_LINKER_TRUE@libthinall.a: libthin3.a alt/libthin4.a
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ rm -f $@
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_AR) crT $@ $^
+@GCC_TRUE@@NATIVE_LINKER_TRUE@alt/thin_archive_test_2.o: thin_archive_test_2.cc
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ test -d alt || mkdir -p alt
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -c -o $@ $<
+@GCC_TRUE@@NATIVE_LINKER_TRUE@alt/thin_archive_test_4.o: thin_archive_test_4.cc
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ test -d alt || mkdir -p alt
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -c -o $@ $<
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@plugin_test_1: two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_test_2.syms gcctestdir/ld plugin_test.so
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so;_Z4f13iv" two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_test_2.syms 2>plugin_test_1.err
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@plugin_test_1.err: plugin_test_1
diff --git a/gold/testsuite/thin_archive_main.cc b/gold/testsuite/thin_archive_main.cc
new file mode 100644
index 0000000..6c38715
--- /dev/null
+++ b/gold/testsuite/thin_archive_main.cc
@@ -0,0 +1,39 @@
+// thin_archive_main.cc -- a test case for gold
+
+// Copyright 2008 Free Software Foundation, Inc.
+// Written by Cary Coutant <ccoutant@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 the main program for the thin archive tests. It calls a single
+// routine, t1, defined in libthin1.a or libthin3.a, which then references
+// other routines in the same and other libraries, to make sure that all
+// archive members are linked properly.
+
+#include <cassert>
+
+extern int t1();
+
+// Main function. Call the test function.
+
+int
+main()
+{
+ assert(t1() == 0x4321);
+ return 0;
+}
diff --git a/gold/testsuite/thin_archive_test_1.cc b/gold/testsuite/thin_archive_test_1.cc
new file mode 100644
index 0000000..db23937
--- /dev/null
+++ b/gold/testsuite/thin_archive_test_1.cc
@@ -0,0 +1,37 @@
+// thin_archive_test_1.cc -- part of a test case for thin archives
+
+// Copyright 2008 Free Software Foundation, Inc.
+// Written by Cary Coutant <ccoutant@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 tests references between files and archives. This is file 1 of 4.
+// Each of the first three files contains a reference to the next.
+// We test the archives as follows:
+
+// Files 1 and 2 in libthin1.a, files 3 and 4 in libthin2.a.
+// Files 1 and 4 in libthin3.a, files 2 and 3 in libthin4.a, with
+// libthin3.a and libthin4.a nested inside libthinall.a.
+
+extern int t2();
+
+int
+t1()
+{
+ return (t2() << 4) | 1;
+}
diff --git a/gold/testsuite/thin_archive_test_2.cc b/gold/testsuite/thin_archive_test_2.cc
new file mode 100644
index 0000000..2c1ee31
--- /dev/null
+++ b/gold/testsuite/thin_archive_test_2.cc
@@ -0,0 +1,37 @@
+// thin_archive_test_2.cc -- part of a test case for thin archives
+
+// Copyright 2008 Free Software Foundation, Inc.
+// Written by Cary Coutant <ccoutant@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 tests references between files and archives. This is file 2 of 4.
+// Each of the first three files contains a reference to the next.
+// We test the archives as follows:
+
+// Files 1 and 2 in libthin1.a, files 3 and 4 in libthin2.a.
+// Files 1 and 4 in libthin3.a, files 2 and 3 in libthin4.a, with
+// libthin3.a and libthin4.a nested inside libthinall.a.
+
+extern int t3();
+
+int
+t2()
+{
+ return (t3() << 4) | 2;
+}
diff --git a/gold/testsuite/thin_archive_test_3.cc b/gold/testsuite/thin_archive_test_3.cc
new file mode 100644
index 0000000..b58c59f
--- /dev/null
+++ b/gold/testsuite/thin_archive_test_3.cc
@@ -0,0 +1,37 @@
+// thin_archive_test_3.cc -- part of a test case for thin archives
+
+// Copyright 2008 Free Software Foundation, Inc.
+// Written by Cary Coutant <ccoutant@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 tests references between files and archives. This is file 3 of 4.
+// Each of the first three files contains a reference to the next.
+// We test the archives as follows:
+
+// Files 1 and 2 in libthin1.a, files 3 and 4 in libthin2.a.
+// Files 1 and 4 in libthin3.a, files 2 and 3 in libthin4.a, with
+// libthin3.a and libthin4.a nested inside libthinall.a.
+
+extern int t4();
+
+int
+t3()
+{
+ return (t4() << 4) | 3;
+}
diff --git a/gold/testsuite/thin_archive_test_4.cc b/gold/testsuite/thin_archive_test_4.cc
new file mode 100644
index 0000000..1b67c94
--- /dev/null
+++ b/gold/testsuite/thin_archive_test_4.cc
@@ -0,0 +1,35 @@
+// thin_archive_test_4.cc -- part of a test case for thin archives
+
+// Copyright 2008 Free Software Foundation, Inc.
+// Written by Cary Coutant <ccoutant@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 tests references between files and archives. This is file 4 of 4.
+// Each of the first three files contains a reference to the next.
+// We test the archives as follows:
+
+// Files 1 and 2 in libthin1.a, files 3 and 4 in libthin2.a.
+// Files 1 and 4 in libthin3.a, files 2 and 3 in libthin4.a, with
+// libthin3.a and libthin4.a nested inside libthinall.a.
+
+int
+t4()
+{
+ return 4;
+}