Commit fb4a23b
authored
[dylink] Fix rpath calculation in nested dependencies (#24234)
This fixes a bug in rpath calculation in nested dependencies.
Basically, it fixes a case when a relative path is passed to the
`loadDynamicLibrary`.
Think of the following scenario:
0. libhello.wasm depends on libhello_dep.so depends on
libhello_nested_dep.so
1. [main.c] calls dlopen('/usr/lib/libhello.wasm')
2. [dynlink.c] calls `loadDynamicLibrary('/usr/lib/libhello.wasm')`
(_dlopen_js ==> dlopenInternal ==> loadDynamicLibrary)
3. [libdylink.js] inside `loadDynamicLibrary('/usr/lib/libhello.wasm')`,
it loads the dependency `libhello_dep.so`. When locating
`libhello_dep.so`, it uses `parentLibPath: /usr/lib/libhello.wasm` it
locates the library correctly from `/usr/lib/libhello_dep.so`.
5. [libdylink.js] Now we call `loadDynamicLibrary('libhello_dep.so')`,
and it loads its dependency 'libhello_nested_dep.so' first. In this case
it uses `parentLibPath: libhello_dep.so` so it fails to locate the
library.1 parent 49a5c1d commit fb4a23b
File tree
4 files changed
+35
-16
lines changed- src/lib
- test
- codesize
4 files changed
+35
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
977 | 977 | | |
978 | 978 | | |
979 | 979 | | |
980 | | - | |
981 | | - | |
982 | | - | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
983 | 986 | | |
984 | 987 | | |
985 | 988 | | |
986 | 989 | | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
987 | 993 | | |
988 | 994 | | |
989 | 995 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
| 2 | + | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
| 6 | + | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6773 | 6773 | | |
6774 | 6774 | | |
6775 | 6775 | | |
| 6776 | + | |
| 6777 | + | |
| 6778 | + | |
| 6779 | + | |
| 6780 | + | |
| 6781 | + | |
| 6782 | + | |
| 6783 | + | |
6776 | 6784 | | |
6777 | 6785 | | |
6778 | 6786 | | |
| 6787 | + | |
| 6788 | + | |
6779 | 6789 | | |
6780 | 6790 | | |
| 6791 | + | |
6781 | 6792 | | |
6782 | 6793 | | |
6783 | 6794 | | |
| |||
6804 | 6815 | | |
6805 | 6816 | | |
6806 | 6817 | | |
6807 | | - | |
| 6818 | + | |
6808 | 6819 | | |
6809 | 6820 | | |
6810 | 6821 | | |
| |||
6819 | 6830 | | |
6820 | 6831 | | |
6821 | 6832 | | |
6822 | | - | |
6823 | | - | |
| 6833 | + | |
| 6834 | + | |
| 6835 | + | |
6824 | 6836 | | |
6825 | | - | |
| 6837 | + | |
6826 | 6838 | | |
6827 | | - | |
6828 | | - | |
| 6839 | + | |
| 6840 | + | |
| 6841 | + | |
6829 | 6842 | | |
6830 | 6843 | | |
6831 | 6844 | | |
6832 | 6845 | | |
6833 | 6846 | | |
6834 | 6847 | | |
6835 | | - | |
| 6848 | + | |
6836 | 6849 | | |
6837 | 6850 | | |
6838 | 6851 | | |
| |||
0 commit comments