From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/4657 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: Static linking of musl with code compiled using GNU header files Date: Fri, 14 Mar 2014 20:09:09 -0400 Message-ID: <20140315000909.GK184@brightrain.aerifal.cx> References: <53232493.80901@gcom.com> <20140314162957.GB27448@port70.net> <53234FE2.7040309@gcom.com> <53236EF2.4030606@gcom.com> <53237684.1070006@barfooze.de> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1394842155 25012 80.91.229.3 (15 Mar 2014 00:09:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 15 Mar 2014 00:09:15 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-4661-gllmg-musl=m.gmane.org@lists.openwall.com Sat Mar 15 01:09:25 2014 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1WOcAE-0000nf-R9 for gllmg-musl@plane.gmane.org; Sat, 15 Mar 2014 01:09:22 +0100 Original-Received: (qmail 7343 invoked by uid 550); 15 Mar 2014 00:09:21 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 7335 invoked from network); 15 Mar 2014 00:09:21 -0000 Content-Disposition: inline In-Reply-To: <53237684.1070006@barfooze.de> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:4657 Archived-At: 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