public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Roland McGrath <roland@hack.frob.com>
To: "GNU C. Library" <libc-alpha@sourceware.org>
Cc: binutils@sourceware.org
Subject: gold vs libc
Date: Sun, 30 Mar 2014 04:25:00 -0000	[thread overview]
Message-ID: <20140330042516.1A88E74481@topped-with-meat.com> (raw)

On the glibc.git branch roland/gold-vs-libc is the trivial configure change
necessary to let glibc attempt to build using gold as the linker.  (The
version check with that change is excessively loose--to boot, it admits
current gold versions so you can test, even though they don't work enough.)
i.e.:

	$ git clone git://sourceware.org/git/glibc.git
	$ git checkout roland/gold-vs-libc
	... make the ld in your path and found by the compiler be gold ...
	$ mkdir build
	$ cd build
	$ ../configure --enable-add-ons --prefix=/usr

The configure will fail the __ehdr_start check, which I've already posted
on the binutils list about.  This is not fatal.

	$ make -j...
	$ make -j... check

This will get test failures for nptl/tst-*-static (all but one of them).
(For me, there is one other FAIL, which is not a regression from libc built
by BFD ld.)  The affected tests are all statically-linked programs using
cancellation, i.e. unwinding.  I examined one in detail: tst-sem11-static.
I assume that the others are all suffering from the same gold bug.

I suspect the bug is in gold's .eh_frame optimization pass.  For me (with
trunk gold), the __EH_FRAME_BEGIN__ symbol (from gcc's crtbeginT.o--meant
to attach to the start of the .eh_frame output section) winds up pointing
at the end of .eh_frame rather than the beginning.  In the binary created
by BFD ld, the symbol points 48 bytes past the true start of .eh_frame,
which is exactly the size of crt1.o's .eh_frame contribution (so what we'd
expect given the input file order, albeit not what would be really right).

The .eh_frame in gold's output is a little smaller, perhaps suggesting that
it de-dup'd some CIEs and BFD ld didn't.  I'm not sure whether BFD ld does
.eh_frame optimization without --eh-frame-hdr (which isn't passed in this
static link).

Perhaps .eh_frame optimization just never really works with static linking
because there is no right answer for what a symbol like __EH_FRAME_BEGIN__
should stick to?  Hmm.  If the first CIE there happens to be one that's
de-dup'd then maybe it appears to make sense for the label to move to the
remaining other equivalent CIE, which might be way off into the section.

OTOH, crtbeginT.o is actually an input file that defines __EH_FRAME_BEGIN__
as a symbol in a zero-length .eh_frame input section.  So it seems more
unambiguous that this symbol should stick to that input file's relative
position in the output section, which I think is well-defined in theory
even when the input section is empty--rather than sticking to the
immediately adjacent content of another (file's) input section going into
the same output section, which if it's a de-dup'd CIE could be considered
to have "moved" to elsewhere in the output section.

At any rate, the symbol winding up exactly at the end of the .eh_frame
output section, as it does, seems clearly wrong.

gold hackers wanting to help gold finally get over the hump to being able
to build glibc could try the build from the branch and debug this issue.
glibc hackers wanting to help gold hackers achieve the same end could work
on reducing and isolating a test case that demonstrates the misbehavior
with the __EH_FRAME_BEGIN__ symbol without needing a whole pile of libc
build .o and .a files to make it happen.


Thanks,
Roland

             reply	other threads:[~2014-03-30  4:25 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-30  4:25 Roland McGrath [this message]
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
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=20140330042516.1A88E74481@topped-with-meat.com \
    --to=roland@hack.frob.com \
    --cc=binutils@sourceware.org \
    --cc=libc-alpha@sourceware.org \
    /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).