summaryrefslogtreecommitdiff
path: root/gold/script-sections.cc
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 /gold/script-sections.cc
parentb9a881c2d200e0e2920f9d307817400f2bdbefac (diff)
downloadbinutils-gdb-6c93b22ce4b4f83c550a489fd547de3f1468e1e1.tar.gz
* 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.
Diffstat (limited to 'gold/script-sections.cc')
-rw-r--r--gold/script-sections.cc21
1 files changed, 20 insertions, 1 deletions
diff --git a/gold/script-sections.cc b/gold/script-sections.cc
index 3cbabf41156..12a934b5b55 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);