aboutsummaryrefslogtreecommitdiff
path: root/gold/object.cc
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/object.cc
parentb9674e179b86530631391dd38988d2f5da4f40c0 (diff)
downloadbinutils-f1ec9ded5c740c22735843025e5d3a8ff4c4079e.zip
binutils-f1ec9ded5c740c22735843025e5d3a8ff4c4079e.tar.gz
binutils-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/object.cc')
-rw-r--r--gold/object.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/gold/object.cc b/gold/object.cc
index 3fedcf8..89ff34c 100644
--- a/gold/object.cc
+++ b/gold/object.cc
@@ -1180,6 +1180,14 @@ Sized_relobj<size, big_endian>::do_layout(Symbol_table* symtab,
{
symtab->gc()->worklist().push(Section_id(this, i));
}
+ // If the section name XXX can be represented as a C identifier
+ // it cannot be discarded if there are references to
+ // __start_XXX and __stop_XXX symbols. These need to be
+ // specially handled.
+ if (is_cident(name))
+ {
+ symtab->gc()->add_cident_section(name, Section_id(this, i));
+ }
}
// When doing a relocatable link we are going to copy input