Skip to content

Commit 4aa1f81

Browse files
Modify musl errno messages to match llvm-libc (#24983)
1 parent f7d2390 commit 4aa1f81

20 files changed

+62
-59
lines changed

system/lib/libc/musl/src/errno/__strerror.h

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22
* This file is included multiple times to declare and define a structure
33
* with these messages, and then to define a lookup table translating
44
* error codes to offsets of corresponding fields in the structure. */
5-
5+
#if defined(__EMSCRIPTEN__)
6+
// This is intended to match the errno in llvm-libc.
7+
E(0, "Success")
8+
#else
69
E(0, "No error information")
10+
#endif
711

812
E(EILSEQ, "Illegal byte sequence")
913
E(EDOM, "Domain error")
@@ -16,7 +20,12 @@ E(ENOENT, "No such file or directory")
1620
E(ESRCH, "No such process")
1721
E(EEXIST, "File exists")
1822

23+
#if defined(__EMSCRIPTEN__)
24+
// This is intended to match the errno in llvm-libc.
25+
E(EOVERFLOW, "Value too large for defined data type")
26+
#else
1927
E(EOVERFLOW, "Value too large for data type")
28+
#endif
2029
E(ENOSPC, "No space left on device")
2130
E(ENOMEM, "Out of memory")
2231

@@ -62,7 +71,11 @@ E(ENOLCK, "No locks available")
6271

6372
E(EDEADLK, "Resource deadlock would occur")
6473
E(ENOTRECOVERABLE, "State not recoverable")
74+
#if defined(__EMSCRIPTEN__)
75+
E(EOWNERDEAD, "Owner died")
76+
#else
6577
E(EOWNERDEAD, "Previous owner died")
78+
#endif
6679
E(ECANCELED, "Operation canceled")
6780
E(ENOSYS, "Function not implemented")
6881
E(ENOMSG, "No message of desired type")

system/lib/llvm-libc/src/__support/StringUtil/tables/posix_errors.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,7 @@ LIBC_INLINE_VAR constexpr MsgTable<76> POSIX_ERRORS = {
6363
MsgMapping(EPROTO, "Protocol error"),
6464
MsgMapping(EMULTIHOP, "Multihop attempted"),
6565
MsgMapping(EBADMSG, "Bad message"),
66-
#ifdef __EMSCRIPTEN__
67-
// For now, match the musl string
68-
MsgMapping(EOVERFLOW, "Value too large for data type"),
69-
#else
7066
MsgMapping(EOVERFLOW, "Value too large for defined data type"),
71-
#endif
7267
MsgMapping(ENOTSOCK, "Socket operation on non-socket"),
7368
MsgMapping(EDESTADDRREQ, "Destination address required"),
7469
MsgMapping(EMSGSIZE, "Message too long"),

system/lib/llvm-libc/src/__support/StringUtil/tables/stdc_errors.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,7 @@
1616
namespace LIBC_NAMESPACE_DECL {
1717

1818
LIBC_INLINE_VAR constexpr const MsgTable<4> STDC_ERRORS = {
19-
#ifdef __EMSCRIPTEN__
20-
// For now, match the musl name for errno 0.
21-
MsgMapping(0, "No error information"),
22-
#else
2319
MsgMapping(0, "Success"),
24-
#endif
2520
MsgMapping(EDOM, "Numerical argument out of domain"),
2621
MsgMapping(ERANGE, "Numerical result out of range"),
2722
MsgMapping(EILSEQ, "Invalid or incomplete multibyte or wide character"),

test/code_size/test_codesize_cxx_except.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"a.out.js": 23414,
33
"a.out.js.gz": 9144,
4-
"a.out.nodebug.wasm": 171285,
5-
"a.out.nodebug.wasm.gz": 57342,
6-
"total": 194699,
7-
"total_gz": 66486,
4+
"a.out.nodebug.wasm": 171270,
5+
"a.out.nodebug.wasm.gz": 57331,
6+
"total": 194684,
7+
"total_gz": 66475,
88
"sent": [
99
"__cxa_begin_catch",
1010
"__cxa_end_catch",

test/code_size/test_codesize_cxx_except_wasm.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"a.out.js": 19642,
33
"a.out.js.gz": 8109,
4-
"a.out.nodebug.wasm": 144643,
4+
"a.out.nodebug.wasm": 144629,
55
"a.out.nodebug.wasm.gz": 54892,
6-
"total": 164285,
6+
"total": 164271,
77
"total_gz": 63001,
88
"sent": [
99
"_abort_js",

test/code_size/test_codesize_cxx_except_wasm_legacy.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"a.out.js": 19642,
33
"a.out.js.gz": 8109,
4-
"a.out.nodebug.wasm": 142232,
5-
"a.out.nodebug.wasm.gz": 54356,
6-
"total": 161874,
7-
"total_gz": 62465,
4+
"a.out.nodebug.wasm": 142218,
5+
"a.out.nodebug.wasm.gz": 54353,
6+
"total": 161860,
7+
"total_gz": 62462,
88
"sent": [
99
"_abort_js",
1010
"_tzset_js",

test/code_size/test_codesize_cxx_mangle.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"a.out.js": 23465,
33
"a.out.js.gz": 9164,
4-
"a.out.nodebug.wasm": 235325,
5-
"a.out.nodebug.wasm.gz": 78943,
6-
"total": 258790,
7-
"total_gz": 88107,
4+
"a.out.nodebug.wasm": 235311,
5+
"a.out.nodebug.wasm.gz": 78929,
6+
"total": 258776,
7+
"total_gz": 88093,
88
"sent": [
99
"__cxa_begin_catch",
1010
"__cxa_end_catch",

test/code_size/test_codesize_hello_O0.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"a.out.js": 22497,
33
"a.out.js.gz": 8329,
4-
"a.out.nodebug.wasm": 15143,
5-
"a.out.nodebug.wasm.gz": 7452,
6-
"total": 37640,
7-
"total_gz": 15781,
4+
"a.out.nodebug.wasm": 15127,
5+
"a.out.nodebug.wasm.gz": 7448,
6+
"total": 37624,
7+
"total_gz": 15777,
88
"sent": [
99
"fd_write"
1010
],

test/code_size/test_codesize_hello_dylink_all.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"a.out.js": 246640,
3-
"a.out.nodebug.wasm": 597718,
4-
"total": 844358,
3+
"a.out.nodebug.wasm": 597702,
4+
"total": 844342,
55
"sent": [
66
"IMG_Init",
77
"IMG_Load",
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
{
22
"hello_world.js": 53809,
33
"hello_world.js.gz": 17016,
4-
"hello_world.wasm": 15143,
5-
"hello_world.wasm.gz": 7452,
4+
"hello_world.wasm": 15127,
5+
"hello_world.wasm.gz": 7448,
66
"no_asserts.js": 26387,
77
"no_asserts.js.gz": 8797,
88
"no_asserts.wasm": 12227,
99
"no_asserts.wasm.gz": 6008,
1010
"strict.js": 51847,
1111
"strict.js.gz": 16341,
12-
"strict.wasm": 15143,
13-
"strict.wasm.gz": 7438,
14-
"total": 174556,
15-
"total_gz": 63052
12+
"strict.wasm": 15127,
13+
"strict.wasm.gz": 7445,
14+
"total": 174524,
15+
"total_gz": 63055
1616
}

0 commit comments

Comments
 (0)