@@ -1607,6 +1607,31 @@ def test_export_all(self):
16071607 # Without the `-sEXPORT_ALL` these symbols will not be visible from JS
16081608 self.do_runf('main.c', '_libf1 is not defined', assert_returncode=NON_ZERO, cflags=['-Oz', '-sMAIN_MODULE', '--pre-js', 'pre.js'])
16091609
1610+ def test_export_all_syscall_override(self):
1611+ create_file('main.c', r'''
1612+ #include "stdio.h"
1613+ #include <fcntl.h>
1614+
1615+ int syscall_openat_orig(int dirfd, intptr_t path, int flags, void* varags)
1616+ __attribute__((__import_module__("env"),
1617+ __import_name__("__syscall_openat"), __warn_unused_result__));
1618+
1619+ int __syscall_openat(int dirfd, intptr_t path, int flags, void* varargs) {
1620+ printf("__syscall_openat!\n");
1621+ return syscall_openat_orig(dirfd, path, flags, varargs);
1622+ }
1623+
1624+ int main() {
1625+ int fd = open("a.c", O_RDONLY);
1626+ printf("fd: %d\n", fd);
1627+ }
1628+ ''')
1629+
1630+ self.do_runf('main.c', '__syscall_openat!', cflags=['-sEXPORT_ALL', '-sNODERAWFS'])
1631+ self.do_runf('main.c', '__syscall_openat!', cflags=['-sMAIN_MODULE', '-sNODERAWFS'])
1632+ self.do_runf('main.c', '__syscall_openat!', cflags=['-O2', '-sEXPORT_ALL', '-sMAIN_MODULE', '-sNODERAWFS'])
1633+ self.do_runf('main.c', '__syscall_openat!', cflags=['-sEXPORT_ALL', '-sMAIN_MODULE', '-sNODERAWFS'])
1634+
16101635 def test_export_keepalive(self):
16111636 create_file('main.c', r'''
16121637 #include <emscripten.h>
0 commit comments