23 # install headers to T.$arch
28 awk -F'\t' '$3 ~ /^[sutSUT]$/ {
30 }' data
/musl.generic.decls data
/musl.
$arch.decls
31 echo 'function_pointer
43 } |
sort |
uniq >/tmp
/m.
$arch.
type
45 awk -F'\t' '{print $2}' data
/musl.generic.decls |
sort |
uniq >/tmp
/m.header
49 #define _FILE_OFFSET_BITS 64
50 #define SYSLOG_NAMES 1
52 #include <sys/types.h>
56 /^sys\/(cachectl|fantotify|errno|fcntl|io|kd|poll|reg|signal|soundcard|termios|vt)\.h$/ { printf "//" }
57 /^(wait)\.h$/ { printf "//" }
59 /^(stdalign|stdnoreturn|threads)\.h$/ { w=1 }
61 if(w) print "#ifndef __GLIBC__"
62 print "#include <" $0 ">"
64 }' /tmp
/m.header
>>abi_type.
$arch.cc
67 typedef long long long_long;
68 typedef long double long_double;
69 typedef void *object_pointer;
70 typedef void (*function_pointer)();
71 struct size {char c;};
72 struct align {char c;};
73 struct incomplete {char c;};
74 #define T(s,t) void x_##t(s t x, s t* ptr, size(*y)[sizeof(s t)], align(*z)[__alignof__(s t)]){}
75 #define P(s,t) void x_##t(incomplete x, s t* ptr, incomplete y, incomplete z){}
84 /^(struct|union) __(CODE|ptcb|siginfo|ucontext|sigjmp_buf|double_repr|float_repr|sigset_t|mbstate_t|fsid_t|locale_struct)$/ ||
85 /^(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 "//" }
86 { if (!sub(/ /,",")) sub(/^/,",") }
87 /,(once_flag|mtx_t|cnd_t|thrd_start_t|thrd_t|tss_dtor_t|tss_t)$/ { print "M(T(" $0 "))"; next}
88 /,(DIR|FILE)$/ { print "P(" $0 ")"; next }
89 { print "T(" $0 ")" }' /tmp
/m.
$arch.
type >>abi_type.
$arch.cc
92 #$CXX -S -o - abi_type.cc |sed -n 's/^\(_Z.*\):/\1/p' |$CXXFILT |sed '
93 #s/^x_\([^(]*\)(\(.*\))/\1: \2/
94 #s/floatcomplex /float _Complex/g
95 #s/doublecomplex /double _Complex/g
96 #' >data/musl.abi_type