Overview
Comment: | modify build system to replace extremely fragile error code generation mechanism |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
d77ef26adfc782b0b47f886453e79d8f |
User & Date: | lexi on 2019-08-21 04:24:21 |
Other Links: | manifest | tags |
Context
2019-08-21
| ||
04:50 | Add initial build setup for Nix check-in: a26e579866 user: glow tags: trunk | |
04:24 | modify build system to replace extremely fragile error code generation mechanism check-in: d77ef26adf user: lexi tags: trunk | |
03:44 | make crt behave as a C runtime launcher should; comment code thoroughly check-in: f0f16493ca user: lexi tags: trunk | |
Changes
Added arch/posix/errnos version [cc3bf9e501].
1 +EPERM 2 +EINVAL 3 +EBADF 4 +EFAULT 5 +ENOSPC 6 +EDQUOT 7 +EIO 8 +EAGAIN 9 +EFBIG 10 +EINTR 11 +EDESTADDRREQ
Modified build.sh from [e1362458a3] to [4eaecd6098].
182 182 # we wish to import; we use sed to transform this into a form 183 183 # that cpp will fill out for us, producing a table that the 184 184 # awk scripts can handle and turn into a list of constants. 185 185 echo '#include <sys/syscall.h>' > $gen/system_calls.t.1 # this is the magic part 186 186 cat arch/posix/syscalls > $gen/system_calls.t.2 187 187 sed -e 's;^\(.*\)$;\1 SYS_\1;' -i $gen/system_calls.t.2 188 188 cat $gen/system_calls.t.1 $gen/system_calls.t.2 | cpp -P >$gen/system_calls.tbl 189 + 190 + # generate errno tables the same way 191 + echo '#include <errno.h>' > $gen/error_codes.t.1 # this is the magic part 192 + cat arch/posix/errnos > $gen/error_codes.t.2 193 + sed -e 's;^\(.*\)$;k_platform_error_\1 \1;' -i $gen/error_codes.t.2 194 + cat $gen/error_codes.t.1 $gen/error_codes.t.2 | cpp -P | grep "^k_platform_error" >$gen/error_codes.tbl # haaaack 189 195 else 190 196 case $os in 191 - # lin) grep -h "#define __NR_" $p_headers_syscall | sed 's;^#define __NR_;;' > $gen/system_calls.tbl;; 192 - # fbsd) grep -h "#define SYS_" $p_headers_syscall | sed 's;^#define SYS_;;' | sed 's;[\t ]\+; ;' > $gen/system_calls.tbl;; 193 197 *) noimpl 'system call table generation';; 194 198 esac 195 199 fi 196 -# cat $p_headers_syscall $gen/system_calls.tbl | cpp -P | 200 + 201 +# take the OS-specific system call tables that have been prepared 202 +# for us above and feed them into awk scripts to generate C headers 197 203 awk -f arch/syscall.awk -v out=s <$gen/system_calls.tbl>$gen/system_calls.s 198 -# cat $p_headers_syscall $gen/system_calls.tbl | cpp -P | 199 204 awk -f arch/syscall.awk -v out=h <$gen/system_calls.tbl>$gen/system_calls.h 200 205 201 -# generate errno tables 202 -grep -h "#[ ]*define[ ]\+E" $p_headers_errno | 203 - sed 's;^#[\t ]*define[\t ]\+\(E[A-Z0-9]\+\).*$;k_platform_error_\1 \1;' >\ 204 - $gen/error_names.tbl 205 -cat $p_headers_errno $gen/error_names.tbl | cpp -P >$gen/error_numbers.tbl 206 -awk -f arch/errtbl.awk <$gen/error_numbers.tbl >$gen/error_table.h 206 +# do the same with our error codes table 207 +awk -f arch/errtbl.awk <$gen/error_codes.tbl >$gen/error_table.h 207 208 208 209 # generate symbol tables for error handling functions 209 210 mkdir -p "$to/k" 210 211 awk -f global/gen-conds.awk <global/modules >$to/k/internal.egroup.h 211 212 awk -f global/gen-ident.awk <global/modules >$gen/internal.ident.c 212 213 comp_co $gen/internal.ident.c $to/internal.ident.o 213 214