mailing list of musl libc
 help / color / mirror / code / Atom feed
From: orc <orc@sibserver.ru>
To: musl@lists.openwall.com
Subject: Re: Hello
Date: Fri, 6 Jul 2012 14:06:01 +0800	[thread overview]
Message-ID: <20120706140601.252e4e83@sibserver.ru> (raw)
In-Reply-To: <20120705233457.GR544@brightrain.aerifal.cx>

[-- Attachment #1: Type: text/plain, Size: 3542 bytes --]

On Thu, 5 Jul 2012 19:34:57 -0400
Rich Felker <dalias@aerifal.cx> wrote:

> On Fri, Jul 06, 2012 at 01:24:17AM +0800, orc wrote:
> > On Thu, 7 Jun 2012 23:31:41 -0400
> > Rich Felker <dalias@aerifal.cx> wrote:
> > 
> > > > So there is a question: will musl support this configs? Or I
> > > > will need patchelf and 'libc6-legacy' for them?
> > > 
> > > It's intended to work, but I don't know whether it does yet.
> > 
> > Did some research there last days: for, example, one that
> > proprietary drivers that nvidia ships it was required about 30
> > missing symbols, half of them are one-liners system calls, 5 were
> > glibc-specific functions that were easy to add (one of them is
> > gnu_get_libc_version() that is designed to return a plain string),
> > 4 were missing math functions that already defined as a macros in
> > math.h, rest is a forest of weak aliases around already existed
> > functions (plus two aliases to objects). That allowed me to run
> > plain unmodified X11 applications (not even gtk2 ones) and
> > accelerated glxgears without errors (The gtk2 or qt or other such
> > libraries compiled against glibc is not my target, just to prove
> > that userspace nvidia could be run with musl). If you interested, I
> > can put a patch that adds such forest of weak_alias'es to improve
> > (partly) glibc compatibility. And separate patch for missing
> > syscall wrappers.
> 
> I'm very interested in this. I'm surprised it was that easy to make it
> work, and just curious about all the aliases that were involved and
> whether they make since or whether they're hacks. Post patches or a
> report in whatever form you prefer; I'll review it and hopefully it
> can be committed without much additional fuss.

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

Probably you will want to add:
- weak_aliases for __underscores
- weak_aliases __funcname_internal
- rawmemchr() (probably your own implementation, not uClibc one)
- some missing syscalls (I really misguessed number of needed syscalls,
  seems that this was a number of aliases, not syscalls)

glibc-specific functions and objects required to make glxgears work:
- dlvsym() (wrapper around dlsym(), we don't need ugly symvers)
- gnu_get_libc_*()
- 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)
- 4 function-wrappers in math code: __isnan(), __isnanf(), __isinf(),
  __isinff()
- __xmknod()
- _IO_2_1_stdout_ -> stdout

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).

> 
> Rich


[-- Attachment #2: musl-0.9.2-misc-symbols.patch --]
[-- Type: application/octet-stream, Size: 15832 bytes --]

diff -Naur musl-0.9.2.o/include/fcntl.h musl-0.9.2/include/fcntl.h
--- musl-0.9.2.o/include/fcntl.h	2012-06-25 09:02:55.000000000 +0800
+++ musl-0.9.2/include/fcntl.h	2012-07-06 12:49:23.950799602 +0800
@@ -8,6 +8,8 @@
 #define __NEED_off_t
 #define __NEED_pid_t
 #define __NEED_mode_t
+#define __NEED_size_t
+#define __NEED_ssize_t
 
 #include <bits/alltypes.h>
 
@@ -97,6 +99,7 @@
 #define F_TEST  3
 
 int lockf(int, int, off_t);
+ssize_t splice(int, off_t, int, off_t, size_t, unsigned int);
 #endif
 
 #if defined(_GNU_SOURCE)
diff -Naur musl-0.9.2.o/include/string.h musl-0.9.2/include/string.h
--- musl-0.9.2.o/include/string.h	2012-06-25 09:02:55.000000000 +0800
+++ musl-0.9.2/include/string.h	2012-07-06 12:50:20.256799602 +0800
@@ -92,6 +92,7 @@
 char *strsep(char **, const char *);
 void *memrchr(const void *, int, size_t);
 void *mempcpy(void *, const void *, size_t);
+void *rawmemchr(const void *, int);
 #ifndef __cplusplus
 char *basename();
 #endif
diff -Naur musl-0.9.2.o/include/sys/io.h musl-0.9.2/include/sys/io.h
--- musl-0.9.2.o/include/sys/io.h	1970-01-01 07:00:00.000000000 +0700
+++ musl-0.9.2/include/sys/io.h	2012-07-06 12:49:23.950799602 +0800
@@ -0,0 +1,2 @@
+int ioperm(unsigned long, unsigned long, int);
+int iopl(int);
diff -Naur musl-0.9.2.o/include/unistd.h musl-0.9.2/include/unistd.h
--- musl-0.9.2.o/include/unistd.h	2012-06-25 09:02:55.000000000 +0800
+++ musl-0.9.2/include/unistd.h	2012-07-06 12:49:23.951799602 +0800
@@ -31,6 +31,7 @@
 #include <bits/alltypes.h>
 
 int pipe(int [2]);
+int pipe2(int [2], int);
 int close(int);
 int dup(int);
 int dup2(int, int);
diff -Naur musl-0.9.2.o/src/fcntl/fcntl.c musl-0.9.2/src/fcntl/fcntl.c
--- musl-0.9.2.o/src/fcntl/fcntl.c	2012-06-25 09:02:55.000000000 +0800
+++ musl-0.9.2/src/fcntl/fcntl.c	2012-07-06 12:49:23.951799602 +0800
@@ -24,3 +24,5 @@
 	}
 	return syscall(SYS_fcntl, fd, cmd, arg);
 }
+
+weak_alias(fcntl, __fcntl);
diff -Naur musl-0.9.2.o/src/linux/ioperm.c musl-0.9.2/src/linux/ioperm.c
--- musl-0.9.2.o/src/linux/ioperm.c	1970-01-01 07:00:00.000000000 +0700
+++ musl-0.9.2/src/linux/ioperm.c	2012-07-06 12:49:23.951799602 +0800
@@ -0,0 +1,6 @@
+#include "syscall.h"
+
+int ioperm(unsigned long from, unsigned long num, int turn_on)
+{
+	return syscall(SYS_ioperm, from, num, turn_on);
+}
diff -Naur musl-0.9.2.o/src/linux/iopl.c musl-0.9.2/src/linux/iopl.c
--- musl-0.9.2.o/src/linux/iopl.c	1970-01-01 07:00:00.000000000 +0700
+++ musl-0.9.2/src/linux/iopl.c	2012-07-06 12:49:23.951799602 +0800
@@ -0,0 +1,6 @@
+#include "syscall.h"
+
+int iopl(int level)
+{
+	return syscall(SYS_iopl, level);
+}
diff -Naur musl-0.9.2.o/src/linux/splice.c musl-0.9.2/src/linux/splice.c
--- musl-0.9.2.o/src/linux/splice.c	1970-01-01 07:00:00.000000000 +0700
+++ musl-0.9.2/src/linux/splice.c	2012-07-06 12:49:23.951799602 +0800
@@ -0,0 +1,7 @@
+#include <sys/types.h>
+#include "syscall.h"
+
+ssize_t splice(int fd_in, off_t *off_in, int fd_out, off_t *off_out, size_t len, unsigned int flags)
+{
+	return syscall(SYS_splice, fd_in, off_in, fd_out, off_out, len, flags);
+}
diff -Naur musl-0.9.2.o/src/linux/xattr.c musl-0.9.2/src/linux/xattr.c
--- musl-0.9.2.o/src/linux/xattr.c	1970-01-01 07:00:00.000000000 +0700
+++ musl-0.9.2/src/linux/xattr.c	2012-07-06 12:49:23.951799602 +0800
@@ -0,0 +1,47 @@
+#include <sys/types.h>
+#include "syscall.h"
+
+ssize_t getxattr(const char *path, const char *name, void *value, size_t size)
+{
+	return syscall(SYS_getxattr, path, name, value, size);
+}
+
+ssize_t lgetxattr(const char *path, const char *name, void *value, size_t size)
+{
+	return syscall(SYS_lgetxattr, path, name, value, size);
+}
+
+ssize_t fgetxattr(int filedes, const char *name, void *value, size_t size)
+{
+	return syscall(SYS_fgetxattr, filedes, name, value, size);
+}
+
+ssize_t listxattr(const char *path, char *list, size_t size)
+{
+	return syscall(SYS_listxattr, path, list, size);
+}
+
+ssize_t llistxattr(const char *path, char *list, size_t size)
+{
+	return syscall(SYS_llistxattr, path, list, size);
+}
+
+ssize_t flistxattr(int filedes, char *list, size_t size)
+{
+	return syscall(SYS_flistxattr, filedes, list, size);
+}
+
+int setxattr(const char *path, const char *name, const void *value, size_t size, int flags)
+{
+	return syscall(SYS_setxattr, path, name, value, size, flags);
+}
+
+int lsetxattr(const char *path, const char *name, const void *value, size_t size, int flags)
+{
+	return syscall(SYS_lsetxattr, path, name, value, size, flags);
+}
+
+int fsetxattr(int filedes, const char *name, const void *value, size_t size, int flags)
+{
+	return syscall(SYS_fsetxattr, filedes, name, value, size, flags);
+}
diff -Naur musl-0.9.2.o/src/locale/duplocale.c musl-0.9.2/src/locale/duplocale.c
--- musl-0.9.2.o/src/locale/duplocale.c	2012-06-25 09:02:55.000000000 +0800
+++ musl-0.9.2/src/locale/duplocale.c	2012-07-06 12:49:23.951799602 +0800
@@ -1,6 +1,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include "locale_impl.h"
+#include "libc.h"
 
 locale_t duplocale(locale_t old)
 {
@@ -9,3 +10,5 @@
 	if (new && old != LC_GLOBAL_LOCALE) memcpy(new, old, sizeof *new);
 	return new;
 }
+
+weak_alias(duplocale, __duplocale);
diff -Naur musl-0.9.2.o/src/locale/freelocale.c musl-0.9.2/src/locale/freelocale.c
--- musl-0.9.2.o/src/locale/freelocale.c	2012-06-25 09:02:55.000000000 +0800
+++ musl-0.9.2/src/locale/freelocale.c	2012-07-06 12:49:23.952799602 +0800
@@ -1,7 +1,10 @@
 #include <stdlib.h>
 #include "locale_impl.h"
+#include "libc.h"
 
 void freelocale(locale_t l)
 {
 	free(l);
 }
+
+weak_alias(freelocale, __freelocale);
diff -Naur musl-0.9.2.o/src/locale/iswctype_l.c musl-0.9.2/src/locale/iswctype_l.c
--- musl-0.9.2.o/src/locale/iswctype_l.c	2012-06-25 09:02:55.000000000 +0800
+++ musl-0.9.2/src/locale/iswctype_l.c	2012-07-06 12:49:23.952799602 +0800
@@ -1,6 +1,9 @@
 #include <wctype.h>
+#include "libc.h"
 
 int iswctype_l(wint_t c, wctype_t t, locale_t l)
 {
 	return iswctype(c, t);
 }
+
+weak_alias(iswctype_l, __iswctype_l);
diff -Naur musl-0.9.2.o/src/locale/newlocale.c musl-0.9.2/src/locale/newlocale.c
--- musl-0.9.2.o/src/locale/newlocale.c	2012-06-25 09:02:55.000000000 +0800
+++ musl-0.9.2/src/locale/newlocale.c	2012-07-06 12:49:23.952799602 +0800
@@ -1,6 +1,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include "locale_impl.h"
+#include "libc.h"
 
 locale_t newlocale(int mask, const char *name, locale_t base)
 {
@@ -9,3 +10,5 @@
 	if (!base) base = calloc(1, sizeof *base);
 	return base;
 }
+
+weak_alias(newlocale, __newlocale);
diff -Naur musl-0.9.2.o/src/locale/nl_langinfo_l.c musl-0.9.2/src/locale/nl_langinfo_l.c
--- musl-0.9.2.o/src/locale/nl_langinfo_l.c	2012-06-25 09:02:55.000000000 +0800
+++ musl-0.9.2/src/locale/nl_langinfo_l.c	2012-07-06 12:49:23.952799602 +0800
@@ -1,7 +1,10 @@
 #include <locale.h>
 #include <langinfo.h>
+#include "libc.h"
 
 char *nl_langinfo_l(nl_item item, locale_t l)
 {
 	return nl_langinfo(item);
 }
+
+weak_alias(nl_langinfo_l, __nl_langinfo_l);
diff -Naur musl-0.9.2.o/src/locale/strcoll_l.c musl-0.9.2/src/locale/strcoll_l.c
--- musl-0.9.2.o/src/locale/strcoll_l.c	2012-06-25 09:02:55.000000000 +0800
+++ musl-0.9.2/src/locale/strcoll_l.c	2012-07-06 12:49:23.952799602 +0800
@@ -1,7 +1,10 @@
 #include <string.h>
 #include <locale.h>
+#include "libc.h"
 
 int strcoll_l(const char *l, const char *r, locale_t loc)
 {
 	return strcoll(l, r);
 }
+
+weak_alias(strcoll_l, __strcoll_l);
diff -Naur musl-0.9.2.o/src/locale/strftime_l.c musl-0.9.2/src/locale/strftime_l.c
--- musl-0.9.2.o/src/locale/strftime_l.c	2012-06-25 09:02:55.000000000 +0800
+++ musl-0.9.2/src/locale/strftime_l.c	2012-07-06 12:49:23.952799602 +0800
@@ -1,7 +1,10 @@
 #include <locale.h>
 #include <time.h>
+#include "libc.h"
 
 size_t strftime_l(char *s, size_t n, const char *f, const struct tm *tm, locale_t l)
 {
 	return strftime(s, n, f, tm);
 }
+
+weak_alias(strftime_l, __strftime_l);
diff -Naur musl-0.9.2.o/src/locale/strxfrm_l.c musl-0.9.2/src/locale/strxfrm_l.c
--- musl-0.9.2.o/src/locale/strxfrm_l.c	2012-06-25 09:02:55.000000000 +0800
+++ musl-0.9.2/src/locale/strxfrm_l.c	2012-07-06 12:49:23.952799602 +0800
@@ -1,6 +1,9 @@
 #include <string.h>
+#include "libc.h"
 
 size_t strxfrm_l(char *dest, const char *src, size_t n, locale_t l)
 {
 	return strxfrm(dest, src, n);
 }
+
+weak_alias(strxfrm_l, __strxfrm_l);
diff -Naur musl-0.9.2.o/src/locale/towlower_l.c musl-0.9.2/src/locale/towlower_l.c
--- musl-0.9.2.o/src/locale/towlower_l.c	2012-06-25 09:02:55.000000000 +0800
+++ musl-0.9.2/src/locale/towlower_l.c	2012-07-06 12:49:23.952799602 +0800
@@ -1,6 +1,9 @@
 #include <wctype.h>
+#include "libc.h"
 
 wint_t towlower_l(wint_t c, locale_t l)
 {
 	return towlower(c);
 }
+
+weak_alias(towlower_l, __towlower_l);
diff -Naur musl-0.9.2.o/src/locale/towupper_l.c musl-0.9.2/src/locale/towupper_l.c
--- musl-0.9.2.o/src/locale/towupper_l.c	2012-06-25 09:02:55.000000000 +0800
+++ musl-0.9.2/src/locale/towupper_l.c	2012-07-06 12:49:23.952799602 +0800
@@ -1,6 +1,9 @@
 #include <wctype.h>
+#include "libc.h"
 
 wint_t towupper_l(wint_t c, locale_t l)
 {
 	return towupper(c);
 }
+
+weak_alias(towupper_l, __towupper_l);
diff -Naur musl-0.9.2.o/src/locale/uselocale.c musl-0.9.2/src/locale/uselocale.c
--- musl-0.9.2.o/src/locale/uselocale.c	2012-06-25 09:02:55.000000000 +0800
+++ musl-0.9.2/src/locale/uselocale.c	2012-07-06 12:49:23.953799602 +0800
@@ -1,5 +1,6 @@
 #include "locale_impl.h"
 #include "pthread_impl.h"
+#include "libc.h"
 
 locale_t uselocale(locale_t l)
 {
@@ -8,3 +9,5 @@
 	if (l) self->locale = l;
 	return old;
 }
+
+weak_alias(uselocale, __uselocale);
diff -Naur musl-0.9.2.o/src/locale/wcscoll_l.c musl-0.9.2/src/locale/wcscoll_l.c
--- musl-0.9.2.o/src/locale/wcscoll_l.c	2012-06-25 09:02:55.000000000 +0800
+++ musl-0.9.2/src/locale/wcscoll_l.c	2012-07-06 12:49:23.953799602 +0800
@@ -1,6 +1,9 @@
 #include <wchar.h>
+#include "libc.h"
 
 int wcscoll_l(const wchar_t *l, const wchar_t *r, locale_t locale)
 {
 	return wcscoll(l, r);
 }
+
+weak_alias(wcscoll_l, __wcscoll_l);
diff -Naur musl-0.9.2.o/src/locale/wcsxfrm_l.c musl-0.9.2/src/locale/wcsxfrm_l.c
--- musl-0.9.2.o/src/locale/wcsxfrm_l.c	2012-06-25 09:02:55.000000000 +0800
+++ musl-0.9.2/src/locale/wcsxfrm_l.c	2012-07-06 12:49:23.953799602 +0800
@@ -1,6 +1,9 @@
 #include <wchar.h>
+#include "libc.h"
 
 size_t wcsxfrm_l(wchar_t *dest, const wchar_t *src, size_t n, locale_t locale)
 {
 	return wcsxfrm(dest, src, n);
 }
+
+weak_alias(wcsxfrm_l, __wcsxfrm_l);
diff -Naur musl-0.9.2.o/src/locale/wctype_l.c musl-0.9.2/src/locale/wctype_l.c
--- musl-0.9.2.o/src/locale/wctype_l.c	2012-06-25 09:02:55.000000000 +0800
+++ musl-0.9.2/src/locale/wctype_l.c	2012-07-06 12:49:23.953799602 +0800
@@ -1,6 +1,9 @@
 #include <wctype.h>
+#include "libc.h"
 
 wctype_t wctype_l(const char *s, locale_t l)
 {
 	return wctype(s);
 }
+
+weak_alias(wctype_l, __wctype_l);
diff -Naur musl-0.9.2.o/src/math/__fpclassify.c musl-0.9.2/src/math/__fpclassify.c
--- musl-0.9.2.o/src/math/__fpclassify.c	2012-06-25 09:02:55.000000000 +0800
+++ musl-0.9.2/src/math/__fpclassify.c	2012-07-06 13:05:11.344799602 +0800
@@ -8,3 +8,10 @@
 	if (e==0x7ff) return u.bits<<12 ? FP_NAN : FP_INFINITE;
 	return FP_NORMAL;
 }
+
+int finite(double x)
+{
+	return isfinite(x);
+}
+
+weak_alias(finite, __finite);
diff -Naur musl-0.9.2.o/src/select/poll.c musl-0.9.2/src/select/poll.c
--- musl-0.9.2.o/src/select/poll.c	2012-06-25 09:02:55.000000000 +0800
+++ musl-0.9.2/src/select/poll.c	2012-07-06 12:49:23.953799602 +0800
@@ -6,3 +6,5 @@
 {
 	return syscall_cp(SYS_poll, fds, n, timeout);
 }
+
+weak_alias(poll, __poll);
diff -Naur musl-0.9.2.o/src/signal/i386/sigsetjmp.s musl-0.9.2/src/signal/i386/sigsetjmp.s
--- musl-0.9.2.o/src/signal/i386/sigsetjmp.s	2012-06-25 09:02:55.000000000 +0800
+++ musl-0.9.2/src/signal/i386/sigsetjmp.s	2012-07-06 12:49:23.953799602 +0800
@@ -1,6 +1,9 @@
 .global sigsetjmp
 .type sigsetjmp,@function
+.weak __sigsetjmp
+.type __sigsetjmp,@function
 sigsetjmp:
+__sigsetjmp:
 	mov 4(%esp),%eax
 	mov 8(%esp),%ecx
 	mov %ecx,24(%eax)
diff -Naur musl-0.9.2.o/src/signal/x86_64/sigsetjmp.s musl-0.9.2/src/signal/x86_64/sigsetjmp.s
--- musl-0.9.2.o/src/signal/x86_64/sigsetjmp.s	2012-06-25 09:02:55.000000000 +0800
+++ musl-0.9.2/src/signal/x86_64/sigsetjmp.s	2012-07-06 12:49:23.955799602 +0800
@@ -1,7 +1,10 @@
 /* Copyright 2011-2012 Nicholas J. Kain, licensed under standard MIT license */
 .global sigsetjmp
 .type sigsetjmp,@function
+.weak __sigsetjmp
+.type __sigsetjmp,@function
 sigsetjmp:
+__sigsetjmp:
 	andl %esi,%esi
 	movq %rsi,64(%rdi)
 	jz 1f
diff -Naur musl-0.9.2.o/src/stdio/fscanf.c musl-0.9.2/src/stdio/fscanf.c
--- musl-0.9.2.o/src/stdio/fscanf.c	2012-06-25 09:02:55.000000000 +0800
+++ musl-0.9.2/src/stdio/fscanf.c	2012-07-06 12:49:23.955799602 +0800
@@ -1,5 +1,6 @@
 #include <stdio.h>
 #include <stdarg.h>
+#include "libc.h"
 
 int fscanf(FILE *f, const char *fmt, ...)
 {
@@ -10,3 +11,5 @@
 	va_end(ap);
 	return ret;
 }
+
+weak_alias(fscanf, __isoc99_fscanf);
diff -Naur musl-0.9.2.o/src/stdio/sscanf.c musl-0.9.2/src/stdio/sscanf.c
--- musl-0.9.2.o/src/stdio/sscanf.c	2012-06-25 09:02:55.000000000 +0800
+++ musl-0.9.2/src/stdio/sscanf.c	2012-07-06 12:49:23.955799602 +0800
@@ -1,5 +1,6 @@
 #include <stdio.h>
 #include <stdarg.h>
+#include "libc.h"
 
 int sscanf(const char *s, const char *fmt, ...)
 {
@@ -10,3 +11,5 @@
 	va_end(ap);
 	return ret;
 }
+
+weak_alias(sscanf, __isoc99_sscanf);
diff -Naur musl-0.9.2.o/src/stdlib/strtod.c musl-0.9.2/src/stdlib/strtod.c
--- musl-0.9.2.o/src/stdlib/strtod.c	2012-06-25 09:02:55.000000000 +0800
+++ musl-0.9.2/src/stdlib/strtod.c	2012-07-06 12:49:23.955799602 +0800
@@ -2,6 +2,7 @@
 #include "shgetc.h"
 #include "floatscan.h"
 #include "stdio_impl.h"
+#include "libc.h"
 
 static long double strtox(const char *s, char **p, int prec)
 {
@@ -30,3 +31,5 @@
 {
 	return strtox(s, p, 2);
 }
+
+weak_alias(strtod, __strtod_internal);
diff -Naur musl-0.9.2.o/src/stdlib/strtol.c musl-0.9.2/src/stdlib/strtol.c
--- musl-0.9.2.o/src/stdlib/strtol.c	2012-06-25 09:02:55.000000000 +0800
+++ musl-0.9.2/src/stdlib/strtol.c	2012-07-06 12:49:23.955799602 +0800
@@ -1,6 +1,7 @@
 #include "stdio_impl.h"
 #include "intscan.h"
 #include "shgetc.h"
+#include "libc.h"
 
 static unsigned long long strtox(const char *s, char **p, int base, unsigned long long lim)
 {
@@ -51,3 +52,8 @@
 {
 	return strtoull(s, p, base);
 }
+
+weak_alias(strtoll, __strtoll_internal);
+weak_alias(strtol, __strtol_internal);
+weak_alias(strtoul, __strtoul_internal);
+weak_alias(strtoull, __strtoull_internal);
diff -Naur musl-0.9.2.o/src/string/rawmemchr.c musl-0.9.2/src/string/rawmemchr.c
--- musl-0.9.2.o/src/string/rawmemchr.c	1970-01-01 07:00:00.000000000 +0700
+++ musl-0.9.2/src/string/rawmemchr.c	2012-07-06 12:49:23.956799602 +0800
@@ -0,0 +1,14 @@
+// Taken from uClibc libc/string/rawmemchr.c
+#include <string.h>
+#include "libc.h"
+
+void *rawmemchr(const void *s, int c)
+{
+	register const unsigned char *r = s;
+
+	while (*r != ((unsigned char)c)) ++r;
+
+	return (void *) r;	/* silence the warning */
+}
+
+weak_alias(rawmemchr, __rawmemchr);
diff -Naur musl-0.9.2.o/src/string/strndup.c musl-0.9.2/src/string/strndup.c
--- musl-0.9.2.o/src/string/strndup.c	2012-06-25 09:02:55.000000000 +0800
+++ musl-0.9.2/src/string/strndup.c	2012-07-06 12:49:23.956799602 +0800
@@ -1,5 +1,6 @@
 #include <stdlib.h>
 #include <string.h>
+#include "libc.h"
 
 char *strndup(const char *s, size_t n)
 {
@@ -10,3 +11,5 @@
 	d[l] = 0;
 	return d;
 }
+
+weak_alias(strndup, __strndup);
diff -Naur musl-0.9.2.o/src/unistd/pipe.c musl-0.9.2/src/unistd/pipe.c
--- musl-0.9.2.o/src/unistd/pipe.c	2012-06-25 09:02:55.000000000 +0800
+++ musl-0.9.2/src/unistd/pipe.c	2012-07-06 12:49:23.956799602 +0800
@@ -5,3 +5,8 @@
 {
 	return syscall(SYS_pipe, fd);
 }
+
+int pipe2(int fd[2], int flg)
+{
+	return syscall(SYS_pipe, fd, flg);
+}

  reply	other threads:[~2012-07-06  6:06 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-07 12:01 Hello orc
2012-06-07 13:13 ` Hello John Spencer
2012-06-07 15:18   ` Hello orc
2012-06-07 16:29     ` Hello John Spencer
2012-06-07 16:19       ` Hello Rich Felker
2012-06-07 17:15         ` Hello orc
2012-06-08  3:31           ` Hello Rich Felker
2012-06-08  5:49             ` Hello Isaac Dunham
2012-06-08 12:28             ` Hello aep
2012-06-08 14:14               ` Hello Rich Felker
2012-06-08 16:17                 ` Hello aep
2012-06-08 16:11                   ` Hello Rich Felker
2012-06-09  2:05                   ` Hello Isaac Dunham
2012-07-05 17:24             ` Hello orc
2012-07-05 23:34               ` Hello Rich Felker
2012-07-06  6:06                 ` orc [this message]
2012-07-06  6:26                   ` Hello Rich Felker
2012-07-06  8:22                     ` Hello orc
2012-07-06 23:14                       ` Hello idunham
2012-07-07  0:57                         ` Hello Rich Felker
2012-07-07  8:07                         ` Hello orc
2012-07-07 15:54                           ` Hello idunham
2012-07-08  9:09                             ` Hello orc
2012-06-07 17:45         ` Hello Christian Neukirchen
2012-06-07 18:03       ` Hello Jens Staal
2012-06-07 19:10         ` Hello John Spencer
2012-06-07 17:33     ` Hello Jens Staal
2012-06-07 17:59       ` Hello orc
2012-06-20  7:29     ` Hello orc
2012-06-23  1:43       ` Hello idunham
2012-06-23  1:51         ` Hello Rich Felker
2012-06-25 12:09           ` Hello orc
2012-06-25 11:59         ` Hello orc
2012-06-25 13:53           ` Hello idunham
2012-07-22 23:09 Hello idunham
2012-07-23  2:01 ` Hello Rich Felker
2012-07-23  3:49   ` Hello idunham
2012-07-23 21:01     ` Hello Rich Felker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120706140601.252e4e83@sibserver.ru \
    --to=orc@sibserver.ru \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).