abi: abi.ARCH.diff
cp abi.ARCH.* data/
-abi.cc:
- ./abi.sh
-abi.ARCH.glibc: abi.cc
+abi_type.cc:
+ ./abi_type.sh
+abi.ARCH.glibc: abi_type.cc
g++ -std=c++11 $(GLIBC_FLAGS) -c -o $@.o $<
nm -C $@.o |sed -n 's/^[[:xdigit:]]* T //p' |sort >$@
-abi.ARCH.musl: abi.cc
+abi.ARCH.musl: abi_type.cc
g++ -std=c++11 -nostdinc -fno-stack-protector -isystem $(MUSL)/include -isystem $(LIBGCC) -isystem /usr/include -c -o $@.o $<
nm -C $@.o |sed -n 's/^[[:xdigit:]]* T //p' |sort >$@
abi.ARCH.diff: abi.ARCH.glibc abi.ARCH.musl
+++ /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 'char' >>/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
- find . -name '*.h' | sed 's,^\./,,' >/tmp/m.header
-)
-
-echo '#define _GNU_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 '#include <sys/types.h>' >>abi.cc
-echo '' >>abi.cc
-
-sort /tmp/m.header |uniq |awk '
- /^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 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)$/ ||
- /^(elf_fpxregset_t|struct user_fpxregs_struct|Sg_io_vec|struct ih_.*|struct ip6_hdrctl|tcp_seq|union _G_fpos64_t|struct cpu_set_t|__isoc_va_list|ns_tcp_tsig.*|ns_tsig_.*|struct ptrace_peeksiginfo_.*)$/ { printf "//" }
- { 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
--- /dev/null
+#!/bin/sh
+
+#set -xeu
+
+export LC_ALL=C
+#MUSL=${MUSL:-../musl}
+
+awk -F'\t' '$3 ~ /^p$/ {
+ print $1
+}' data/musl.tags >/tmp/m.funcs
+awk -F'\t' '$3 ~ /^p$/ {
+ print $2
+}' data/musl.tags >/tmp/m.header
+
+echo '#define _GNU_SOURCE 1' >abi_func.cc
+echo '#define _FILE_OFFSET_BITS 64' >>abi_func.cc
+echo '#define SYSLOG_NAMES 1' >>abi_func.cc
+#echo '#include <stddef.h>' >>abi_func.cc
+#echo '#include <sys/types.h>' >>abi_func.cc
+echo '' >>abi_func.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\/(cachectl)\.h$/ { printf "//" }
+# /^(threads)\.h$/ { printf "//" }
+ { print "#include <" $0 ">" }' >>abi_func.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 T(x) void t_##x(__typeof(x)*p){}' >>abi_func.cc
+echo '
+#ifdef __GLIBC__
+#define M(x)
+#undef sigsetjmp
+#define sigsetjmp __sigsetjmp
+#else
+#define M(x) x
+#endif
+' >>abi_func.cc
+
+sort /tmp/m.funcs |uniq |awk '
+ /^(__flt_rounds|__freadahead|__freadptr|__freadptrinc|__fseterr|_flush_cache|_pthread_cleanup_pop|_pthread_cleanup_push|cachectl|cacheflush|call_once|cnd_broadcast|cnd_destroy|cnd_init|cnd_signal|cnd_timedwait|cnd_wait|fgetln|getdents|gets|index|issetugid|memchr|memrchr|mtx_destroy|mtx_init|mtx_lock|mtx_timedlock|mtx_trylock|mtx_unlock|posix_close|rindex|strcasestr|strchr|strchrnul|strlcat|strlcpy|strpbrk|strrchr|strstr|thrd_create|thrd_current|thrd_detach|thrd_equal|thrd_exit|thrd_join|thrd_sleep|thrd_yield|tss_create|tss_delete|tss_get|tss_set|wcschr|wcspbrk|wcsrchr|wcsstr|wcswcs|wmemchr)$/ {
+ print "M(T(" $0 "))"; next
+ }
+ /^(ElfW)$/ { printf "// " }
+ { print "T(" $0 ")" }' >>abi_func.cc
+
+#$CXX -S -o - abi_func.cc |sed -n 's/^\(_Z.*\):/\1/p' |$CXXFILT |sed '
+#s/(\*)/@/;s/^t_\([^(]*\)(\(.*\)@\(.*\))/\2\1\3/
+#s/floatcomplex /float _Complex/g
+#s/doublecomplex /double _Complex/g
+#' >data/musl.abi_func
--- /dev/null
+#!/bin/sh
+
+CXXFILT=${CXXFILT:-c++filt}
+
+$CXX -S -o - abi_func.cc |sed -n 's/^\(_Z.*\):/\1/p' |$CXXFILT |sed '
+s/(\*)/@/;s/^t_\([^(]*\)(\(.*\)@\(.*\))/\2\1\3/
+s/floatcomplex /float _Complex/g
+s/doublecomplex /double _Complex/g
+'
--- /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 'char' >>/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
+ find . -name '*.h' | sed 's,^\./,,' >/tmp/m.header
+)
+
+echo '#define _GNU_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 '#include <sys/types.h>' >>abi.cc
+echo '' >>abi.cc
+
+sort /tmp/m.header |uniq |awk '
+ /^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 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)$/ ||
+ /^(elf_fpxregset_t|struct user_fpxregs_struct|Sg_io_vec|struct ih_.*|struct ip6_hdrctl|tcp_seq|union _G_fpos64_t|struct cpu_set_t|__isoc_va_list|ns_tcp_tsig.*|ns_tsig_.*|struct ptrace_peeksiginfo_.*)$/ { printf "//" }
+ { 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
--- /dev/null
+#!/bin/sh
+
+CXXFILT=${CXXFILT:-c++filt}
+
+$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
+'