Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sat, 11 Jan 2014 16:51:06 -0500
From: Rich Felker <>
Subject: Re: Re: libgcc --disable-shared test case

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 lib_v1.c
> >gcc -O2 main.c ./
> >./a.out # ok
> >gcc -O2 -shared -o 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 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 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, a.out, and maybe
even libgcc.a, I can probably figure out what's going on.


Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.