public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: thomas@codesourcery.com
Cc: binutils@sourceware.org, aoliva@redhat.com, kkojima@rr.iij4u.or.jp
Subject: Re: [SH] TLS IE -> LE optimization issue
Date: Fri, 13 Apr 2012 15:55:00 -0000	[thread overview]
Message-ID: <20120413.115316.1972942705768732499.davem@davemloft.net> (raw)
In-Reply-To: <87obqvpr9l.fsf@schwinge.name>

From: Thomas Schwinge <thomas@codesourcery.com>
Date: Fri, 13 Apr 2012 17:48:06 +0200

> (This is also where the (dummy) SO comes into play: otherwise »dyn ==
> NULL«.)  Back in sh_elf_size_dynamic_sections, »srelgot->size != 0«
> (»sizeof (Elf32_External_Rela) == 12«), 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).
> 
> Or, instead, should the srelgot->size reservations be un-done as the TLS
> optimizations are done (there may be other such cases, I didn't check)?
> Can this actually be done at this stage?
> 
> Or, should there be another cleanup pass after the TLS optimizations have
> been done?  Or, should one of the existing passes in fact be catching
> this case, too?

Sparc, which makes similar transformations, lacks the assertion you
mention altogether.

In fact SH is one of the few backends I see making this size check.

  reply	other threads:[~2012-04-13 15:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-13 15:53 Thomas Schwinge
2012-04-13 15:55 ` David Miller [this message]
2012-04-14  0:27 ` Kaz Kojima
2012-04-15 22:18 ` Alan Modra
2012-04-16 11:47   ` Kaz Kojima
2012-04-17 12:36     ` Thomas Schwinge
2012-04-17 14:48       ` Kaz Kojima
2012-04-17 22:13         ` Kaz Kojima

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120413.115316.1972942705768732499.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=aoliva@redhat.com \
    --cc=binutils@sourceware.org \
    --cc=kkojima@rr.iij4u.or.jp \
    --cc=thomas@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).