+ // Indicate that this string pool should be optimized, even if not
+ // running with -O2.
+ void
+ set_optimize()
+ { this->optimize_ = true; }
+
+ // Add the string S to the pool. This returns a canonical permanent
+ // pointer to the string in the pool. If COPY is true, the string
+ // is copied into permanent storage. If PKEY is not NULL, this sets
+ // *PKEY to the key for the string.
+ const Stringpool_char*
+ add(const Stringpool_char* s, bool copy, Key* pkey);
+
+ // Add the string S to the pool.
+ const Stringpool_char*
+ add(const std::basic_string<Stringpool_char>& s, bool copy, Key* pkey)
+ { return this->add_with_length(s.data(), s.size(), copy, pkey); }
+
+ // Add string S of length LEN characters to the pool. If COPY is
+ // true, S need not be null terminated.
+ const Stringpool_char*
+ add_with_length(const Stringpool_char* s, size_t len, bool copy, Key* pkey);
+
+ // If the string S is present in the pool, return the canonical
+ // string pointer. Otherwise, return NULL. If PKEY is not NULL,
+ // set *PKEY to the key.
+ const Stringpool_char*
+ find(const Stringpool_char* s, Key* pkey) const;
+
+ // Turn the stringpool into a string table: determine the offsets of
+ // all the strings. After this is called, no more strings may be
+ // added to the stringpool.
+ void
+ set_string_offsets();
+
+ // Get the offset of the string S in the string table. This returns
+ // the offset in bytes, not in units of Stringpool_char. This may
+ // only be called after set_string_offsets has been called.
+ section_offset_type
+ get_offset(const Stringpool_char* s) const;
+
+ // Get the offset of the string S in the string table.
+ section_offset_type
+ get_offset(const std::basic_string<Stringpool_char>& s) const
+ { return this->get_offset_with_length(s.c_str(), s.size()); }
+
+ // Get the offset of string S, with length LENGTH characters, in the
+ // string table.
+ section_offset_type
+ get_offset_with_length(const Stringpool_char* s, size_t length) const;
+
+ // Get the offset of the string with key K.
+ section_offset_type
+ get_offset_from_key(Key k) const
+ {
+ gold_assert(k <= this->key_to_offset_.size());
+ return this->key_to_offset_[k - 1];
+ }
+
+ // Get the size of the string table. This returns the number of
+ // bytes, not in units of Stringpool_char.
+ section_size_type