19 # install headers to T.$arch
24 awk -F'\t' '$3 ~ /^[sutSUT]$/ {
26 }' data/musl.generic.decls data/musl.$arch.decls
27 echo 'function_pointer
39 } |sort |uniq >/tmp/m.$arch.type
41 awk -F'\t' '{print $2}' data/musl.generic.decls |sort |uniq >/tmp/m.header
45 #define _FILE_OFFSET_BITS 64
46 #define SYSLOG_NAMES 1
48 #include <sys/types.h>
52 /^sys\/(cachectl|fantotify|errno|fcntl|io|kd|poll|reg|signal|soundcard|termios|vt)\.h$/ { printf "//" }
53 /^(wait)\.h$/ { printf "//" }
55 /^(stdalign|stdnoreturn|threads)\.h$/ { w=1 }
57 if(w) print "#ifndef __GLIBC__"
58 print "#include <" $0 ">"
60 }' /tmp/m.header >>abi_type.$arch.cc
63 typedef long long long_long;
64 typedef long double long_double;
65 typedef void *object_pointer;
66 typedef void (*function_pointer)();
67 struct size {char c;};
68 struct align {char c;};
69 struct incomplete {char c;};
70 #define T(s,t) void x_##t(s t x, s t* ptr, size(*y)[sizeof(s t)], align(*z)[__alignof__(s t)]){}
71 #define P(s,t) void x_##t(incomplete x, s t* ptr, incomplete y, incomplete z){}
80 /^(struct|union) __(CODE|ptcb|siginfo|ucontext|sigjmp_buf|double_repr|float_repr|sigset_t|mbstate_t|fsid_t|locale_struct)$/ ||
81 /^(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 "//" }
82 { if (!sub(/ /,",")) sub(/^/,",") }
83 /,(once_flag|mtx_t|cnd_t|thrd_start_t|thrd_t|tss_dtor_t|tss_t)$/ { print "M(T(" $0 "))"; next}
84 /,(DIR|FILE)$/ { print "P(" $0 ")"; next }
85 { print "T(" $0 ")" }' /tmp/m.$arch.type >>abi_type.$arch.cc
88 #$CXX -S -o - abi_type.cc |sed -n 's/^\(_Z.*\):/\1/p' |$CXXFILT |sed '
89 #s/^x_\([^(]*\)(\(.*\))/\1: \2/
90 #s/floatcomplex /float _Complex/g
91 #s/doublecomplex /double _Complex/g
92 #' >data/musl.abi_type