From 6c93b22ce4b4f83c550a489fd547de3f1468e1e1 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 23 Mar 2010 21:06:10 +0000 Subject: * 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. --- gold/script-sections.cc | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'gold/script-sections.cc') 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(-1); -- cgit v1.1