Skip to content

Commit 8ad514f

Browse files
committed
Actually update to 1.2.2.
1 parent 00ec827 commit 8ad514f

File tree

172 files changed

+1810
-2738
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

172 files changed

+1810
-2738
lines changed

src/library_pthread.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -533,12 +533,8 @@ var LibraryPThread = {
533533
threadInfoStruct: threadParams.pthread_ptr
534534
};
535535
var tis = pthread.threadInfoStruct >> 2;
536-
Atomics.store(HEAPU32, tis + ({{{ C_STRUCTS.pthread.threadStatus }}} >> 2), 0); // threadStatus <- 0, meaning not yet exited.
537-
Atomics.store(HEAPU32, tis + ({{{ C_STRUCTS.pthread.threadExitCode }}} >> 2), 0); // threadExitCode <- 0.
538-
Atomics.store(HEAPU32, tis + ({{{ C_STRUCTS.pthread.profilerBlock }}} >> 2), 0); // profilerBlock <- 0.
539536
Atomics.store(HEAPU32, tis + ({{{ C_STRUCTS.pthread.detach_state }}} >> 2), threadParams.detached);
540537
Atomics.store(HEAPU32, tis + ({{{ C_STRUCTS.pthread.tsd }}} >> 2), tlsMemory); // Init thread-local-storage memory array.
541-
Atomics.store(HEAPU32, tis + ({{{ C_STRUCTS.pthread.tsd_used }}} >> 2), 0); // Mark initial status to unused.
542538
Atomics.store(HEAPU32, tis + ({{{ C_STRUCTS.pthread.tid }}} >> 2), pthread.threadInfoStruct); // Main thread ID.
543539

544540
Atomics.store(HEAPU32, tis + ({{{ C_STRUCTS.pthread.stack_size }}} >> 2), threadParams.stackSize);

src/library_pthread_stub.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,21 @@ var LibraryPThreadStub = {
1717
#endif
1818
},
1919

20-
_pthread_cleanup_push__sig: 'viii',
21-
_pthread_cleanup_push: function(ptr, routine, arg) {
20+
pthread_cleanup_push__sig: 'vii',
21+
pthread_cleanup_push: function(routine, arg) {
2222
__ATEXIT__.push({ func: routine, arg: arg });
23-
__pthread_cleanup_push.level = __ATEXIT__.length;
23+
_pthread_cleanup_push.level = __ATEXIT__.length;
2424
},
2525

26-
_pthread_cleanup_pop__deps: ['_pthread_cleanup_push'],
27-
_pthread_cleanup_pop__sig: 'vii',
28-
_pthread_cleanup_pop: function(ptr, execute) {
29-
assert(__pthread_cleanup_push.level == __ATEXIT__.length, 'cannot pop if something else added meanwhile!');
26+
pthread_cleanup_pop__deps: ['pthread_cleanup_push'],
27+
pthread_cleanup_pop__sig: 'vi',
28+
pthread_cleanup_pop: function(execute) {
29+
assert(_pthread_cleanup_push.level == __ATEXIT__.length, 'cannot pop if something else added meanwhile!');
3030
callback = __ATEXIT__.pop();
3131
if (execute) {
3232
{{{ makeDynCall('vi', 'callback.func') }}}(callback.arg)
3333
}
34-
__pthread_cleanup_push.level = __ATEXIT__.length;
34+
_pthread_cleanup_push.level = __ATEXIT__.length;
3535
},
3636

3737
{{{ USE_LSAN || USE_ASAN ? 'emscripten_builtin_' : '' }}}pthread_create: function() {

src/library_syscall.js

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,26 @@ var SyscallsLibrary = {
2525
umask: 0x1FF, // S_IRWXU | S_IRWXG | S_IRWXO
2626

2727
// shared utilities
28-
calculateAt: function(dirfd, path) {
29-
if (path[0] !== '/') {
30-
// relative path
31-
var dir;
32-
if (dirfd === {{{ cDefine('AT_FDCWD') }}}) {
33-
dir = FS.cwd();
34-
} else {
35-
var dirstream = FS.getStream(dirfd);
36-
if (!dirstream) throw new FS.ErrnoError({{{ cDefine('EBADF') }}});
37-
dir = dirstream.path;
28+
calculateAt: function(dirfd, path, allowEmpty) {
29+
if (path[0] === '/') {
30+
return path;
31+
}
32+
// relative path
33+
var dir;
34+
if (dirfd === {{{ cDefine('AT_FDCWD') }}}) {
35+
dir = FS.cwd();
36+
} else {
37+
var dirstream = FS.getStream(dirfd);
38+
if (!dirstream) throw new FS.ErrnoError({{{ cDefine('EBADF') }}});
39+
dir = dirstream.path;
40+
}
41+
if (path.length == 0) {
42+
if (!allowEmpty) {
43+
throw new FS.ErrnoError({{{ cDefine('ENOENT') }}});;
3844
}
39-
path = PATH.join2(dir, path);
45+
return dir;
4046
}
41-
return path;
47+
return PATH.join2(dir, path);
4248
},
4349

4450
doStat: function(func, path, buf) {
@@ -1273,11 +1279,12 @@ var SyscallsLibrary = {
12731279
__sys_fstatat64: function(dirfd, path, buf, flags) {
12741280
path = SYSCALLS.getStr(path);
12751281
var nofollow = flags & {{{ cDefine('AT_SYMLINK_NOFOLLOW') }}};
1276-
flags = flags & (~{{{ cDefine('AT_SYMLINK_NOFOLLOW') }}});
1282+
var allowEmpty = flags & {{{ cDefine('AT_EMPTY_PATH') }}};
1283+
flags = flags & (~{{{ cDefine('AT_SYMLINK_NOFOLLOW') | cDefine('AT_EMPTY_PATH') }}});
12771284
#if ASSERTIONS
12781285
assert(!flags, flags);
12791286
#endif
1280-
path = SYSCALLS.calculateAt(dirfd, path);
1287+
path = SYSCALLS.calculateAt(dirfd, path, allowEmpty);
12811288
return SYSCALLS.doStat(nofollow ? FS.lstat : FS.stat, path, buf);
12821289
},
12831290
__sys_unlinkat: function(dirfd, path, flags) {

src/struct_info.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@
131131
"O_WRONLY",
132132
"AT_FDCWD",
133133
"AT_SYMLINK_NOFOLLOW",
134-
"AT_REMOVEDIR"
134+
"AT_REMOVEDIR",
135+
"AT_EMPTY_PATH"
135136
],
136137
"structs": {
137138
"flock": [

src/struct_info_internal.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,15 @@
33
// libc - internal
44
// ===========================================
55
{
6-
"file": "system/lib/libc/musl/src/internal/pthread_impl.h",
6+
"file": "pthread_impl.h",
77
"structs": {
88
"pthread": [
99
"threadStatus",
1010
"threadExitCode",
1111
"profilerBlock",
1212
"self",
1313
"tsd",
14-
"tsd_used",
15-
"detached",
14+
"detach_state",
1615
"stack",
1716
"stack_size",
1817
"attr",
@@ -26,7 +25,7 @@
2625
"defines": ["__ATTRP_C11_THREAD"]
2726
},
2827
{
29-
"file": "system/lib/libc/musl/src/internal/libc.h",
28+
"file": "libc.h",
3029
"structs": {
3130
"libc": [
3231
"global_locale"

system/lib/dlmalloc.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -856,6 +856,10 @@ extern "C" {
856856
#ifndef USE_DL_PREFIX
857857
// XXX Emscripten XXX
858858
#if defined(__EMSCRIPTEN__)
859+
void* __libc_malloc(size_t) __attribute__((weak, alias("dlmalloc")));
860+
void __libc_free(void*) __attribute__((weak, alias("dlfree")));
861+
void* __libc_calloc(size_t) __attribute__((weak, alias("dlcalloc")));
862+
void* __libc_realloc(void*, size_t) __attribute__((weak, alias("dlrealloc")));
859863
void* malloc(size_t) __attribute__((weak, alias("dlmalloc")));
860864
void free(void*) __attribute__((weak, alias("dlfree")));
861865
void* calloc(size_t, size_t) __attribute__((weak, alias("dlcalloc")));

system/lib/emmalloc.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -829,6 +829,7 @@ void *emmalloc_memalign(size_t alignment, size_t size)
829829
return ptr;
830830
}
831831
extern __typeof(emmalloc_memalign) emscripten_builtin_memalign __attribute__((alias("emmalloc_memalign")));
832+
extern __typeof(emmalloc_memalign) __libc_memalign __attribute__((alias("emmalloc_memalign")));
832833

833834
void * EMMALLOC_EXPORT memalign(size_t alignment, size_t size)
834835
{
@@ -847,6 +848,7 @@ void *emmalloc_malloc(size_t size)
847848
return emmalloc_memalign(MALLOC_ALIGNMENT, size);
848849
}
849850
extern __typeof(emmalloc_malloc) emscripten_builtin_malloc __attribute__((alias("emmalloc_malloc")));
851+
extern __typeof(emmalloc_malloc) __libc_malloc __attribute__((alias("emmalloc_malloc")));
850852

851853
void * EMMALLOC_EXPORT malloc(size_t size)
852854
{
@@ -948,6 +950,7 @@ void emmalloc_free(void *ptr)
948950
#endif
949951
}
950952
extern __typeof(emmalloc_free) emscripten_builtin_free __attribute__((alias("emmalloc_free")));
953+
extern __typeof(emmalloc_free) __libc_free __attribute__((alias("emmalloc_free")));
951954

952955
void EMMALLOC_EXPORT free(void *ptr)
953956
{
@@ -1143,6 +1146,7 @@ void *emmalloc_realloc(void *ptr, size_t size)
11431146
{
11441147
return emmalloc_aligned_realloc(ptr, MALLOC_ALIGNMENT, size);
11451148
}
1149+
extern __typeof(emmalloc_realloc) __libc_realloc __attribute__((alias("emmalloc_realloc")));
11461150

11471151
void * EMMALLOC_EXPORT realloc(void *ptr, size_t size)
11481152
{
@@ -1178,6 +1182,7 @@ void *emmalloc_calloc(size_t num, size_t size)
11781182
memset(ptr, 0, bytes);
11791183
return ptr;
11801184
}
1185+
extern __typeof(emmalloc_calloc) __libc_calloc __attribute__((alias("emmalloc_calloc")));
11811186

11821187
void * EMMALLOC_EXPORT calloc(size_t num, size_t size)
11831188
{

system/lib/libc/emscripten_pthread.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
#if !__EMSCRIPTEN_PTHREADS__
66
static struct pthread __main_pthread;
7-
pthread_t __pthread_self(void) {
8-
return &__main_pthread;
7+
uintptr_t __get_tp(void) {
8+
return (uintptr_t)&__main_pthread;
99
}
1010

1111
__attribute__((constructor))

system/lib/libc/musl/INSTALL

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ and ABI combinations:
8686

8787
* SuperH (SH)
8888
* Standard ELF ABI or FDPIC ABI (shared-text without MMU)
89-
* Little-endian by default; big-engian variant also supported
89+
* Little-endian by default; big-endian variant also supported
9090
* Full FPU ABI or soft-float ABI is supported, but the
9191
single-precision-only FPU ABI is not
9292

system/lib/libc/musl/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.2.1
1+
1.2.2

0 commit comments

Comments
 (0)