mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@aerifal.cx>
To: musl@lists.openwall.com
Subject: Re: Re: libgcc --disable-shared test case
Date: Sat, 11 Jan 2014 17:23:54 -0500	[thread overview]
Message-ID: <20140111222354.GW24286@brightrain.aerifal.cx> (raw)
In-Reply-To: <52D1BFE9.6040703@landley.net>

On Sat, Jan 11, 2014 at 04:04:25PM -0600, Rob Landley wrote:
> >If you could share the two versions of libfoo.so, a.out, and maybe
> >even libgcc.a, I can probably figure out what's going on.
> 
> Tarball of the newly built stuff attached, the other stuff should be
> at http://landley.net/simple-root-filesystem-i686.tar.bz2 (which
> isn't the release version because I made sure this one _wasn't_
> built from a stage 2 cross compiler. This is from an aboriginal
> build that didn't do a stage 2 cross compiler, but built everything
> with the "simple" cross compiler.)

OK, here's my analysis. a.out does not contain __divdi3, which it
should, but instead contains an undefined reference to it. libfoo1.so
contains a definition for __divdi3, and libfoo2.so does not. So far,
this is all exactly how I expected the linking against a broken
libgcc.a to manifest.

So, why does it "work"? Because your uclibc was also built against
this broken libgcc.a, and thus exports __divdi3 and whatever subset of
the libgcc symbols *happened* to get used by code in libc. If you
replace it with a properly built uclibc libc.so.0 (i.e. one built with
a gcc toolchain that was not using --disable-shared), your a.out will
definitely stop working. If this weren't troubling enough, it could in
principle just stop working as a result of internal changes to uclibc.
(This is unlikely with __divdi3, whose use is extremely common, but it
could easily happen with the other weird libgcc functions used for
dispatching switch statements on long long, floating point to long
long conversions, etc.)

If you want to see the issue manifest without replacing uclibc, the
easiest way would be to check *which* libgcc symbols got pulled into
libc.so.0, then modify the test code for libfoo.so to use a feature
that will pull in one of the libgcc symbols not in libc.

Rich


  reply	other threads:[~2014-01-11 22:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20131017060913.GA1957@brightrain.aerifal.cx>
2014-01-11 17:40 ` Rob Landley
2014-01-11 21:51   ` Rich Felker
2014-01-11 22:04     ` Rob Landley
2014-01-11 22:23       ` Rich Felker [this message]
2014-01-11 22:38         ` Rob Landley
2014-01-11 22:45           ` Rich Felker
2014-01-11 23:10             ` Rob Landley
2014-01-11 23:55             ` John Spencer
2014-01-12  2:35               ` Rob Landley
2014-01-12  9:54                 ` John Spencer
2014-01-12 15:33                   ` Rich Felker

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=20140111222354.GW24286@brightrain.aerifal.cx \
    --to=dalias@aerifal.cx \
    --cc=musl@lists.openwall.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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).