summaryrefslogtreecommitdiff
path: root/gold/stringpool.h
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2007-10-12 06:06:34 +0000
committerIan Lance Taylor <iant@google.com>2007-10-12 06:06:34 +0000
commitcfd73a4e26b2ff2a1bee75cf425a9ecffe0ce6cd (patch)
tree7f01e893f545165f30c1dbd3f5680a0b4e4a54cf /gold/stringpool.h
parent0ffd9845f2a947b9249296d3bc7a812bad1f7e07 (diff)
downloadbinutils-gdb-cfd73a4e26b2ff2a1bee75cf425a9ecffe0ce6cd.tar.gz
Add an option for Stringpools to not copy strings.
Diffstat (limited to 'gold/stringpool.h')
-rw-r--r--gold/stringpool.h21
1 files changed, 10 insertions, 11 deletions
diff --git a/gold/stringpool.h b/gold/stringpool.h
index 85532758b6d..80e53bef52b 100644
--- a/gold/stringpool.h
+++ b/gold/stringpool.h
@@ -47,8 +47,9 @@ class Output_file;
// 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.
+// When you add a string to a Stringpool, Stringpool will optionally
+// make a copy of it. Thus there is no requirement 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
@@ -91,19 +92,15 @@ class Stringpool_template
{ 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.
+ // 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, Key* pkey);
-
- // Add the string S to the pool.
- const Stringpool_char*
- add(const std::basic_string<Stringpool_char>& s, Key* pkey)
- { return this->add(s.c_str(), pkey); }
+ add(const Stringpool_char* s, bool copy, Key* pkey);
// Add the prefix of length LEN of string S to the pool.
const Stringpool_char*
- add(const Stringpool_char* s, size_t len, Key* pkey);
+ add_prefix(const Stringpool_char* s, size_t len, Key* pkey);
// If the string S is present in the pool, return the canonical
// string pointer. Otherwise, return NULL. If PKEY is not NULL,
@@ -232,6 +229,8 @@ class Stringpool_template
off_t strtab_size_;
// Next Stringdata index.
unsigned int next_index_;
+ // Next key value for a string we don't copy.
+ int next_uncopied_key_;
// Whether to reserve offset 0 to hold the null string.
bool zero_null_;
};