Make RTLD_LOCAL work correctly for recursively loaded DSOs#18924
Conversation
3dad6f6 to
ee8da4b
Compare
src/library_dylink.js
Outdated
|
|
||
| if (typeof result == 'function') { | ||
| // Workaround for closure compiler error if f.stub is accessed directly | ||
| // on the line below. |
There was a problem hiding this comment.
Weird error... what's the error message, if you still have it?
There was a problem hiding this comment.
Closure says that Function does not have a stub attribute. Which is true for most functions, but we sometimes at them, which I guess is not something closure likes in general (attributes that might or might not exist). Should I add more detail to the comment?
There was a problem hiding this comment.
No need, thanks, I was just curious.
There was a problem hiding this comment.
I think the problem is that closure treat the if (typeof result == 'function') type refinement and will then assume that result to be of type Function.
| shutil.move(outfile, 'liblib.so') | ||
| cmd = [compiler_for(filename), filename, '-o', outfile] + self.get_emcc_args() | ||
| if emcc_args: | ||
| cmd += emcc_args |
There was a problem hiding this comment.
Why do we need this in addition to get_emcc_args() on the prevoius line?
There was a problem hiding this comment.
I used it below on the line self.build_dlfcn_lib('liba.c', outfile='liba.so', emcc_args=['libb.so'])
Here i want to set libb.so as an argument to compile step, but I don't want to add it to all the following compile steps in the test.
We have several functions that both take emcc_args and honor the global emcc_args. Sometimes it makes more sense to use one over the other I think.
There was a problem hiding this comment.
I see, thanks, I was just confused by the name then.
| shutil.move(outfile, 'liblib.so') | ||
| cmd = [compiler_for(filename), filename, '-o', outfile] + self.get_emcc_args() | ||
| if emcc_args: | ||
| cmd += emcc_args |
There was a problem hiding this comment.
I see, thanks, I was just confused by the name then.
When dlopen is first called with `RTLD_LOCAL` a new local scope is created. All symbols from the DSO being loaded and any of its transitive dependencies get added to this scrope (instead of the global scope).
…n-core#18924) When dlopen is first called with `RTLD_LOCAL` a new local scope is created. All symbols from the DSO being loaded and any of its transitive dependencies get added to this scrope (instead of the global scope).
…n-core#18924) When dlopen is first called with `RTLD_LOCAL` a new local scope is created. All symbols from the DSO being loaded and any of its transitive dependencies get added to this scrope (instead of the global scope).
When dlopen is first called with
RTLD_LOCALa new local scope is created. All symbols from the DSO being loaded and any of its transitive dependencies get added to this scrope (instead of the global scope).