Skip to content

Commit fb72111

Browse files
sbc100impact-maker
authored andcommitted
Add dladdr to list of dummy dlfnc symbols (emscripten-core#18896)
This is needed as of emscripten-core#18638 since dynlink.c is not longer included in the build when MAIN_MODULE is not set. Fixes: emscripten-core#1195
1 parent c5c52af commit fb72111

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

src/library_dylink.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ var LibraryDylink = {
247247
dlopen__deps: [function() { error(dlopenMissingError); }],
248248
_emscripten_dlopen__deps: [function() { error(dlopenMissingError); }],
249249
__dlsym__deps: [function() { error(dlopenMissingError); }],
250+
dladdr__deps: [function() { error(dlopenMissingError); }],
250251
#else
251252
$dlopenMissingError: `= ${dlopenMissingError}`,
252253
_dlopen_js__deps: ['$dlopenMissingError'],
@@ -256,6 +257,7 @@ var LibraryDylink = {
256257
dlopen__deps: ['$dlopenMissingError'],
257258
_emscripten_dlopen__deps: ['$dlopenMissingError'],
258259
__dlsym__deps: ['$dlopenMissingError'],
260+
dladdr__deps: ['$dlopenMissingError'],
259261
#endif
260262
_dlopen_js: function(handle) {
261263
abort(dlopenMissingError);
@@ -278,6 +280,9 @@ var LibraryDylink = {
278280
__dlsym: function(handle, symbol) {
279281
abort(dlopenMissingError);
280282
},
283+
dladdr: function() {
284+
abort(dlopenMissingError);
285+
},
281286
#else // MAIN_MODULE != 0
282287
// dynamic linker/loader (a-la ld.so on ELF systems)
283288
$LDSO__deps: ['$newDSO'],

test/test_other.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12081,7 +12081,7 @@ def test_unimplemented_syscalls(self, args):
1208112081
self.assertNotContained('warning: unsupported syscall', err)
1208212082

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

12095+
def test_unimplemented_syscalls_dladdr(self):
12096+
create_file('main.c', '''
12097+
#include <dlfcn.h>
12098+
12099+
int main() {
12100+
dladdr(0, 0);
12101+
return 0;
12102+
}
12103+
''')
12104+
12105+
self.run_process([EMCC, 'main.c'])
12106+
err = self.run_js('a.out.js', assert_returncode=NON_ZERO)
12107+
self.assertContained('Aborted(To use dlopen, you need enable dynamic linking, see https://github.com/emscripten-core/emscripten/wiki/Linking)', err)
12108+
1209512109
@requires_v8
1209612110
def test_missing_shell_support(self):
1209712111
# By default shell support is not included

0 commit comments

Comments
 (0)