sim: common: pull in newlib extensions for Linux compatibility

Since newlib allows people to opt-in to extra errno names, pull them
into our table too.  The values don't conflict with each other -- the
newlib names & values are distinct from newlib's Linux compatibility.
This commit is contained in:
Mike Frysinger 2023-12-26 22:53:31 -05:00
parent c2289ae348
commit a70dcdebbd
2 changed files with 122 additions and 1 deletions

View File

@ -142,7 +142,11 @@ def gen_common(output_dir: Path, newlib: Path, cpp: str):
No arch should override these.
"""
gentvals(output_dir, cpp, 'errno', newlib / 'newlib/libc/include',
# Enable Linux errno extensions since the newlib values are designed to
# not conflict with each other.
gentvals(output_dir,
cpp + ' -D__LINUX_ERRNO_EXTENSIONS__',
'errno', newlib / 'newlib/libc/include',
('errno.h', 'sys/errno.h'), 'E[A-Z0-9]*')
gentvals(output_dir, cpp, 'signal', newlib / 'newlib/libc/include',

View File

@ -41,6 +41,9 @@ CB_TARGET_DEFS_MAP cb_init_errno_map[] = {
#ifdef EADDRNOTAVAIL
{ "EADDRNOTAVAIL", EADDRNOTAVAIL, 125 },
#endif
#ifdef EADV
{ "EADV", EADV, 68 },
#endif
#ifdef EAFNOSUPPORT
{ "EAFNOSUPPORT", EAFNOSUPPORT, 106 },
#endif
@ -50,12 +53,30 @@ CB_TARGET_DEFS_MAP cb_init_errno_map[] = {
#ifdef EALREADY
{ "EALREADY", EALREADY, 120 },
#endif
#ifdef EBADE
{ "EBADE", EBADE, 50 },
#endif
#ifdef EBADF
{ "EBADF", EBADF, 9 },
#endif
#ifdef EBADFD
{ "EBADFD", EBADFD, 81 },
#endif
#ifdef EBADMSG
{ "EBADMSG", EBADMSG, 77 },
#endif
#ifdef EBADR
{ "EBADR", EBADR, 51 },
#endif
#ifdef EBADRQC
{ "EBADRQC", EBADRQC, 54 },
#endif
#ifdef EBADSLT
{ "EBADSLT", EBADSLT, 55 },
#endif
#ifdef EBFONT
{ "EBFONT", EBFONT, 57 },
#endif
#ifdef EBUSY
{ "EBUSY", EBUSY, 16 },
#endif
@ -65,6 +86,12 @@ CB_TARGET_DEFS_MAP cb_init_errno_map[] = {
#ifdef ECHILD
{ "ECHILD", ECHILD, 10 },
#endif
#ifdef ECHRNG
{ "ECHRNG", ECHRNG, 37 },
#endif
#ifdef ECOMM
{ "ECOMM", ECOMM, 70 },
#endif
#ifdef ECONNABORTED
{ "ECONNABORTED", ECONNABORTED, 113 },
#endif
@ -77,12 +104,18 @@ CB_TARGET_DEFS_MAP cb_init_errno_map[] = {
#ifdef EDEADLK
{ "EDEADLK", EDEADLK, 45 },
#endif
#ifdef EDEADLOCK
{ "EDEADLOCK", EDEADLOCK, 56 },
#endif
#ifdef EDESTADDRREQ
{ "EDESTADDRREQ", EDESTADDRREQ, 121 },
#endif
#ifdef EDOM
{ "EDOM", EDOM, 33 },
#endif
#ifdef EDOTDOT
{ "EDOTDOT", EDOTDOT, 76 },
#endif
#ifdef EDQUOT
{ "EDQUOT", EDQUOT, 132 },
#endif
@ -128,6 +161,39 @@ CB_TARGET_DEFS_MAP cb_init_errno_map[] = {
#ifdef EISDIR
{ "EISDIR", EISDIR, 21 },
#endif
#ifdef EL2HLT
{ "EL2HLT", EL2HLT, 44 },
#endif
#ifdef EL2NSYNC
{ "EL2NSYNC", EL2NSYNC, 38 },
#endif
#ifdef EL3HLT
{ "EL3HLT", EL3HLT, 39 },
#endif
#ifdef EL3RST
{ "EL3RST", EL3RST, 40 },
#endif
#ifdef ELBIN
{ "ELBIN", ELBIN, 75 },
#endif
#ifdef ELIBACC
{ "ELIBACC", ELIBACC, 83 },
#endif
#ifdef ELIBBAD
{ "ELIBBAD", ELIBBAD, 84 },
#endif
#ifdef ELIBEXEC
{ "ELIBEXEC", ELIBEXEC, 87 },
#endif
#ifdef ELIBMAX
{ "ELIBMAX", ELIBMAX, 86 },
#endif
#ifdef ELIBSCN
{ "ELIBSCN", ELIBSCN, 85 },
#endif
#ifdef ELNRNG
{ "ELNRNG", ELNRNG, 41 },
#endif
#ifdef ELOOP
{ "ELOOP", ELOOP, 92 },
#endif
@ -158,9 +224,15 @@ CB_TARGET_DEFS_MAP cb_init_errno_map[] = {
#ifdef ENFILE
{ "ENFILE", ENFILE, 23 },
#endif
#ifdef ENOANO
{ "ENOANO", ENOANO, 53 },
#endif
#ifdef ENOBUFS
{ "ENOBUFS", ENOBUFS, 105 },
#endif
#ifdef ENOCSI
{ "ENOCSI", ENOCSI, 43 },
#endif
#ifdef ENODATA
{ "ENODATA", ENODATA, 61 },
#endif
@ -179,12 +251,21 @@ CB_TARGET_DEFS_MAP cb_init_errno_map[] = {
#ifdef ENOLINK
{ "ENOLINK", ENOLINK, 67 },
#endif
#ifdef ENOMEDIUM
{ "ENOMEDIUM", ENOMEDIUM, 135 },
#endif
#ifdef ENOMEM
{ "ENOMEM", ENOMEM, 12 },
#endif
#ifdef ENOMSG
{ "ENOMSG", ENOMSG, 35 },
#endif
#ifdef ENONET
{ "ENONET", ENONET, 64 },
#endif
#ifdef ENOPKG
{ "ENOPKG", ENOPKG, 65 },
#endif
#ifdef ENOPROTOOPT
{ "ENOPROTOOPT", ENOPROTOOPT, 109 },
#endif
@ -200,6 +281,9 @@ CB_TARGET_DEFS_MAP cb_init_errno_map[] = {
#ifdef ENOSYS
{ "ENOSYS", ENOSYS, 88 },
#endif
#ifdef ENOTBLK
{ "ENOTBLK", ENOTBLK, 15 },
#endif
#ifdef ENOTCONN
{ "ENOTCONN", ENOTCONN, 128 },
#endif
@ -221,6 +305,9 @@ CB_TARGET_DEFS_MAP cb_init_errno_map[] = {
#ifdef ENOTTY
{ "ENOTTY", ENOTTY, 25 },
#endif
#ifdef ENOTUNIQ
{ "ENOTUNIQ", ENOTUNIQ, 80 },
#endif
#ifdef ENXIO
{ "ENXIO", ENXIO, 6 },
#endif
@ -242,6 +329,9 @@ CB_TARGET_DEFS_MAP cb_init_errno_map[] = {
#ifdef EPIPE
{ "EPIPE", EPIPE, 32 },
#endif
#ifdef EPROCLIM
{ "EPROCLIM", EPROCLIM, 130 },
#endif
#ifdef EPROTO
{ "EPROTO", EPROTO, 71 },
#endif
@ -254,18 +344,36 @@ CB_TARGET_DEFS_MAP cb_init_errno_map[] = {
#ifdef ERANGE
{ "ERANGE", ERANGE, 34 },
#endif
#ifdef EREMCHG
{ "EREMCHG", EREMCHG, 82 },
#endif
#ifdef EREMOTE
{ "EREMOTE", EREMOTE, 66 },
#endif
#ifdef EROFS
{ "EROFS", EROFS, 30 },
#endif
#ifdef ESHUTDOWN
{ "ESHUTDOWN", ESHUTDOWN, 110 },
#endif
#ifdef ESOCKTNOSUPPORT
{ "ESOCKTNOSUPPORT", ESOCKTNOSUPPORT, 124 },
#endif
#ifdef ESPIPE
{ "ESPIPE", ESPIPE, 29 },
#endif
#ifdef ESRCH
{ "ESRCH", ESRCH, 3 },
#endif
#ifdef ESRMNT
{ "ESRMNT", ESRMNT, 69 },
#endif
#ifdef ESTALE
{ "ESTALE", ESTALE, 133 },
#endif
#ifdef ESTRPIPE
{ "ESTRPIPE", ESTRPIPE, 143 },
#endif
#ifdef ETIME
{ "ETIME", ETIME, 62 },
#endif
@ -278,11 +386,20 @@ CB_TARGET_DEFS_MAP cb_init_errno_map[] = {
#ifdef ETXTBSY
{ "ETXTBSY", ETXTBSY, 26 },
#endif
#ifdef EUNATCH
{ "EUNATCH", EUNATCH, 42 },
#endif
#ifdef EUSERS
{ "EUSERS", EUSERS, 131 },
#endif
#ifdef EWOULDBLOCK
{ "EWOULDBLOCK", EWOULDBLOCK, 11 },
#endif
#ifdef EXDEV
{ "EXDEV", EXDEV, 18 },
#endif
#ifdef EXFULL
{ "EXFULL", EXFULL, 52 },
#endif
/* gennltvals: END */
{ NULL, -1, -1 },