This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: Add gold support for -t and -y options


"Cary Coutant" <ccoutant@google.com> writes:

> +  // Whether to trace SYMBOL.
> +  bool
> +  is_trace_symbol(const char* symbol) const
> +  {
> +    return (this->trace_symbols_.find(std::string(symbol))
> +	    != this->trace_symbols_.end());
> +  }



> +  // Print a message if this symbol is being traced.
> +  if (parameters->options().is_trace_symbol(name))
> +    {
> +      if (orig_sym.get_st_shndx() == elfcpp::SHN_UNDEF)
> +        gold_info(_("%s: reference to %s"), object->name().c_str(), name);
> +      else
> +        gold_info(_("%s: definition of %s"), object->name().c_str(), name);
> +    }
> +


This is going to insert a std::string constructor and destructor to
every symbol seen in every object file whether or not -y is used.
That is too expensive for such an uncommon feature.  You need to guard
the call to is_trace_symbol with a call to an (inlined) function like
any_trace_symbols.  Compare to any_wrap_symbols.

Ok with that change.

Thanks.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]