Skip to content

Add dladdr to list of dummy dlfnc symbols #18896

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/library_dylink.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ var LibraryDylink = {
dlopen__deps: [function() { error(dlopenMissingError); }],
_emscripten_dlopen__deps: [function() { error(dlopenMissingError); }],
__dlsym__deps: [function() { error(dlopenMissingError); }],
dladdr__deps: [function() { error(dlopenMissingError); }],
#else
$dlopenMissingError: `= ${dlopenMissingError}`,
_dlopen_js__deps: ['$dlopenMissingError'],
Expand All @@ -256,6 +257,7 @@ var LibraryDylink = {
dlopen__deps: ['$dlopenMissingError'],
_emscripten_dlopen__deps: ['$dlopenMissingError'],
__dlsym__deps: ['$dlopenMissingError'],
dladdr__deps: ['$dlopenMissingError'],
#endif
_dlopen_js: function(handle) {
abort(dlopenMissingError);
Expand All @@ -278,6 +280,9 @@ var LibraryDylink = {
__dlsym: function(handle, symbol) {
abort(dlopenMissingError);
},
dladdr: function() {
abort(dlopenMissingError);
},
#else // MAIN_MODULE != 0
// dynamic linker/loader (a-la ld.so on ELF systems)
$LDSO__deps: ['$newDSO'],
Expand Down
16 changes: 15 additions & 1 deletion test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -12081,7 +12081,7 @@ def test_unimplemented_syscalls(self, args):
self.assertNotContained('warning: unsupported syscall', err)

def test_unimplemented_syscalls_dlopen(self):
cmd = [EMCC, test_file('other/test_dlopen_blocking.c'), '-sASSERTIONS']
cmd = [EMCC, test_file('other/test_dlopen_blocking.c')]
self.run_process(cmd)
err = self.run_js('a.out.js', assert_returncode=NON_ZERO)
self.assertContained('Aborted(To use dlopen, you need enable dynamic linking, see https://github.com/emscripten-core/emscripten/wiki/Linking)', err)
Expand All @@ -12092,6 +12092,20 @@ def test_unimplemented_syscalls_dlopen(self):
err = self.expect_fail(cmd)
self.assertContained('To use dlopen, you need enable dynamic linking, see https://github.com/emscripten-core/emscripten/wiki/Linking', err)

def test_unimplemented_syscalls_dladdr(self):
create_file('main.c', '''
#include <dlfcn.h>

int main() {
dladdr(0, 0);
return 0;
}
''')

self.run_process([EMCC, 'main.c'])
err = self.run_js('a.out.js', assert_returncode=NON_ZERO)
self.assertContained('Aborted(To use dlopen, you need enable dynamic linking, see https://github.com/emscripten-core/emscripten/wiki/Linking)', err)

@requires_v8
def test_missing_shell_support(self):
# By default shell support is not included
Expand Down