powerpc gold, work around pr17670

Cary Coutant ccoutant@google.com
Wed Dec 3 19:19:00 GMT 2014


> Making the sym undefined can
> be done via override_base() but using that function requires setting
> up an elfcpp::Sym, so I opted for a simpler new Symbol interface.

We already have Symbol::set_undefined(), which currently asserts that
the symbol is predefined. I'd be OK with removing that assert, and
allowing set_undefined() for any symbol. It makes the symbol undefined
by setting source_ to IS_UNDEFINED, but I think that would work for
your purposes -- Symbol::is_undefined() will still return true, so you
should still get the warning from relocate_section(). If not, it could
have two paths -- the existing one for is_predefined_, and one for
FROM_OBJECT symbols that sets u_.from_object.shndx and
is_ordinary_shndx_.

I'd prefer set_undefined() over a more general set_shndx().

> +  // Set section index in the relocatable or dynamic object file.
> +  void
> +  set_shndx(unsigned int shndx)
> +  {
> +    gold_assert(this->source_ == FROM_OBJECT);
> +    this->u_.from_object.shndx = shndx;
> +  }

You'd also need to set this->is_ordinary_shndx_ to true to make this
work in general.

-cary



More information about the Binutils mailing list