Skip to content

Commit 401b359

Browse files
authored
Remove mmap dependency from musl's locale code (#12260)
This removes the mmap dependency from musl's locale code, and by doing that fixes a dependency bug with libc++ using locale code that causes mmap to be included, and mmap from JS needs malloc/free which we no longer include since #12213 That seems nicer anyhow, as mmap was only used there when the user provided MUSL_LOCPATH - I don't think it's worth it for us to support that nonstandard option.
1 parent 54dd918 commit 401b359

8 files changed

+3
-12
lines changed

system/lib/libc/musl/src/locale/locale_map.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ const struct __locale_map *__get_locale(int cat, const char *val)
6565
return p;
6666
}
6767

68+
#ifndef __EMSCRIPTEN__ // don't support MUSL_LOCPATH which uses mmap
6869
if (!libc.secure) path = getenv("MUSL_LOCPATH");
6970
/* FIXME: add a default path? */
7071

@@ -93,6 +94,7 @@ const struct __locale_map *__get_locale(int cat, const char *val)
9394
break;
9495
}
9596
}
97+
#endif
9698

9799
/* If no locale definition was found, make a locale map
98100
* object anyway to store the name, which is kept for the

tests/other/metadce/hello_libcxx_O2.imports

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
__indirect_function_table
2-
__map_file
3-
__sys_munmap
42
abort
53
emscripten_memcpy_big
64
emscripten_resize_heap

tests/other/metadce/hello_libcxx_O2.sent

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
__cxa_atexit
22
__indirect_function_table
3-
__map_file
4-
__sys_munmap
53
abort
64
emscripten_memcpy_big
75
emscripten_resize_heap

tests/other/metadce/hello_libcxx_O2_fexceptions.imports

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ __cxa_rethrow
88
__cxa_throw
99
__cxa_uncaught_exceptions
1010
__indirect_function_table
11-
__map_file
1211
__resumeException
13-
__sys_munmap
1412
abort
1513
emscripten_memcpy_big
1614
emscripten_resize_heap

tests/other/metadce/hello_libcxx_O2_fexceptions.sent

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ __cxa_rethrow
99
__cxa_throw
1010
__cxa_uncaught_exceptions
1111
__indirect_function_table
12-
__map_file
1312
__resumeException
14-
__sys_munmap
1513
abort
1614
emscripten_memcpy_big
1715
emscripten_resize_heap

tests/other/metadce/hello_libcxx_O2_fexceptions_DEMANGLE_SUPPORT.imports

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ __cxa_rethrow
88
__cxa_throw
99
__cxa_uncaught_exceptions
1010
__indirect_function_table
11-
__map_file
1211
__resumeException
13-
__sys_munmap
1412
abort
1513
emscripten_memcpy_big
1614
emscripten_resize_heap

tests/other/metadce/hello_libcxx_O2_fexceptions_DEMANGLE_SUPPORT.sent

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ __cxa_rethrow
99
__cxa_throw
1010
__cxa_uncaught_exceptions
1111
__indirect_function_table
12-
__map_file
1312
__resumeException
14-
__sys_munmap
1513
abort
1614
emscripten_memcpy_big
1715
emscripten_resize_heap

tests/test_core.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5551,6 +5551,7 @@ def test_stdvec(self):
55515551
self.do_run_in_out_file_test('tests', 'core', 'test_stdvec.cpp')
55525552

55535553
def test_random_device(self):
5554+
self.maybe_closure()
55545555
self.do_run_in_out_file_test('tests', 'core', 'test_random_device.cpp')
55555556

55565557
def test_reinterpreted_ptrs(self):

0 commit comments

Comments
 (0)