From a3c891107118e1c1687070250f6b7fa1df2abda2 Mon Sep 17 00:00:00 2001 From: nsz Date: Wed, 21 Sep 2011 13:54:00 +0200 Subject: [PATCH] update i386 sizeof and sizeoftags --- Makefile | 2 +- data/i386.glibc.sizeof | 15 +++++++++++++-- data/i386.musl.sizeof | 15 +++++++++++++-- data/i386.sizeof.diff | 34 +++++++--------------------------- sizeof.c | 19 ++++++++++++++----- sizeof.sh | 27 ++++++++++++++------------- tab_c99.html | 2 +- tab_posix.html | 2 +- 8 files changed, 64 insertions(+), 52 deletions(-) diff --git a/Makefile b/Makefile index 825593e..217abb9 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ tables: 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 diff --git a/data/i386.glibc.sizeof b/data/i386.glibc.sizeof index d27f892..0fa56ae 100644 --- a/data/i386.glibc.sizeof +++ b/data/i386.glibc.sizeof @@ -1,4 +1,5 @@ ACTION 4 +CODE 8 ENTRY 8 Elf32_Addr 4 Elf32_Conflict 4 @@ -57,18 +58,19 @@ Elf_Options 8 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 @@ -80,6 +82,7 @@ fd_mask 4 fd_set 128 fenv_t 28 fexcept_t 2 +float 4 fpos_t 16 fsblkcnt_t 8 fsfilcnt_t 8 @@ -93,6 +96,7 @@ imaxdiv_t 16 in_addr_t 4 in_port_t 2 ino_t 8 +int 4 int16_t 2 int32_t 4 int64_t 8 @@ -112,6 +116,9 @@ key_t 4 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 @@ -169,6 +176,7 @@ rlim_t 8 sa_family_t 2 scrnmap_t 1 sem_t 16 +short 2 sig_atomic_t 4 sighandler_t 4 siginfo_t 128 @@ -245,6 +253,7 @@ struct ip6_frag 8 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 @@ -291,6 +300,7 @@ struct nd_router_solicit 8 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 @@ -394,8 +404,9 @@ union sigval 4 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 diff --git a/data/i386.musl.sizeof b/data/i386.musl.sizeof index 0bf94a9..14d16a4 100644 --- a/data/i386.musl.sizeof +++ b/data/i386.musl.sizeof @@ -1,4 +1,5 @@ ACTION 4 +CODE 8 ENTRY 8 Elf32_Addr 4 Elf32_Conflict 4 @@ -57,18 +58,19 @@ Elf_Options 8 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 @@ -80,6 +82,7 @@ fd_mask 4 fd_set 128 fenv_t 32 fexcept_t 2 +float 4 fpos_t 16 fsblkcnt_t 8 fsfilcnt_t 8 @@ -93,6 +96,7 @@ imaxdiv_t 16 in_addr_t 4 in_port_t 2 ino_t 8 +int 4 int16_t 2 int32_t 4 int64_t 8 @@ -112,6 +116,9 @@ key_t 4 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 @@ -169,6 +176,7 @@ rlim_t 8 sa_family_t 2 scrnmap_t 1 sem_t 16 +short 2 sig_atomic_t 4 sighandler_t 4 siginfo_t 128 @@ -245,6 +253,7 @@ struct ip6_frag 8 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 @@ -291,6 +300,7 @@ struct nd_router_solicit 8 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 @@ -394,8 +404,9 @@ union sigval 4 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 diff --git a/data/i386.sizeof.diff b/data/i386.sizeof.diff index 653b51a..8c7eb1d 100644 --- a/data/i386.sizeof.diff +++ b/data/i386.sizeof.diff @@ -1,49 +1,29 @@ ---- 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 diff --git a/sizeof.c b/sizeof.c index fee47e2..1016849 100644 --- a/sizeof.c +++ b/sizeof.c @@ -1,6 +1,7 @@ #define _GNU_SOURCE 1 #define _LARGEFILE64_SOURCE 1 #define _FILE_OFFSET_BITS 64 +#define SYSLOG_NAMES 1 #include #include @@ -149,7 +150,7 @@ #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) @@ -210,18 +211,19 @@ p(Elf_Options_Hw) //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) @@ -233,6 +235,7 @@ p(fd_mask) p(fd_set) p(fenv_t) p(fexcept_t) +p(float) p(fpos_t) p(fsblkcnt_t) p(fsfilcnt_t) @@ -246,6 +249,7 @@ p(imaxdiv_t) p(in_addr_t) p(in_port_t) p(ino_t) +p(int) p(int16_t) p(int32_t) p(int64_t) @@ -265,6 +269,9 @@ p(key_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) @@ -322,6 +329,7 @@ p(rlim_t) p(sa_family_t) p(scrnmap_t) p(sem_t) +p(short) p(sig_atomic_t) p(sighandler_t) p(siginfo_t) @@ -390,7 +398,6 @@ p(struct ih_idseq) 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) @@ -404,6 +411,7 @@ p(struct ip6_frag) 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) @@ -448,9 +456,9 @@ p(struct nd_redirect) 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) @@ -554,9 +562,10 @@ p(union sigval) 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;} diff --git a/sizeof.sh b/sizeof.sh index ee3b137..399794c 100755 --- a/sizeof.sh +++ b/sizeof.sh @@ -6,7 +6,16 @@ MUSL=${MUSL:-../musl} 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 @@ -16,6 +25,7 @@ echo 'wchar_t' >>/tmp/m.type 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 ' >>sizeof.c echo '#include ' >>sizeof.c echo '' >>sizeof.c @@ -25,17 +35,8 @@ sort /tmp/m.header |uniq |awk ' { 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 - diff --git a/tab_c99.html b/tab_c99.html index c10f281..b02e6e4 100644 --- a/tab_c99.html +++ b/tab_c99.html @@ -1,5 +1,5 @@

musl vs c99 api

-

commit

commit d23a543d8acfedb7c0284888d72c4aa347b8c46e
Date: Tue Sep 20 14:51:56 2011 -0400

make stdbool.h conform to c99 +

commit

commit fd9e01e92a5d665e5b6c3221cd67970038cf7a6c
Date: Tue Sep 20 20:02:48 2011 -0400

fix some header typos

legend

  • status: musl implementation status summary
    • (empty) - implemented
    • nosym - prototype found in include files (see decl) but not in libc.a (see sym)
    • nodecl - symbol is in libc.a but not declared in a public header
    • missing - neither in include files (see decl) nor in libc.a (see sym)
  • sym: external symbol kind as found by `nm libc.a` (symbol kind only reported once)
    • C - symbol is common (uninitialized data)
    • D - symbol is in the initialized data section
    • R - symbol is in the read only data section
    • T - symbol is in the text section
    • V - weak object
    • W - weak symbol
  • decl: kind of declaration as found by `ctags -R include` (every occurance is reported, arch specific definitions are not linked)
    • d - macro definition
    • t - typedef
    • s - struct declaration
    • u - union declaration
    • p - function prototype
    • x - external and forward variable declaration

table

muslc99
statussymdeclnameheaderprotosection
missing  NDEBUGassert.h B.1 Diagnostics diff --git a/tab_posix.html b/tab_posix.html index 324d362..4289416 100644 --- a/tab_posix.html +++ b/tab_posix.html @@ -1,5 +1,5 @@

musl vs posix api

-

commit

commit d23a543d8acfedb7c0284888d72c4aa347b8c46e
Date: Tue Sep 20 14:51:56 2011 -0400

make stdbool.h conform to c99 +

commit

commit fd9e01e92a5d665e5b6c3221cd67970038cf7a6c
Date: Tue Sep 20 20:02:48 2011 -0400

fix some header typos

legend

  • status: musl implementation status summary
    • (empty) - implemented
    • nosym - prototype found in include files (see decl) but not in libc.a (see sym)
    • nodecl - symbol is in libc.a but not declared in a public header
    • missing - neither in include files (see decl) nor in libc.a (see sym)
  • sym: external symbol kind as found by `nm libc.a` (symbol kind only reported once)
    • C - symbol is common (uninitialized data)
    • D - symbol is in the initialized data section
    • R - symbol is in the read only data section
    • T - symbol is in the text section
    • V - weak object
    • W - weak symbol
  • decl: kind of declaration as found by `ctags -R include` (every occurance is reported)
    • d - macro definition
    • p - function prototype
    • x - external and forward variable declaration

(STREAMS and posix_trace* apis are excluded)

table

muslposix
statussymdeclnameheaderoptiondesc
  d FD_CLR sys/select.h pselect, select - synchronous I/O multiplexing -- 2.20.1