From: Rich Felker <dalias@aerifal.cx>
To: musl@lists.openwall.com
Subject: Re: Re: libgcc --disable-shared test case
Date: Sat, 11 Jan 2014 16:51:06 -0500 [thread overview]
Message-ID: <20140111215106.GV24286@brightrain.aerifal.cx> (raw)
In-Reply-To: <1389462032.1176.18@driftwood>
On Sat, Jan 11, 2014 at 11:40:32AM -0600, Rob Landley wrote:
> On 10/17/2013 01:09:13 AM, Rich Felker wrote:
> >On i386 or any arch where libgcc functions are needed for 64-bit
> >division, the following should reproduce the failure if libgcc was
> >built with --disable-shared (which disables visibility):
> >
> >gcc -O2 -shared -o libfoo.so lib_v1.c
> >gcc -O2 main.c ./libfoo.so
> >./a.out # ok
> >gcc -O2 -shared -o libfoo.so lib_v2.c
> >./a.out # fails with symbol errors
> >
> >Rich
>
> lib_v1.c:
> long long foo(long long x) { return x/10; }
>
> lib_v2.c:
> long long foo(long long x) { return x/16; }
>
> main.c:
> #include <stdio.h>
> extern long long foo(long long);
> int main() { printf("%lld\n", foo(100)/10); }
>
> Ok, I just tested this again. With lib_v1.c, the one built with my
> simple-cross-compiler toolchain printed 1, and the lib_v2.c printed
> 0. (I believe you said the error was a link failure?)
>
> I had to copy the resulting a.out and libfoo.so into
> simple-root-filesystem (which was built with the simple cross
> compiler and doesn't contain a native compiler) to run it in a
> chroot because the host hasn't got uClibc libraries installed in it,
> hence no libc.so.0 for the dynamic link...
>
> Looks like my toolchain doesn't exhibit this behavior? (Not after I
> hacked the hell out of the libgcc.a build, anyway...)
What arch? I would expect this to show up on i386 but not x86_64,
since the latter has native division and libgcc functions won't be
needed. It could also be an issue of -O level if gcc decided to use
long division instead of bitshift to implement /16. Or it might be
something completely different.
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.
Rich
next prev parent reply other threads:[~2014-01-11 21:51 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 [this message]
2014-01-11 22:04 ` Rob Landley
2014-01-11 22:23 ` Rich Felker
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=20140111215106.GV24286@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).