)
echo '#define _GNU_SOURCE 1' >abi.cc
-echo '#define _LARGEFILE64_SOURCE 1' >>abi.cc
echo '#define _FILE_OFFSET_BITS 64' >>abi.cc
echo '#define SYSLOG_NAMES 1' >>abi.cc
echo '#include <stddef.h>' >>abi.cc
echo '' >>abi.cc
sort /tmp/m.header |uniq |awk '
- /^sys\/(auxv|cachectl|fantotify|errno|fcntl|poll|signal|soundcard|termios)\.h$/ { printf "//" }
- /^(stdalign|stdnoreturn|threads|wait)\.h$/ { printf "//" }
+ /^sys\/(auxv|cachectl|fantotify|errno|fcntl|kd|poll|signal|soundcard|termios|vt)\.h$/ { printf "//" }
+ /^(bits\/.*|stdalign|stdnoreturn|threads|wait)\.h$/ { printf "//" }
{ print "#include <" $0 ">" }' >>abi.cc
echo 'typedef long long long_long; typedef long double long_double;' >>abi.cc
echo 'struct size{int i;}; struct align{int i;};' >>abi.cc
echo '#define p(s,t) void x_##t(s t x, s t* ptr, size(*y)[sizeof(s t)], align(*z)[__alignof__(s t)]){}' >>abi.cc
-echo '#define pp(s,t) void x_##t(s t* ptr, size(*y)[sizeof(s t*)], align(*z)[__alignof__(s t*)]){}' >>abi.cc
+echo '#define pp(s,t) void y_##t(s t* ptr, size(*y)[sizeof(s t*)], align(*z)[__alignof__(s t*)]){}' >>abi.cc
+echo '
+#ifdef __GLIBC__
+#define M(x)
+#else
+#define M(x) x
+#endif
+' >>abi.cc
+
sort /tmp/m.type |uniq |awk '
/^(once_flag|mtx_t|cnd_t|thrd_start_t|thrd_t|tss_dtor_t|tss_t)$/ ||
/^(struct|union) __(CODE|ptcb|siginfo|ucontext|sigjmp_buf|double_repr|float_repr|sigset_t|mbstate_t|fsid_t)$/ ||
{ if (!sub(/ /,",")) sub(/^/,",") }
/,(DIR|FILE|void)$/ { print "pp(" $0 ")"; next }
{ print "p(" $0 ")" }' >>abi.cc
+
+#$CXX -S -o - abi.cc |sed -n 's/^\(_Z.*\):/\1/p' |$CXXFILT |sed '
+#s/^x_\([^(]*\)(\(.*\))/\1: \2/
+#s/^y_\([^(]*\)(\(.*\))/\1*: \2/
+#s/floatcomplex /float _Complex/g
+#s/doublecomplex /double _Complex/g
+#' >data/musl.abi_type