public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Roland McGrath <roland@hack.frob.com>
To: Cary Coutant <ccoutant@google.com>
Cc: "Ian Lance Taylor" <iant@google.com>,
	"Alan Modra" <amodra@gmail.com>,
	"GNU C. Library" <libc-alpha@sourceware.org>,
	Binutils <binutils@sourceware.org>,
	"Rafael Ávila de Espíndola" <rafael.espindola@gmail.com>
Subject: Re: gold vs libc
Date: Thu, 11 Sep 2014 18:33:00 -0000	[thread overview]
Message-ID: <20140911183329.88ABE2C3978@topped-with-meat.com> (raw)
In-Reply-To: Cary Coutant's message of  Thursday, 11 September 2014 09:00:06 -0700 <CAHACq4rBr76jL+qo7Va03Ewv7PkLfrJA+_tewn7ZnMTpxBO+ug@mail.gmail.com>

> I don't like the idea of checking for specific symbol name to give
> special treatment to a section. I wouldn't mind simply making
> __EH_FRAME_BEGIN__ and __EH_FRAME_END__ linker-defined symbols that
> would override any definitions found in the object files.

The notion as I read it was that when the linker decides to rewrite
.eh_frame data, it defines these symbols accordingly.

> I could also special case by filename -- check is_in_system_directory(),
> and if true, check the filename to see if it contains "begin" or "end".

The horror, the horror.

> BTW, my copy of crtend.o doesn't define __EH_FRAME_END__. It does
> define __FRAME_END, but it's a local symbol. Having the linker provide
> __EH_FRAME_END__ would be consistent, and shouldn't break anything.
> With this proposal, __FRAME_END would get the right value anyway.
> (Until, that is, someone comes along with another crtend-like file and
> decides it needs CFI as well!)

Nothing needs or uses an end symbol (there's an in-band terminator)
and there is no canonical name for one, so I don't think you should
define one.

In fact, __EH_FRAME_BEGIN__ is not a global symbol either.  It's not
actually a canonical name.  It's just used inside crtbeginT.o, which
defines it in .eh_frame and uses it in a reloc in .text.  There is no such
symbol around at all by link time that matters.  There is just a reloc
using the STT_SECTION symbol for .eh_frame.  (At least that's what I see on
by x86_64 system.  I've never been very clear on when the assembler uses a
specific local symbol in a reloc vs reducing it to a section symbol, and I
suspect it varies across machines.)  So the symbol idea doesn't fly.

You could instead special-case a reloc against .eh_frame+0 in an input file
with an empty .eh_frame.  Off hand, I think this might well be the only
reloc against a .eh_frame input section you will ever see.  So perhaps
really the right thing to do is verify that there is at most one reloc
against .eh_frame anywhere (and perhaps that it is against an empty input
.eh_frame section) and treat it specially if so--but either error or
disable .eh_frame optimization if there are any more relocs into .eh_frame
sections.  I can't really imagine any situation with a reloc pointing into
.eh_frame whose intended semantics wouldn't be probably broken by .eh_frame
optimization.


Thanks,
Roland

  parent reply	other threads:[~2014-09-11 18:33 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-30  4:25 Roland McGrath
2014-03-30  4:56 ` Alan Modra
2014-03-30  5:09   ` Roland McGrath
2014-03-31 19:03     ` Ian Lance Taylor
2014-03-31 20:04       ` Roland McGrath
2014-03-31 20:53         ` Ian Lance Taylor
2014-03-31 21:40           ` Roland McGrath
2014-04-01 18:25             ` Ian Lance Taylor
2014-09-10 20:56               ` Cary Coutant
2014-09-10 22:05                 ` Rafael Espíndola
2014-09-11  0:32                   ` Alan Modra
2014-09-10 22:52                 ` Roland McGrath
2014-09-11  0:04                   ` Ian Lance Taylor
2014-12-20 13:58                     ` PATCH: PR gold/14675: No eh_frame info registered in exception_static_test H.J. Lu
2014-12-22 17:37                       ` Cary Coutant
2014-12-22 22:40                         ` H.J. Lu
2014-12-23  0:58                           ` H.J. Lu
2015-01-07 13:17                         ` H.J. Lu
2015-01-07 14:43                           ` H.J. Lu
2015-01-07 18:50                             ` Cary Coutant
2015-01-26 17:22                               ` H.J. Lu
2015-03-02 16:03                                 ` H.J. Lu
2015-03-09 17:16                                   ` Cary Coutant
2015-03-09 17:22                                     ` H.J. Lu
2015-03-20 15:41                                     ` H.J. Lu
2014-09-11 16:00                   ` gold vs libc Cary Coutant
2014-09-11 16:05                     ` Cary Coutant
2014-09-11 16:45                       ` Rafael Espíndola
2014-09-11 16:21                     ` Ian Lance Taylor
2014-09-11 18:33                     ` Roland McGrath [this message]
2014-03-30 18:28 ` Carlos O'Donell

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=20140911183329.88ABE2C3978@topped-with-meat.com \
    --to=roland@hack.frob.com \
    --cc=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=ccoutant@google.com \
    --cc=iant@google.com \
    --cc=libc-alpha@sourceware.org \
    --cc=rafael.espindola@gmail.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).