This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Patch to add --keep-unique option to gold for unfolding user-specified symbols.
I have committed a trivial patch to print a warning when a symbol in
the --keep-unique
list is not found in the symbol table.
2009-08-12 Sriraman Tallam <tmsriram@google.com>
* icf.cc (Icf::find_identical_sections): Issue a warning when a
symbol in the --keep-unique list is not found.
Index: icf.cc
===================================================================
RCS file: /cvs/src/src/gold/icf.cc,v
retrieving revision 1.2
diff -u -u -p -r1.2 icf.cc
--- icf.cc 12 Aug 2009 19:03:16 -0000 1.2
+++ icf.cc 12 Aug 2009 21:47:51 -0000
@@ -606,9 +606,12 @@ Icf::find_identical_sections(const Input
{
const char* name = p->c_str();
Symbol* sym = symtab->lookup(name);
- if (sym != NULL
- && sym->source() == Symbol::FROM_OBJECT
- && !sym->object()->is_dynamic())
+ if (sym == NULL)
+ {
+ gold_warning(_("Could not find symbol %s to unfold\n"), name);
+ }
+ else if (sym->source() == Symbol::FROM_OBJECT
+ && !sym->object()->is_dynamic())
{
Object* obj = sym->object();
bool is_ordinary;
On Wed, Aug 12, 2009 at 11:54 AM, Sriraman Tallam<tmsriram@google.com> wrote:
> Hi,
>
> ? ? I am committing this patch to gold to support --keep-unique
> option during ICF which
> does not fold user specified symbols. Ian and Cary approved this patch off-line.
>
> Thanks,
> -Sriraman.
>
> 2009-08-12 ?Sriraman Tallam ?<tmsriram@google.com>
>
> ? ? ? ?* icf.cc (Icf::find_identical_sections): Unfold symbols that have
> ? ? ? ?been maked as --keep-unique.
> ? ? ? ?(Icf::unfold_section): New function.
> ? ? ? ?* icf.h (Icf::unfold_section): New function.
> ? ? ? ?* options.h (Genereal_options::keep_unique): New option.
> ? ? ? ?* testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
> ? ? ? ?* testsuite/Makefile.in: Regenerate.
> ? ? ? ?* testsuite/icf_keep_unique_test.sh: New file.
> ? ? ? ?* testsuite/icf_keep_unique_test.cc: New file.
>