clean:
rm -f sizeof*.o sizeof-glibc sizeof-musl sizeof.diff tab_*.html
-tables: tags syms
- MUSL=$(MUSL) ./tab_c99.sh
- MUSL=$(MUSL) ./tab_posix.sh
-
-tags:
- MUSL=$(MUSL) ./maketags.sh
-
-syms:
- MUSL=$(MUSL) ./makesyms.sh
+tables:
+ MUSL=$(MUSL) ./update.sh
sizeof: sizeof-glibc sizeof-musl
./sizeof-glibc >data/glibc.sizeof
# when compiling with pcc
#PCC=`pcc -v foobar.o 2>&1 |sed -n 's,.* \([^ ]*\)/lib/crtbegin.o.*,\1,p'`
+sizeof.c:
+ ./sizeof.sh
+
sizeof-glibc: sizeof.c
- gcc -o $@ $<
+ gcc -std=gnu99 -o $@ $<
sizeof-musl: sizeof.c
- gcc -std=gnu99 -nostdinc -fno-stack-protector -isystem $(MUSL)/include -isystem $(LIBGCC) -c -o $@.o $<
- ld -o $@ $@.o $(MUSL)/lib/crti.o $(MUSL)/lib/crt1.o $(MUSL)/lib/crtn.o -L$(MUSL)/lib -lc -L$(LIBGCC) -lgcc -nostdlib
+ gcc -std=gnu99 -nostdinc -fno-stack-protector -isystem $(MUSL)/include -isystem $(LIBGCC) -isystem /usr/include -c -o $@.o $<
+ ld -o $@ $@.o -X -d -e _start -Bstatic $(MUSL)/lib/crti.o $(MUSL)/lib/crt1.o $(MUSL)/lib/crtn.o -L$(MUSL)/lib -lc -L$(LIBGCC) -lgcc -nostdlib
# ld -o $@ $@.o $(MUSL)/lib/crti.o $(MUSL)/lib/crt1.o $(MUSL)/lib/crtn.o -L$(MUSL)/lib -lc -dynamic-linker $(MUSL)/lib/libc.so -L$(LIBGCC) -lgcc -nostdlib
# pcc -nostdinc -isystem $(MUSL)/include -isystem $(PCC)/include -c -o $@.o $<
# ld -X -d -e _start -Bstatic -o $@ $@.o $(MUSL)/lib/crti.o $(MUSL)/lib/crt1.o $(PCC)/lib/crtbegin.o $(PCC)/lib/crtend.o -L$(MUSL)/lib -lc -L$(PCC)/lib -lpcc -nostdlib
#define _GNU_SOURCE 1
-#define _LARGEFILE64_SOURCE 1
-#define _FILE_OFFSET_BITS 64
-
+#define _LARGEFILE64_SOURCE 1
+#define _FILE_OFFSET_BITS 64
#include <stddef.h>
-#include <stdint.h>
#include <sys/types.h>
+#include <aio.h>
+#include <alloca.h>
+#include <arpa/inet.h>
#include <arpa/nameser.h>
-//#include <bits/alltypes.h>
-//#include <bits/fenv.h>
-#include <fenv.h>
-//#include <bits/in.h>
-#include <netinet/in.h>
-//#include <bits/ioctl.h>
-#include <sys/ioctl.h>
-//#include <bits/ipc.h>
-#include <sys/ipc.h>
-//#include <bits/msg.h>
-#include <sys/msg.h>
-//#include <bits/pthread.h>
-#include <pthread.h>
-//#include <bits/setjmp.h>
-//#include <bits/shm.h>
-#include <sys/shm.h>
-//#include <bits/signal.h>
-//#include <bits/socket.h>
-//#include <bits/stat.h>
-#include <sys/stat.h>
-//#include <bits/statfs.h>
-#include <sys/statfs.h>
-//#include <bits/termios.h>
-//#include <bits/user.h>
-#include <sys/user.h>
+#include <arpa/telnet.h>
+#include <assert.h>
+#include <byteswap.h>
+#include <cpio.h>
+#include <ctype.h>
#include <dirent.h>
+#include <dlfcn.h>
#include <elf.h>
+#include <endian.h>
+#include <err.h>
+#include <errno.h>
#include <fcntl.h>
+//#include <features.h>
+#include <fenv.h>
+#include <float.h>
+#include <fnmatch.h>
#include <ftw.h>
#include <getopt.h>
#include <glob.h>
#include <grp.h>
#include <iconv.h>
#include <inttypes.h>
+#include <iso646.h>
+#include <langinfo.h>
+#include <libgen.h>
+#include <libintl.h>
+#include <limits.h>
#include <linux/fb.h>
#include <linux/kd.h>
#include <linux/loop.h>
+#include <linux/version.h>
#include <linux/vt.h>
#include <locale.h>
+#include <malloc.h>
+#include <math.h>
#include <mntent.h>
#include <mqueue.h>
#include <net/ethernet.h>
#include <netinet/ip.h>
#include <netinet/ip6.h>
#include <netinet/ip_icmp.h>
+#include <netinet/tcp.h>
#include <netinet/udp.h>
#include <netpacket/packet.h>
#include <nl_types.h>
+#include <paths.h>
#include <poll.h>
+#include <pthread.h>
+#include <pty.h>
#include <pwd.h>
#include <regex.h>
#include <resolv.h>
#include <sched.h>
+#include <search.h>
#include <semaphore.h>
#include <setjmp.h>
#include <shadow.h>
#include <signal.h>
#include <spawn.h>
+#include <stdarg.h>
#include <stdbool.h>
+#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
+#include <stdio_ext.h>
#include <stdlib.h>
+#include <string.h>
+#include <strings.h>
+#include <stropts.h>
#include <sys/epoll.h>
#include <sys/eventfd.h>
+#include <sys/file.h>
#include <sys/inotify.h>
+#include <sys/ioctl.h>
+#include <sys/ipc.h>
+#include <sys/kd.h>
+#include <sys/klog.h>
+#include <sys/mman.h>
+#include <sys/mount.h>
#include <sys/msg.h>
+#include <sys/param.h>
+#include <sys/poll.h>
+#include <sys/prctl.h>
#include <sys/procfs.h>
+#include <sys/ptrace.h>
+#include <sys/reboot.h>
+#include <sys/reg.h>
#include <sys/resource.h>
#include <sys/select.h>
#include <sys/sem.h>
+#include <sys/sendfile.h>
#include <sys/shm.h>
#include <sys/signalfd.h>
#include <sys/socket.h>
+#include <sys/soundcard.h>
+#include <sys/stat.h>
+#include <sys/statfs.h>
+#include <sys/statvfs.h>
+#include <sys/stropts.h>
+#include <sys/swap.h>
+#include <sys/syscall.h>
+#include <sys/sysctl.h>
#include <sys/sysinfo.h>
+#include <sys/syslog.h>
+#include <sys/sysmacros.h>
#include <sys/time.h>
#include <sys/times.h>
#include <sys/timex.h>
#include <sys/types.h>
+#include <sys/ucontext.h>
+#include <sys/uio.h>
#include <sys/un.h>
+#include <sys/user.h>
#include <sys/utsname.h>
+#include <sys/vfs.h>
+#include <sys/vt.h>
#include <sys/wait.h>
+#include <sysexits.h>
#include <syslog.h>
+#include <tar.h>
#include <termios.h>
#include <time.h>
+#include <ucontext.h>
+#include <ulimit.h>
+#include <unistd.h>
#include <utime.h>
+#include <utmp.h>
#include <utmpx.h>
#include <wchar.h>
+#include <wctype.h>
#include <wordexp.h>
#define p(x) printf("%s\t%u\n", #x, sizeof(x));
int main(){
+p(ACTION)
//p(CODE)
//p(DIR)
+p(ENTRY)
p(Elf32_Addr)
p(Elf32_Conflict)
p(Elf32_Dyn)
p(Elf_Options_Hw)
//p(FILE)
p(HEADER)
+p(VISIT)
p(__uint16_t)
p(__uint32_t)
p(__uint64_t)
p(dev_t)
p(div_t)
p(elf_fpregset_t)
-//p(elf_fpxregset_t)
+p(elf_fpregset_t)
+p(elf_fpxregset_t)
p(elf_greg_t)
p(elf_gregset_t)
p(epoll_data_t)
p(fpos_t)
p(fsblkcnt_t)
p(fsfilcnt_t)
+p(fsid_t)
p(gid_t)
p(glob_t)
p(iconv_t)
p(rlim_t)
p(sa_family_t)
p(scrnmap_t)
-//p(sem_t)
+p(sem_t)
p(sig_atomic_t)
p(sighandler_t)
p(siginfo_t)
//p(struct __ucontext)
p(struct _ns_flagdata)
p(struct addrinfo)
+p(struct aiocb)
p(struct arpd_request)
p(struct arphdr)
p(struct arpreq)
p(struct arpreq_old)
+p(struct bandinfo)
p(struct cmsghdr)
p(struct console_font_op)
p(struct consolefontdesc)
p(struct sockaddr_un)
p(struct spwd)
p(struct stat)
-//p(struct statvfs)
+p(struct statfs)
+p(struct statvfs)
+p(struct str_list)
+p(struct str_mlist)
+p(struct strbuf)
+p(struct strfdinsert)
+p(struct strioctl)
+p(struct strpeek)
+p(struct strrecvfd)
p(struct sysinfo)
p(struct termios)
p(struct timespec)
p(struct unipair)
p(struct user)
p(struct user_fpregs_struct)
-//p(struct user_fpxregs_struct)
+p(struct user_fpxregs_struct)
p(struct user_regs_struct)
p(struct utimbuf)
p(struct utmpx)
p(union sigval)
p(ushort)
p(va_list)
-p(wchar_t)
-//p(wctrans_t)
-//p(wctype_t)
+p(va_list)
+p(wctrans_t)
+p(wctype_t)
p(wint_t)
p(wordexp_t)
+p(wchar_t)
return 0;}
--- /dev/null
+#!/bin/sh
+
+export LC_ALL=C
+MUSL=${MUSL:-../musl}
+
+awk -F'\t' '$3 ~ /^[sut]$/ {
+ print $1
+}' data/musl.tags >/tmp/m.type
+echo 'wchar_t' >>/tmp/m.type
+
+(
+ cd $MUSL/include
+ find . -name '*.h' | sed 's,^\./,,' >/tmp/m.header
+)
+
+echo '#define _GNU_SOURCE 1' >sizeof.c
+echo '#define _LARGEFILE64_SOURCE 1' >>sizeof.c
+echo '#define _FILE_OFFSET_BITS 64' >>sizeof.c
+echo '#include <stddef.h>' >>sizeof.c
+echo '#include <sys/types.h>' >>sizeof.c
+echo '' >>sizeof.c
+
+sort /tmp/m.header |uniq |awk '
+ /^features\.h$/ { printf "//" }
+ { print "#include <" $0 ">" }' >>sizeof.c
+echo '#define p(x) printf("%s\\t%u\\n", #x, sizeof(x));' >>sizeof.c
+echo 'int main(){' >>sizeof.c
+sed 's/.*/p(&)/' /tmp/m.type |awk '
+ /p\(CODE\)/ ||
+ /p\(DIR\)/ ||
+ /p\(FILE\)/ ||
+ /p\(struct __CODE\)/ ||
+ /p\(struct __fpstate\)/ ||
+ /p\(struct __ptcb\)/ ||
+ /p\(struct __siginfo\)/ ||
+ /p\(struct __ucontext\)/ ||
+ /p\(struct in6_mutinfo\)/ ||
+ /p\(struct npttimeval\)/ { printf "//" }
+ { print }' >>sizeof.c
+echo 'return 0;}' >>sizeof.c
+
<h3>musl vs c99 api</h3>
-<h4>commit</h4><p>commit <a href="http://git.etalabs.net/cgi-bin/gitweb.cgi?p=musl;a=commit;h=03a8362930c3c4fe49ee6b9cb2ba9f28153b15d3">03a8362930c3c4fe49ee6b9cb2ba9f28153b15d3</a><br>Date: Tue Sep 20 10:58:18 2011 -0400<br><br> fix broken siginfo_t with _GNU_SOURCE defined<br> <br> this bug was introduced in a recent patch. the problem we're working<br> around is that broken GNU software wants to use "struct siginfo"<br> rather than "siginfo_t", but "siginfo" is not in the reserved<br> namespace and thus not legal for the standard header to use.
+<h4>commit</h4><p>commit <a href="http://git.etalabs.net/cgi-bin/gitweb.cgi?p=musl;a=commit;h=2318207adcad74283881ffcefbad92797a2495aa">2318207adcad74283881ffcefbad92797a2495aa</a><br>Date: Tue Sep 20 12:14:06 2011 -0400<br><br> fix incorrect include guard in mqueue.h
<h4>legend</h4><ul><li>status: musl implementation status summary<ul><li>(empty) - implemented<li>nosym - prototype found in include files (see decl) but not in libc.a (see sym)<li>nodecl - symbol is in libc.a but not declared in a public header<li>missing - neither in include files (see decl) nor in libc.a (see sym)</ul><li>sym: external symbol kind as found by `nm libc.a` (symbol kind only reported once)<ul><li>C - symbol is common (uninitialized data)<li>D - symbol is in the initialized data section<li>R - symbol is in the read only data section<li>T - symbol is in the text section<li>V - weak object<li>W - weak symbol</ul><li>decl: kind of declaration as found by `ctags -R include` (every occurance is reported, arch specific definitions are not linked)<ul><li>d - macro definition<li>t - typedef<li>s - struct declaration<li>u - union declaration<li>p - function prototype<li>x - external and forward variable declaration</ul></ul>
<h4>table</h4><table border=1><tr><th colspan=3>musl<th colspan=4>c99<tr><th>status<th>sym<th>decl<th>name<th>header<th>proto<th>section
<tr><td>missing<td> <td> <td>NDEBUG<td>assert.h<td> <td>B.1 Diagnostics
<h3>musl vs posix api</h3>
-<h4>commit</h4><p>commit <a href="http://git.etalabs.net/cgi-bin/gitweb.cgi?p=musl;a=commit;h=03a8362930c3c4fe49ee6b9cb2ba9f28153b15d3">03a8362930c3c4fe49ee6b9cb2ba9f28153b15d3</a><br>Date: Tue Sep 20 10:58:18 2011 -0400<br><br> fix broken siginfo_t with _GNU_SOURCE defined<br> <br> this bug was introduced in a recent patch. the problem we're working<br> around is that broken GNU software wants to use "struct siginfo"<br> rather than "siginfo_t", but "siginfo" is not in the reserved<br> namespace and thus not legal for the standard header to use.
+<h4>commit</h4><p>commit <a href="http://git.etalabs.net/cgi-bin/gitweb.cgi?p=musl;a=commit;h=2318207adcad74283881ffcefbad92797a2495aa">2318207adcad74283881ffcefbad92797a2495aa</a><br>Date: Tue Sep 20 12:14:06 2011 -0400<br><br> fix incorrect include guard in mqueue.h
<h4>legend</h4><ul><li>status: musl implementation status summary<ul><li>(empty) - implemented<li>nosym - prototype found in include files (see decl) but not in libc.a (see sym)<li>nodecl - symbol is in libc.a but not declared in a public header<li>missing - neither in include files (see decl) nor in libc.a (see sym)</ul><li>sym: external symbol kind as found by `nm libc.a` (symbol kind only reported once)<ul><li>C - symbol is common (uninitialized data)<li>D - symbol is in the initialized data section<li>R - symbol is in the read only data section<li>T - symbol is in the text section<li>V - weak object<li>W - weak symbol</ul><li>decl: kind of declaration as found by `ctags -R include` (every occurance is reported)<ul><li>d - macro definition<li>p - function prototype<li>x - external and forward variable declaration</ul></ul><p>(STREAMS and posix_trace* apis are excluded)
<h4>table</h4><table border=1><tr><th colspan=3>musl<th colspan=4>posix<tr><th>status<th>sym<th>decl<th>name<th>header<th>option<th>desc
<tr><td> <td> <td><a href="http://git.etalabs.net/cgi-bin/gitweb.cgi?p=musl;a=blob;f=include/sys/select.h#l27">d</a> <td><a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/FD_CLR.html">FD_CLR</a><td> <a href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_select.h.html">sys/select.h</a><td> <td>pselect, select - synchronous I/O multiplexing