[SH] TLS IE -> LE optimization issue

Kaz Kojima kkojima@rr.iij4u.or.jp
Sat Apr 14 00:27:00 GMT 2012

Thomas Schwinge <thomas@codesourcery.com> wrote:
> (This is also where the (dummy) SO comes into play: otherwise ,A;dyn ==
> NULL,A+.)  Back in sh_elf_size_dynamic_sections, ,A;srelgot->size != 0,A+
> (,A;sizeof (Elf32_External_Rela) == 12,A+), thus memory for this section will
> be allocated (using bfd_zalloc).  Later on, in sh_elf_relocate_section,
> the linker recognizes that TLS IE can here be optimized into TLS LE, and
> does so; the relocation slot is now not needed anymore (so
> srelgot->reloc_count is not incremented), but it is not reclaimed/the
> size reservation remains (and due to using zalloc, it's a R_SH_NONE), and
> thus the assertion is triggered.
> Expectedly, weakening the assertion into using <= instead of == makes the
> problem go away, but the empty slot in .rela.dyn remains (12 bytes
> wasted).

A weaken assertion would be enough.  I'd like to pre-approve
such a change.  The empty slots for this relatively rare case
would be not a big deal, I guess.


More information about the Binutils mailing list