Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Sat, 11 Jan 2014 11:40:32 -0600
From: Rob Landley <rob@...dley.net>
To: Rich Felker <dalias@...ifal.cx>
Cc: musl@...ts.openwall.com
Subject: Re: libgcc --disable-shared test case

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

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.