summaryrefslogtreecommitdiff
path: root/gold
diff options
context:
space:
mode:
authorSriraman Tallam <tmsriram@google.com>2009-08-07 18:48:44 +0000
committerSriraman Tallam <tmsriram@google.com>2009-08-07 18:48:44 +0000
commite3e5c3d01c2bd0b849ca69d7733c4526793f665b (patch)
tree437240f584cb4f060299d3453015855a45e44058 /gold
parent2f6ce5930ed4c565e7266dd2309dd7250afab8b3 (diff)
downloadbinutils-redhat-e3e5c3d01c2bd0b849ca69d7733c4526793f665b.tar.gz
*** empty log message ***
Diffstat (limited to 'gold')
-rw-r--r--gold/ChangeLog4
-rw-r--r--gold/dynobj.h2
-rw-r--r--gold/testsuite/Makefile.am9
-rw-r--r--gold/testsuite/Makefile.in21
-rw-r--r--gold/testsuite/gc_tls_test.cc32
-rwxr-xr-xgold/testsuite/gc_tls_test.sh39
-rw-r--r--gold/x86_64.cc12
7 files changed, 107 insertions, 12 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index 72241b6ce3..ec11fc5b2b 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,7 @@
+2009-08-07 Sriraman Tallam <tmsriram@google.com>
+ * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
+ compiler warnings.
+
2009-08-06 Sriraman Tallam <tmsriram@google.com>
* x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
diff --git a/gold/dynobj.h b/gold/dynobj.h
index a15e2a4323..d52974f486 100644
--- a/gold/dynobj.h
+++ b/gold/dynobj.h
@@ -201,7 +201,7 @@ class Sized_dynobj : public Dynobj
// Not used for dynobj.
uint64_t
do_section_entsize(unsigned int )
- { gold_unreachable(); }
+ { gold_unreachable(); return 0; }
// Return section address.
uint64_t
diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am
index ca177bd41a..6693f00666 100644
--- a/gold/testsuite/Makefile.am
+++ b/gold/testsuite/Makefile.am
@@ -115,6 +115,15 @@ gc_comdat_test: gc_comdat_test_1.o gc_comdat_test_2.o gcctestdir/ld
gc_comdat_test.stdout: gc_comdat_test
$(TEST_NM) -C gc_comdat_test > gc_comdat_test.stdout
+check_SCRIPTS += gc_tls_test.sh
+check_DATA += gc_tls_test.stdout
+gc_tls_test.o: gc_tls_test.cc
+ $(CXXCOMPILE) -O0 -c -g -o $@ $<
+gc_tls_test:gc_tls_test.o gcctestdir/ld
+ $(CXXLINK) -Bgcctestdir/ -Wl,--gc-sections gc_tls_test.o
+gc_tls_test.stdout: gc_tls_test
+ $(TEST_NM) -C gc_tls_test > gc_tls_test.stdout
+
check_SCRIPTS += icf_test.sh
check_DATA += icf_test.stdout
icf_test.o: icf_test.cc
diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in
index d6b43bdf6a..7458f3fc45 100644
--- a/gold/testsuite/Makefile.in
+++ b/gold/testsuite/Makefile.in
@@ -57,12 +57,12 @@ check_PROGRAMS = object_unittest$(EXEEXT) binary_unittest$(EXEEXT) \
# Test --dynamic-list, --dynamic-list-data, --dynamic-list-cpp-new,
# and --dynamic-list-cpp-typeinfo
@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_1 = gc_comdat_test.sh \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ icf_test.sh two_file_shared.sh \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ weak_plt.sh debug_msg.sh \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ undef_symbol.sh ver_test_1.sh \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_2.sh ver_test_4.sh \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_5.sh ver_test_7.sh \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_10.sh \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ gc_tls_test.sh icf_test.sh \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_shared.sh weak_plt.sh \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ debug_msg.sh undef_symbol.sh \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_1.sh ver_test_2.sh \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_4.sh ver_test_5.sh \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_7.sh ver_test_10.sh \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_matching_test.sh \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_3.sh \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_4.sh \
@@ -75,6 +75,7 @@ check_PROGRAMS = object_unittest$(EXEEXT) binary_unittest$(EXEEXT) \
# We also want to make sure we do something reasonable when there's no
# debug info available. For the best test, we use .so's.
@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_2 = gc_comdat_test.stdout \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ gc_tls_test.stdout \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ icf_test.stdout \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_shared.dbg \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ weak_plt_shared.so debug_msg.err \
@@ -347,7 +348,7 @@ check_PROGRAMS = object_unittest$(EXEEXT) binary_unittest$(EXEEXT) \
@NATIVE_LINKER_FALSE@ $(am__DEPENDENCIES_1) \
@NATIVE_LINKER_FALSE@ $(am__DEPENDENCIES_1)
subdir = testsuite
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/gettext-sister.m4 \
@@ -2318,6 +2319,12 @@ uninstall-am: uninstall-info-am
@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Bgcctestdir/ -Wl,--gc-sections gc_comdat_test_1.o gc_comdat_test_2.o
@GCC_TRUE@@NATIVE_LINKER_TRUE@gc_comdat_test.stdout: gc_comdat_test
@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_NM) -C gc_comdat_test > gc_comdat_test.stdout
+@GCC_TRUE@@NATIVE_LINKER_TRUE@gc_tls_test.o: gc_tls_test.cc
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -O0 -c -g -o $@ $<
+@GCC_TRUE@@NATIVE_LINKER_TRUE@gc_tls_test:gc_tls_test.o gcctestdir/ld
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Bgcctestdir/ -Wl,--gc-sections gc_tls_test.o
+@GCC_TRUE@@NATIVE_LINKER_TRUE@gc_tls_test.stdout: gc_tls_test
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_NM) -C gc_tls_test > gc_tls_test.stdout
@GCC_TRUE@@NATIVE_LINKER_TRUE@icf_test.o: icf_test.cc
@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
@GCC_TRUE@@NATIVE_LINKER_TRUE@icf_test: icf_test.o gcctestdir/ld
diff --git a/gold/testsuite/gc_tls_test.cc b/gold/testsuite/gc_tls_test.cc
new file mode 100644
index 0000000000..1b10d987ee
--- /dev/null
+++ b/gold/testsuite/gc_tls_test.cc
@@ -0,0 +1,32 @@
+// gc_tls_test.cc -- a test case for gold
+
+// Copyright 2009 Free Software Foundation, Inc.
+// Written by Sriraman Tallam <tmsriram@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.
+
+// The goal of this program is to verify if tls sections are garbage
+// collected with --gc-sections.
+
+__thread int number;
+
+int main()
+{
+ return 0;
+}
+
diff --git a/gold/testsuite/gc_tls_test.sh b/gold/testsuite/gc_tls_test.sh
new file mode 100755
index 0000000000..c4635c99e2
--- /dev/null
+++ b/gold/testsuite/gc_tls_test.sh
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+# gc_tls_test.sh -- test -- gc + tls
+
+# Copyright 2009 Free Software Foundation, Inc.
+# Written by Sriraman Tallam <tmsriram@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.
+
+# The goal of this program is to verify if tls sections are garbage
+# collected with --gc-sections. File gc_tls_test.cc is in this test.
+
+check()
+{
+ if grep -q "$2" "$1"
+ then
+ echo "Garbage collection failed to collect tls variable:"
+ echo " $2"
+ exit 1
+ fi
+
+}
+
+check gc_tls_test.stdout "number"
diff --git a/gold/x86_64.cc b/gold/x86_64.cc
index 22d5cc697e..9287d581b1 100644
--- a/gold/x86_64.cc
+++ b/gold/x86_64.cc
@@ -2119,7 +2119,6 @@ Target_x86_64::Relocate::relocate_tls(const Relocate_info<64, false>* relinfo,
break;
case elfcpp::R_X86_64_DTPOFF32:
- gold_assert(tls_segment != NULL);
if (optimized_type == tls::TLSOPT_TO_LE)
{
// This relocation type is used in debugging information.
@@ -2127,18 +2126,23 @@ Target_x86_64::Relocate::relocate_tls(const Relocate_info<64, false>* relinfo,
// haven't seen a TLSLD reloc, then we assume we should not
// optimize this reloc.
if (this->saw_tls_block_reloc_)
- value -= tls_segment->memsz();
+ {
+ gold_assert(tls_segment != NULL);
+ value -= tls_segment->memsz();
+ }
}
Relocate_functions<64, false>::rela32(view, value, addend);
break;
case elfcpp::R_X86_64_DTPOFF64:
- gold_assert(tls_segment != NULL);
if (optimized_type == tls::TLSOPT_TO_LE)
{
// See R_X86_64_DTPOFF32, just above, for why we test this.
if (this->saw_tls_block_reloc_)
- value -= tls_segment->memsz();
+ {
+ gold_assert(tls_segment != NULL);
+ value -= tls_segment->memsz();
+ }
}
Relocate_functions<64, false>::rela64(view, value, addend);
break;