From a8b2552e073964232f2831644fef18c6a7fa52ae Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 21 Sep 2007 06:12:32 +0000 Subject: [PATCH] Set Stringpool zero_null option via a call, not a default constructor argument. --- gold/merge.h | 4 ++-- gold/stringpool.cc | 4 ++-- gold/stringpool.h | 14 +++++++++----- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/gold/merge.h b/gold/merge.h index dd97bf2..591ac91 100644 --- a/gold/merge.h +++ b/gold/merge.h @@ -169,8 +169,8 @@ class Output_merge_string : public Output_merge_base { public: Output_merge_string() - : Output_merge_base(sizeof(Char_type)), stringpool_(false), hashtable_() - { } + : Output_merge_base(sizeof(Char_type)), stringpool_(), hashtable_() + { this->stringpool_.set_no_zero_null(); } // Add an input section. bool diff --git a/gold/stringpool.cc b/gold/stringpool.cc index 4a301fe..c0a4ae7 100644 --- a/gold/stringpool.cc +++ b/gold/stringpool.cc @@ -13,9 +13,9 @@ namespace gold { template -Stringpool_template::Stringpool_template(bool zero_null) +Stringpool_template::Stringpool_template() : string_set_(), strings_(), strtab_size_(0), next_index_(1), - zero_null_(zero_null) + zero_null_(true) { } diff --git a/gold/stringpool.h b/gold/stringpool.h index cdd36e7..11e9736 100644 --- a/gold/stringpool.h +++ b/gold/stringpool.h @@ -58,14 +58,18 @@ class Stringpool_template // is never a valid key value. typedef size_t Key; - // Create a Stringpool. ZERO_NULL is true if we should reserve - // offset 0 to hold the empty string when converting the stringpool - // to a string table. ZERO_NULL should be true if you want a proper - // ELF SHT_STRTAB section. - Stringpool_template(bool zero_null = true); + // Create a Stringpool. + Stringpool_template(); ~Stringpool_template(); + // Indicate that we should not reserve offset 0 to hold the empty + // string when converting the stringpool to a string table. This + // should not be called for a proper ELF SHT_STRTAB section. + void + set_no_zero_null() + { this->zero_null_ = false; } + // Add the string S to the pool. This returns a canonical permanent // pointer to the string in the pool. If PKEY is not NULL, this // sets *PKEY to the key for the string. -- 2.7.4