sizeof: sizeof-glibc sizeof-musl
./sizeof-glibc >data/glibc.sizeof
./sizeof-musl >data/musl.sizeof
- diff -u data/glibc.sizeof data/musl.sizeof >data/sizeof.diff || true
+ diff -U1 data/glibc.sizeof data/musl.sizeof >data/sizeof.diff || true
LIBGCC=`gcc -print-file-name=libgcc.a |sed 's,/libgcc.a$$,,'`
# when compiling with pcc
ACTION 4
+CODE 8
ENTRY 8
Elf32_Addr 4
Elf32_Conflict 4
Elf_Options_Hw 8
HEADER 12
VISIT 4
+_Bool 1
__uint16_t 2
__uint32_t 4
__uint64_t 8
blkcnt_t 8
blksize_t 4
-bool 1
caddr_t 4
cc_t 1
clock_t 4
clockid_t 4
dev_t 8
div_t 8
+double 8
elf_fpregset_t 108
elf_fpregset_t 108
elf_fpxregset_t 512
fd_set 128
fenv_t 28
fexcept_t 2
+float 4
fpos_t 16
fsblkcnt_t 8
fsfilcnt_t 8
in_addr_t 4
in_port_t 2
ino_t 8
+int 4
int16_t 2
int32_t 4
int64_t 8
ldiv_t 8
lldiv_t 16
locale_t 4
+long 4
+long double 12
+long long 8
lwpid_t 4
mbstate_t 8
mcontext_t 88
sa_family_t 2
scrnmap_t 1
sem_t 16
+short 2
sig_atomic_t 4
sighandler_t 4
siginfo_t 128
struct ip6_hbh 2
struct ip6_hdr 40
struct ip6_hdrctl 8
+struct ip6_mtuinfo 32
struct ip6_opt 2
struct ip6_opt_jumbo 6
struct ip6_opt_nsap 4
struct netent 16
struct ns_tcp_tsig_state 528
struct ns_tsig_key 2060
+struct ntptimeval 16
struct option 16
struct packet_mreq 16
struct passwd 28
ushort 2
va_list 4
va_list 4
+void* 4
+wchar_t 4
wctrans_t 4
wctype_t 4
wint_t 4
wordexp_t 12
-wchar_t 4
ACTION 4
+CODE 8
ENTRY 8
Elf32_Addr 4
Elf32_Conflict 4
Elf_Options_Hw 8
HEADER 12
VISIT 4
+_Bool 1
__uint16_t 2
__uint32_t 4
__uint64_t 8
blkcnt_t 8
blksize_t 4
-bool 1
caddr_t 4
cc_t 1
clock_t 4
clockid_t 4
dev_t 8
div_t 8
+double 8
elf_fpregset_t 108
elf_fpregset_t 108
elf_fpxregset_t 512
fd_set 128
fenv_t 32
fexcept_t 2
+float 4
fpos_t 16
fsblkcnt_t 8
fsfilcnt_t 8
in_addr_t 4
in_port_t 2
ino_t 8
+int 4
int16_t 2
int32_t 4
int64_t 8
ldiv_t 8
lldiv_t 16
locale_t 4
+long 4
+long double 12
+long long 8
lwpid_t 4
mbstate_t 8
mcontext_t 88
sa_family_t 2
scrnmap_t 1
sem_t 16
+short 2
sig_atomic_t 4
sighandler_t 4
siginfo_t 128
struct ip6_hbh 2
struct ip6_hdr 40
struct ip6_hdrctl 8
+struct ip6_mtuinfo 32
struct ip6_opt 2
struct ip6_opt_jumbo 6
struct ip6_opt_nsap 4
struct netent 16
struct ns_tcp_tsig_state 528
struct ns_tsig_key 2060
+struct ntptimeval 16
struct option 16
struct packet_mreq 16
struct passwd 28
ushort 2
va_list 4
va_list 4
+void* 4
+wchar_t 4
wctrans_t 4
wctype_t 4
wint_t 4
wordexp_t 12
-wchar_t 4
---- data/glibc.sizeof 2011-09-20 18:22:17.000000000 +0200
-+++ data/musl.sizeof 2011-09-20 18:22:17.000000000 +0200
-@@ -78,7 +78,7 @@
- eventfd_t 8
- fd_mask 4
+--- data/glibc.sizeof 2011-09-21 13:50:37.000000000 +0200
++++ data/musl.sizeof 2011-09-21 13:50:37.000000000 +0200
+@@ -82,3 +82,3 @@
fd_set 128
-fenv_t 28
+fenv_t 32
fexcept_t 2
- fpos_t 16
- fsblkcnt_t 8
-@@ -160,7 +160,7 @@
- pthread_t 4
- ptrdiff_t 4
+@@ -169,3 +169,3 @@
quad_t 8
-regex_t 32
+regex_t 28
register_t 4
- regmatch_t 8
- regoff_t 4
-@@ -302,8 +302,8 @@
- struct rr_pco_use 32
- struct rr_result 24
+@@ -314,4 +314,4 @@
struct rtentry 84
-struct rusage 72
-struct sched_param 4
+struct rusage 136
+struct sched_param 28
struct sembuf 6
- struct semid_ds 64
- struct seminfo 40
-@@ -319,7 +319,7 @@
- struct sockaddr_in 16
- struct sockaddr_in6 28
+@@ -331,3 +331,3 @@
struct sockaddr_ll 20
-struct sockaddr_storage 128
+struct sockaddr_storage 132
struct sockaddr_un 110
- struct spwd 36
- struct stat 96
-@@ -332,7 +332,7 @@
- struct strioctl 16
- struct strpeek 28
+@@ -344,3 +344,3 @@
struct strrecvfd 20
-struct sysinfo 64
+struct sysinfo 348
struct termios 60
- struct timespec 8
- struct timestamp 40
#define _GNU_SOURCE 1
#define _LARGEFILE64_SOURCE 1
#define _FILE_OFFSET_BITS 64
+#define SYSLOG_NAMES 1
#include <stddef.h>
#include <sys/types.h>
#define p(x) printf("%s\t%u\n", #x, sizeof(x));
int main(){
p(ACTION)
-//p(CODE)
+p(CODE)
//p(DIR)
p(ENTRY)
p(Elf32_Addr)
//p(FILE)
p(HEADER)
p(VISIT)
+p(_Bool)
p(__uint16_t)
p(__uint32_t)
p(__uint64_t)
p(blkcnt_t)
p(blksize_t)
-p(bool)
p(caddr_t)
p(cc_t)
p(clock_t)
p(clockid_t)
p(dev_t)
p(div_t)
+p(double)
p(elf_fpregset_t)
p(elf_fpregset_t)
p(elf_fpxregset_t)
p(fd_set)
p(fenv_t)
p(fexcept_t)
+p(float)
p(fpos_t)
p(fsblkcnt_t)
p(fsfilcnt_t)
p(in_addr_t)
p(in_port_t)
p(ino_t)
+p(int)
p(int16_t)
p(int32_t)
p(int64_t)
p(ldiv_t)
p(lldiv_t)
p(locale_t)
+p(long)
+p(long double)
+p(long long)
p(lwpid_t)
p(mbstate_t)
p(mcontext_t)
p(sa_family_t)
p(scrnmap_t)
p(sem_t)
+p(short)
p(sig_atomic_t)
p(sighandler_t)
p(siginfo_t)
p(struct ih_pmtu)
p(struct ih_rtradv)
p(struct in6_addr)
-//p(struct in6_mutinfo)
p(struct in6_pktinfo)
p(struct in6_rtmsg)
p(struct in_addr)
p(struct ip6_hbh)
p(struct ip6_hdr)
p(struct ip6_hdrctl)
+p(struct ip6_mtuinfo)
p(struct ip6_opt)
p(struct ip6_opt_jumbo)
p(struct ip6_opt_nsap)
p(struct nd_router_advert)
p(struct nd_router_solicit)
p(struct netent)
-//p(struct npttimeval)
p(struct ns_tcp_tsig_state)
p(struct ns_tsig_key)
+p(struct ntptimeval)
p(struct option)
p(struct packet_mreq)
p(struct passwd)
p(ushort)
p(va_list)
p(va_list)
+p(void*)
+p(wchar_t)
p(wctrans_t)
p(wctype_t)
p(wint_t)
p(wordexp_t)
-p(wchar_t)
return 0;}
awk -F'\t' '$3 ~ /^[sut]$/ {
print $1
}' data/musl.tags >/tmp/m.type
+echo 'short' >>/tmp/m.type
+echo 'int' >>/tmp/m.type
+echo 'long' >>/tmp/m.type
+echo 'long long' >>/tmp/m.type
+echo 'float' >>/tmp/m.type
+echo 'double' >>/tmp/m.type
+echo 'long double' >>/tmp/m.type
echo 'wchar_t' >>/tmp/m.type
+echo '_Bool' >>/tmp/m.type
+echo 'void*' >>/tmp/m.type
(
cd $MUSL/include
echo '#define _GNU_SOURCE 1' >sizeof.c
echo '#define _LARGEFILE64_SOURCE 1' >>sizeof.c
echo '#define _FILE_OFFSET_BITS 64' >>sizeof.c
+echo '#define SYSLOG_NAMES 1' >>sizeof.c
echo '#include <stddef.h>' >>sizeof.c
echo '#include <sys/types.h>' >>sizeof.c
echo '' >>sizeof.c
{ 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
+sort /tmp/m.type |awk '
+ /^struct __(CODE|fpstate|ptcb|siginfo|ucontext)$/ ||
+ /^(DIR|FILE)$/ { printf "//" }
+ { print "p(" $0 ")" }' >>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=d23a543d8acfedb7c0284888d72c4aa347b8c46e">d23a543d8acfedb7c0284888d72c4aa347b8c46e</a><br>Date: Tue Sep 20 14:51:56 2011 -0400<br><br> make stdbool.h conform to c99
+<h4>commit</h4><p>commit <a href="http://git.etalabs.net/cgi-bin/gitweb.cgi?p=musl;a=commit;h=fd9e01e92a5d665e5b6c3221cd67970038cf7a6c">fd9e01e92a5d665e5b6c3221cd67970038cf7a6c</a><br>Date: Tue Sep 20 20:02:48 2011 -0400<br><br> fix some header typos
<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=d23a543d8acfedb7c0284888d72c4aa347b8c46e">d23a543d8acfedb7c0284888d72c4aa347b8c46e</a><br>Date: Tue Sep 20 14:51:56 2011 -0400<br><br> make stdbool.h conform to c99
+<h4>commit</h4><p>commit <a href="http://git.etalabs.net/cgi-bin/gitweb.cgi?p=musl;a=commit;h=fd9e01e92a5d665e5b6c3221cd67970038cf7a6c">fd9e01e92a5d665e5b6c3221cd67970038cf7a6c</a><br>Date: Tue Sep 20 20:02:48 2011 -0400<br><br> fix some header typos
<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