// stringpool.h -- a string pool for gold -*- C++ -*-
+// Copyright 2006, 2007 Free Software Foundation, Inc.
+// Written by Ian Lance Taylor <iant@google.com>.
+
+// This file is part of gold.
+
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+// MA 02110-1301, USA.
+
#include <string>
#include <list>
// string pointer so that repeated runs of the linker will generate
// precisely the same output.
+// When you add a string to a Stringpool, Stringpool will make a copy
+// of it. Thus there is no need to keep a copy elsewhere.
+
// A Stringpool can be turned into a string table, a sequential series
// of null terminated strings. The first string may optionally be a
// single zero byte, as required for SHT_STRTAB sections. This
// 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.