aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2010-03-23 21:06:10 +0000
committerIan Lance Taylor <ian@airs.com>2010-03-23 21:06:10 +0000
commit6c93b22ce4b4f83c550a489fd547de3f1468e1e1 (patch)
tree195b08709a6c8df68e13c67abeaafcc5402ec65d
parentb9a881c2d200e0e2920f9d307817400f2bdbefac (diff)
downloadgdb-6c93b22ce4b4f83c550a489fd547de3f1468e1e1.zip
gdb-6c93b22ce4b4f83c550a489fd547de3f1468e1e1.tar.gz
gdb-6c93b22ce4b4f83c550a489fd547de3f1468e1e1.tar.bz2
* script-sections.cc (class Orphan_section_placement): Define
PLACE_TLS and PLACE_TLS_BSS. (Orphan_section_placement::Orphan_section_placement): Initialize new places. (Orphan_section_placement::find_place): Handle SHF_TLS sections. * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test. (tls_script_test_SOURCES): Define. (tls_script_test_DEPENDENCIES): Define. (tls_script_test_LDFLAGS): Define. (tls_script_test_LDADD): Define. * testsuite/Makefile.in: Rebuild.
-rw-r--r--gold/ChangeLog14
-rw-r--r--gold/script-sections.cc21
-rw-r--r--gold/testsuite/Makefile.am6
-rw-r--r--gold/testsuite/Makefile.in41
4 files changed, 69 insertions, 13 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index 1f24452..374b588 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,17 @@
+2010-03-23 Ian Lance Taylor <iant@google.com>
+
+ * script-sections.cc (class Orphan_section_placement): Define
+ PLACE_TLS and PLACE_TLS_BSS.
+ (Orphan_section_placement::Orphan_section_placement): Initialize
+ new places.
+ (Orphan_section_placement::find_place): Handle SHF_TLS sections.
+ * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
+ (tls_script_test_SOURCES): Define.
+ (tls_script_test_DEPENDENCIES): Define.
+ (tls_script_test_LDFLAGS): Define.
+ (tls_script_test_LDADD): Define.
+ * testsuite/Makefile.in: Rebuild.
+
2010-03-22 Doug Kwan <dougkwan@google.com>
* arm.cc (Arm_relocate_functions::abs8,
diff --git a/gold/script-sections.cc b/gold/script-sections.cc
index 3cbabf4..12a934b 100644
--- a/gold/script-sections.cc
+++ b/gold/script-sections.cc
@@ -85,6 +85,8 @@ class Orphan_section_placement
PLACE_TEXT,
PLACE_RODATA,
PLACE_DATA,
+ PLACE_TLS,
+ PLACE_TLS_BSS,
PLACE_BSS,
PLACE_REL,
PLACE_INTERP,
@@ -122,6 +124,8 @@ Orphan_section_placement::Orphan_section_placement()
this->initialize_place(PLACE_TEXT, ".text");
this->initialize_place(PLACE_RODATA, ".rodata");
this->initialize_place(PLACE_DATA, ".data");
+ this->initialize_place(PLACE_TLS, NULL);
+ this->initialize_place(PLACE_TLS_BSS, NULL);
this->initialize_place(PLACE_BSS, ".bss");
this->initialize_place(PLACE_REL, NULL);
this->initialize_place(PLACE_INTERP, ".interp");
@@ -232,6 +236,13 @@ Orphan_section_placement::find_place(Output_section* os,
index = PLACE_LAST;
else if (type == elfcpp::SHT_NOTE)
index = PLACE_INTERP;
+ else if ((flags & elfcpp::SHF_TLS) != 0)
+ {
+ if (type == elfcpp::SHT_NOBITS)
+ index = PLACE_TLS_BSS;
+ else
+ index = PLACE_TLS;
+ }
else if (type == elfcpp::SHT_NOBITS)
index = PLACE_BSS;
else if ((flags & elfcpp::SHF_WRITE) != 0)
@@ -265,6 +276,14 @@ Orphan_section_placement::find_place(Output_section* os,
case PLACE_INTERP:
follow = PLACE_TEXT;
break;
+ case PLACE_TLS:
+ follow = PLACE_DATA;
+ break;
+ case PLACE_TLS_BSS:
+ follow = PLACE_TLS;
+ if (!this->places_[PLACE_TLS].have_location)
+ follow = PLACE_DATA;
+ break;
}
if (follow != PLACE_MAX && this->places_[follow].have_location)
{
@@ -2300,7 +2319,7 @@ Orphan_output_section::set_section_addresses(Symbol_table*, Layout*,
uint64_t addralign;
uint64_t size;
- // We know what are single-threaded, so it is OK to lock the
+ // We know we are single-threaded, so it is OK to lock the
// object.
{
const Task* task = reinterpret_cast<const Task*>(-1);
diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am
index b115283..cad75fb 100644
--- a/gold/testsuite/Makefile.am
+++ b/gold/testsuite/Makefile.am
@@ -1094,6 +1094,12 @@ 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 += tls_script_test
+tls_script_test_SOURCES = $(tls_test_SOURCES)
+tls_script_test_DEPENDENCIES = $(tls_test_DEPENDENCIES) $(srcdir)/script_test_4.t
+tls_script_test_LDFLAGS = $(tls_test_LDFLAGS) -T $(srcdir)/script_test_4.t
+tls_script_test_LDADD = $(tls_test_LDADD)
+
check_SCRIPTS += script_test_5.sh
check_DATA += script_test_5.stdout
MOSTLYCLEANFILES += script_test_5
diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in
index 061c627..d69aa96 100644
--- a/gold/testsuite/Makefile.in
+++ b/gold/testsuite/Makefile.in
@@ -223,6 +223,7 @@ check_PROGRAMS = object_unittest$(EXEEXT) binary_unittest$(EXEEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ relro_script_test script_test_1 \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_2 justsyms \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ binary_test script_test_3 \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ tls_script_test \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ thin_archive_test_1 \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ thin_archive_test_2
@GCC_FALSE@script_test_1_DEPENDENCIES =
@@ -460,6 +461,7 @@ libgoldtest_a_OBJECTS = $(am_libgoldtest_a_OBJECTS)
@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@ tls_script_test$(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) \
@@ -813,6 +815,19 @@ tls_pie_test_LDADD = $(LDADD)
tls_pie_test_DEPENDENCIES = libgoldtest.a ../libgold.a \
../../libiberty/libiberty.a $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+am__tls_script_test_SOURCES_DIST = tls_test.cc tls_test_file2.cc \
+ tls_test_main.cc tls_test.h
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@am__objects_3 = \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ tls_test.$(OBJEXT) \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ tls_test_file2.$(OBJEXT) \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ tls_test_main.$(OBJEXT)
+@GCC_TRUE@@NATIVE_LINKER_TRUE@am_tls_script_test_OBJECTS = \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(am__objects_3)
+tls_script_test_OBJECTS = $(am_tls_script_test_OBJECTS)
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@am__DEPENDENCIES_2 = \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ tls_test_c.o
+tls_script_test_LINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \
+ $(tls_script_test_LDFLAGS) $(LDFLAGS) -o $@
am__tls_shared_gd_to_ie_test_SOURCES_DIST = tls_test_main.cc
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@am_tls_shared_gd_to_ie_test_OBJECTS = tls_test_main.$(OBJEXT)
tls_shared_gd_to_ie_test_OBJECTS = \
@@ -847,10 +862,10 @@ tls_shared_test_OBJECTS = $(am_tls_shared_test_OBJECTS)
tls_shared_test_LINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \
$(tls_shared_test_LDFLAGS) $(LDFLAGS) -o $@
am__tls_static_pic_test_SOURCES_DIST = tls_test_main.cc
-@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@am__objects_3 = tls_test_main.$(OBJEXT)
-@GCC_TRUE@@NATIVE_LINKER_TRUE@@STATIC_TLS_TRUE@@TLS_TRUE@am_tls_static_pic_test_OBJECTS = $(am__objects_3)
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@am__objects_4 = tls_test_main.$(OBJEXT)
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@STATIC_TLS_TRUE@@TLS_TRUE@am_tls_static_pic_test_OBJECTS = $(am__objects_4)
tls_static_pic_test_OBJECTS = $(am_tls_static_pic_test_OBJECTS)
-@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@am__DEPENDENCIES_2 = \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@am__DEPENDENCIES_3 = \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ tls_test_pic.o \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ tls_test_file2_pic.o \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ tls_test_c_pic.o
@@ -858,14 +873,8 @@ tls_static_pic_test_LINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \
$(tls_static_pic_test_LDFLAGS) $(LDFLAGS) -o $@
am__tls_static_test_SOURCES_DIST = tls_test.cc tls_test_file2.cc \
tls_test_main.cc tls_test.h
-@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@am__objects_4 = \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ tls_test.$(OBJEXT) \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ tls_test_file2.$(OBJEXT) \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ tls_test_main.$(OBJEXT)
-@GCC_TRUE@@NATIVE_LINKER_TRUE@@STATIC_TLS_TRUE@@TLS_TRUE@am_tls_static_test_OBJECTS = $(am__objects_4)
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@STATIC_TLS_TRUE@@TLS_TRUE@am_tls_static_test_OBJECTS = $(am__objects_3)
tls_static_test_OBJECTS = $(am_tls_static_test_OBJECTS)
-@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@am__DEPENDENCIES_3 = \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ tls_test_c.o
tls_static_test_LINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \
$(tls_static_test_LDFLAGS) $(LDFLAGS) -o $@
am__tls_test_SOURCES_DIST = tls_test.cc tls_test_file2.cc \
@@ -1153,7 +1162,7 @@ SOURCES = $(libgoldtest_a_SOURCES) basic_pic_test.c basic_pie_test.c \
script_test_3.c $(searched_file_test_SOURCES) \
$(thin_archive_test_1_SOURCES) $(thin_archive_test_2_SOURCES) \
$(tls_pic_test_SOURCES) tls_pie_pic_test.c tls_pie_test.c \
- $(tls_shared_gd_to_ie_test_SOURCES) \
+ $(tls_script_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) \
$(tls_shared_nonpic_test_SOURCES) $(tls_shared_test_SOURCES) \
@@ -1216,7 +1225,8 @@ DIST_SOURCES = $(libgoldtest_a_SOURCES) basic_pic_test.c \
$(am__thin_archive_test_1_SOURCES_DIST) \
$(am__thin_archive_test_2_SOURCES_DIST) \
$(am__tls_pic_test_SOURCES_DIST) tls_pie_pic_test.c \
- tls_pie_test.c $(am__tls_shared_gd_to_ie_test_SOURCES_DIST) \
+ tls_pie_test.c $(am__tls_script_test_SOURCES_DIST) \
+ $(am__tls_shared_gd_to_ie_test_SOURCES_DIST) \
$(am__tls_shared_gnu2_gd_to_ie_test_SOURCES_DIST) \
$(am__tls_shared_gnu2_test_SOURCES_DIST) \
$(am__tls_shared_ie_test_SOURCES_DIST) \
@@ -1763,6 +1773,10 @@ binary_unittest_SOURCES = binary_unittest.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@binary_test_LDADD =
+@GCC_TRUE@@NATIVE_LINKER_TRUE@tls_script_test_SOURCES = $(tls_test_SOURCES)
+@GCC_TRUE@@NATIVE_LINKER_TRUE@tls_script_test_DEPENDENCIES = $(tls_test_DEPENDENCIES) $(srcdir)/script_test_4.t
+@GCC_TRUE@@NATIVE_LINKER_TRUE@tls_script_test_LDFLAGS = $(tls_test_LDFLAGS) -T $(srcdir)/script_test_4.t
+@GCC_TRUE@@NATIVE_LINKER_TRUE@tls_script_test_LDADD = $(tls_test_LDADD)
@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
@@ -2074,6 +2088,9 @@ tls_pic_test$(EXEEXT): $(tls_pic_test_OBJECTS) $(tls_pic_test_DEPENDENCIES)
@TLS_FALSE@tls_pie_test$(EXEEXT): $(tls_pie_test_OBJECTS) $(tls_pie_test_DEPENDENCIES)
@TLS_FALSE@ @rm -f tls_pie_test$(EXEEXT)
@TLS_FALSE@ $(LINK) $(tls_pie_test_OBJECTS) $(tls_pie_test_LDADD) $(LIBS)
+tls_script_test$(EXEEXT): $(tls_script_test_OBJECTS) $(tls_script_test_DEPENDENCIES)
+ @rm -f tls_script_test$(EXEEXT)
+ $(tls_script_test_LINK) $(tls_script_test_OBJECTS) $(tls_script_test_LDADD) $(LIBS)
tls_shared_gd_to_ie_test$(EXEEXT): $(tls_shared_gd_to_ie_test_OBJECTS) $(tls_shared_gd_to_ie_test_DEPENDENCIES)
@rm -f tls_shared_gd_to_ie_test$(EXEEXT)
$(tls_shared_gd_to_ie_test_LINK) $(tls_shared_gd_to_ie_test_OBJECTS) $(tls_shared_gd_to_ie_test_LDADD) $(LIBS)