From: Rob Landley <rob@landley.net>
To: Rich Felker <dalias@aerifal.cx>
Cc: musl@lists.openwall.com
Subject: Re: libgcc --disable-shared test case
Date: Sat, 11 Jan 2014 11:40:32 -0600 [thread overview]
Message-ID: <1389462032.1176.18@driftwood> (raw)
In-Reply-To: <20131017060913.GA1957@brightrain.aerifal.cx> (from dalias@aerifal.cx on Thu Oct 17 01:09:13 2013)
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...)
(I'm sure I tested this before, but didn't write the result down.
There's a reason I blog to myself so much when I'm not buried by
$DAYJOB...)
Rob
next parent reply other threads:[~2014-01-11 17:40 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 [this message]
2014-01-11 21:51 ` Rich Felker
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=1389462032.1176.18@driftwood \
--to=rob@landley.net \
--cc=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).