aboutsummaryrefslogtreecommitdiff
path: root/gold/icf.h
diff options
context:
space:
mode:
authorSriraman Tallam <tmsriram@google.com>2010-01-04 19:08:39 +0000
committerSriraman Tallam <tmsriram@google.com>2010-01-04 19:08:39 +0000
commit55a2bb35466651972b102f5f8b5ec53a17be5b55 (patch)
tree21a1fd65237f9ea4601646bc0e4537b45e02ba9a /gold/icf.h
parentb3f41522568f7617d9452eafe589d0c2ca6b4e6e (diff)
downloadgdb-55a2bb35466651972b102f5f8b5ec53a17be5b55.zip
gdb-55a2bb35466651972b102f5f8b5ec53a17be5b55.tar.gz
gdb-55a2bb35466651972b102f5f8b5ec53a17be5b55.tar.bz2
* gc.h (gc_process_relocs): Call is_section_foldable_candidate to
check for .text or .gnu.linkonce.t sections. * icf.cc (Icf::find_identical_sections): Ditto. Change the detection for mangled function name within the section name. * icf.h (is_section_foldable_candidate): New function.
Diffstat (limited to 'gold/icf.h')
-rw-r--r--gold/icf.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/gold/icf.h b/gold/icf.h
index b87b992..de0fbe0 100644
--- a/gold/icf.h
+++ b/gold/icf.h
@@ -1,6 +1,6 @@
// icf.h -- Identical Code Folding
-// Copyright 2009 Free Software Foundation, Inc.
+// Copyright 2009, 2010 Free Software Foundation, Inc.
// Written by Sriraman Tallam <tmsriram@google.com>.
// This file is part of gold.
@@ -139,6 +139,17 @@ class Icf
Addend_list addend_reloc_list_;
};
+// This function returns true if this section corresponds to a function that
+// should be considered by icf as a possible candidate for folding. Some
+// earlier gcc versions, like 4.0.3, put constructors and destructors in
+// .gnu.linkonce.t sections and hence should be included too.
+inline bool
+is_section_foldable_candidate(const char* section_name)
+{
+ return (is_prefix_of(".text", section_name)
+ || is_prefix_of(".gnu.linkonce.t", section_name));
+}
+
} // End of namespace gold.
#endif