aboutsummaryrefslogtreecommitdiff
path: root/gold/gold.h
diff options
context:
space:
mode:
authorSriraman Tallam <tmsriram@google.com>2010-01-07 07:14:30 +0000
committerSriraman Tallam <tmsriram@google.com>2010-01-07 07:14:30 +0000
commitf1ec9ded5c740c22735843025e5d3a8ff4c4079e (patch)
tree107b73798abba65f1697fd2751cca3b6b31e9ef8 /gold/gold.h
parentb9674e179b86530631391dd38988d2f5da4f40c0 (diff)
downloadgdb-f1ec9ded5c740c22735843025e5d3a8ff4c4079e.zip
gdb-f1ec9ded5c740c22735843025e5d3a8ff4c4079e.tar.gz
gdb-f1ec9ded5c740c22735843025e5d3a8ff4c4079e.tar.bz2
* gc.h (Garbage_collection::Cident_section_map): New typedef.
(Garbage_collection::cident_sections): New function. (Garbage_collection::add_cident_section): New function. (Garbage_collection::cident_sections_): New member. (gc_process_relocs): Add references to sections whose names are C identifiers. * gold.h (cident_section_start_prefix): New constant. (cident_section_stop_prefix): New constant. (is_cident): New function. * layout.cc (Layout::define_section_symbols): Replace string constants with the newly defined constants. * object.cc (Sized_relobj::do_layout): Track sections whose names are C identifiers. * testsuite/Makefile.am: Add gc_orphan_section_test. * testsuite/Makefile.in: Regenerate. * testsuite/gc_orphan_section_test.cc: New file. * testsuite/gc_orphan_section_test.sh: New file.
Diffstat (limited to 'gold/gold.h')
-rw-r--r--gold/gold.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/gold/gold.h b/gold/gold.h
index dc5a1c1..5c98de0 100644
--- a/gold/gold.h
+++ b/gold/gold.h
@@ -1,6 +1,6 @@
// gold.h -- general definitions for gold -*- C++ -*-
-// Copyright 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+// Copyright 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
// Written by Ian Lance Taylor <iant@google.com>.
// This file is part of gold.
@@ -349,6 +349,21 @@ is_prefix_of(const char* prefix, const char* str)
return strncmp(prefix, str, strlen(prefix)) == 0;
}
+const char* const cident_section_start_prefix = "__start_";
+const char* const cident_section_stop_prefix = "__stop_";
+
+// Returns true if the name is a valid C identifier
+inline bool
+is_cident(const char* name)
+{
+ return (name[strspn(name,
+ ("0123456789"
+ "ABCDEFGHIJKLMNOPWRSTUVWXYZ"
+ "abcdefghijklmnopqrstuvwxyz"
+ "_"))]
+ == '\0');
+}
+
// We sometimes need to hash strings. Ideally we should use std::tr1::hash or
// __gnu_cxx::hash on some systems but there is no guarantee that either
// one is available. For portability, we define simple string hash functions.