Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140315000909.GK184@brightrain.aerifal.cx>
Date: Fri, 14 Mar 2014 20:09:09 -0400
From: Rich Felker <dalias@...ifal.cx>
To: musl@...ts.openwall.com
Subject: Re: Static linking of musl with code compiled using GNU
 header files

On Fri, Mar 14, 2014 at 10:37:08PM +0100, John Spencer wrote:
> David Grothe wrote:
> >I built a shim module that defined all the undefined "__" routines
> >that showed up in my link.  Then all my programs linked
> >successfully.  But when I went to run one of my daemon processes
> >it got a segv in the malloc code, as follows.
> 
> on which platform is this ? the linaro bit in your toolchain
> suggests that it is ARM. is that correct ? and which version of musl
> ?
> limited ABI compat is only there for x86 platforms.

While it's untested on anything but x86, the ABI compatibility should
be comparable on arm, mips, microblaze, and sh. OTOH powerpc is known
to be ABI-incompatible for multiple reasons (which basically amount to
the glibc powerpc ABI being really bad) and x86_64 has some minor
incompatibilities due to glibc bugs (regoff_t being the wrong size)
that we'll eventually work around by making the dynamic linker detect
glibc-linked callers and redirect calls to regexec to a fixup wrapper
(but I don't see an easy way to do the same for static linking).

> as for your problem below, it's possible that something else calls
> sbrk() messing up musl's allocator.
> you should check strace output to see if sbrk(0) is called more than once.
> also make sure that nothing pulls in glibc's libc.so.

In latest musl, sbrk is dummied out, so it's probably unlikely that
this is the issue.

> btw did you check your code against the ABI checklist that was
> pointed out earlier ?

>From nsz's email? If so, I'm not sure that's quite a "checklist". But
it's important to be aware that trying to rely on the "ABI compat"
will potentially hide problems where your program is using a glibc
feature that musl does not provide. (This would likely be caught at
compile-time if you were using the musl headers, e.g. due to missing
macro constants.)

Rich

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.