From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/1256 Path: news.gmane.org!not-for-mail From: orc Newsgroups: gmane.linux.lib.musl.general Subject: Re: Hello Date: Fri, 6 Jul 2012 16:22:05 +0800 Message-ID: <20120706162205.5c72cd6a@sibserver.ru> References: <20120607200123.402a1672@sibserver.ru> <4FD0A902.6070108@barfooze.de> <20120607231831.66c78c33@sibserver.ru> <4FD0D6D9.5080707@barfooze.de> <20120607161928.GE163@brightrain.aerifal.cx> <20120608011516.0b5fca7d@sibserver.ru> <20120608033141.GH163@brightrain.aerifal.cx> <20120706012417.5ae680f0@sibserver.ru> <20120705233457.GR544@brightrain.aerifal.cx> <20120706140601.252e4e83@sibserver.ru> <20120706062614.GS544@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1341563033 32570 80.91.229.3 (6 Jul 2012 08:23:53 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 6 Jul 2012 08:23:53 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-1257-gllmg-musl=m.gmane.org@lists.openwall.com Fri Jul 06 10:23:52 2012 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 1Sn3pO-0007Vc-Tw for gllmg-musl@plane.gmane.org; Fri, 06 Jul 2012 10:23:51 +0200 Original-Received: (qmail 27895 invoked by uid 550); 6 Jul 2012 08:23:49 -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 27810 invoked from network); 6 Jul 2012 08:23:40 -0000 In-Reply-To: <20120706062614.GS544@brightrain.aerifal.cx> X-Mailer: claws-mail Xref: news.gmane.org gmane.linux.lib.musl.general:1256 Archived-At: On Fri, 6 Jul 2012 02:26:14 -0400 Rich Felker wrote: > On Fri, Jul 06, 2012 at 02:06:01PM +0800, orc wrote: > > Here a patch, attached. It contains both missing syscalls and weak > > aliases. It does not contain glibc-specific stuff (if you want, I > > can send it too, but it looks ugly, intended only for 'run it > > successfully'). Some notes about: > > - rawmemchr() was taken from uClibc > > - ioperm() and iopl() were not necessary to make glxgears work, just > > added them because Xorg will want them > > - I don't think libc even needs xattr stuff, but glibc includes > > them. On many systems they are usually duplicated, libattr provides > > same interface > > - It seems that every function in src/locale needs it's __underscore > > alias, to match glibc api > > - there some ugly __funcname_internal aliases, don't know why glibc > > defines them in that way > > I think most of this is an artifact of some hacks they do in the glibc > headers for inlining/optimization and/or _FORTIFY_SOURCE support. > The functions it creates references to are not (AFAIK) in the LSB ABI > and thus binaries using them are non-LSB-conforming... > > > Probably you will want to add: > > - weak_aliases for __underscores > > Except most of them should be in the opposite direction. Especially > for functions like strxfrm_l where we'll eventually want the ISO C > "foo" function to depend on the POSIX "foo_l" function, the latter > will need its real name to be the __-prefixed version. > > > - weak_aliases __funcname_internal > > These are rather ugly and stupid, but seem harmless. > > > - rawmemchr() (probably your own implementation, not uClibc one) > > Indeed, I'll want to copy the existing fast code from strchr. > > > - some missing syscalls (I really misguessed number of needed > > syscalls, seems that this was a number of aliases, not syscalls) > > These look mostly fine, but the header changes are all wrong (the > declarations are not under _GNU_SOURCE control). Of course adapt the patch to be correct here. My local manpages did not say much about feature test macros. > > > glibc-specific functions and objects required to make glxgears work: > > - dlvsym() (wrapper around dlsym(), we don't need ugly symvers) > > Ugly because it needs to be written in asm and adds a useless per-arch > asm function. Perhaps we could just have dlvsym be a weak alias to > dlsym in the existing asm files... > > > - gnu_get_libc_*() > > return "not glibc"; > > > - malloc_usable_size() (returns 0 always, probably there is no code > > in musl to make it work. Definition in eglibc was cryptic for me, > > but it clearly seems to be the glibc/ptmalloc feature) > > return (*((size_t *)ptr - 1) & -2) - 2*sizeof(size_t); It will be nice to see correct implementation instead of 'always-fail', cool. > > > > - 4 function-wrappers in math code: __isnan(), __isnanf(), > > __isinf(), __isinff() > > Reasonable to add; perhaps even more efficient than the current > approach. > > There's also that function named "finite" whose name violates the > namespace and thus it cannot be in a common source file with other > stuff that could be needed by conformant code. Yes, I also did not sure about it. > > > - __xmknod() > > Ugly but this should be added; it's analogous to the __xstat junk. > > > - _IO_2_1_stdout_ -> stdout > > Very ugly, but shouldn't break anything... *looking in glibc-compat patch* I forgot this one: - A _*_chk versions of common functions like memcpy, *printf, etc. and longjmp. They are nearly same as their non-chk versions (additional arg) except that they do additional buffer overflow checks. I did quick weak_alias to non-chk versions to test that it will work. It worked, but what do you think about them? > > > gtk2 will not work that way, I checked. One library in chain > > requires libstdc++, libstdc++ defines 'unique' symbols (see manual > > page of binutils nm) which musl linker cannot handle. Additionally, > > there is much more missing symbols including missing functions. But > > plain X11 apps worked (I checked xfontsel and xlogo). > > Have you looked into building the apps/libs natively against musl > except for the nvidia binary blob, to see if the blob works under that > usage? I think that's a usage case that's a lot more applicable to > real-world usage of musl, and in fact it's probably the first real > reason anybody would be interested in having musl work with code that > was built against glibc... I mostly do building in KVM now to test how applications are portable and collect the patches that will be needed when transiting to musl-enabled system. I was busy with patching old gcc and binutils these days, since I found that musl systems by default are built with executable stack (GNU_STACK thing) enabled (binutils issue). I will try that on host of course, but I generally dislike cross-compiling even to same arch because of autotools and pkg-config (will be required by gtk2 stuff). > > Rich