Commit 894496e
[dylink] Normalize library paths to prevent duplicate loading
When a shared library in a subdirectory references a dependency via
$ORIGIN/.. rpath, findLibraryFS resolves it to a non-canonical path
containing ".." (e.g. "sub/../lib.so"). Since loadDynamicLibrary uses
the raw path as the LDSO key, this causes the same library to be loaded
twice under different names, running constructors twice.
Fix by normalizing libName with PATH.normalize() at the top of
loadDynamicLibrary, matching what dlopenInternal already does.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 68c7164 commit 894496e
2 files changed
Lines changed: 56 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1103 | 1103 | | |
1104 | 1104 | | |
1105 | 1105 | | |
| 1106 | + | |
| 1107 | + | |
1106 | 1108 | | |
1107 | 1109 | | |
1108 | 1110 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6884 | 6884 | | |
6885 | 6885 | | |
6886 | 6886 | | |
| 6887 | + | |
| 6888 | + | |
| 6889 | + | |
| 6890 | + | |
| 6891 | + | |
| 6892 | + | |
| 6893 | + | |
| 6894 | + | |
| 6895 | + | |
| 6896 | + | |
| 6897 | + | |
| 6898 | + | |
| 6899 | + | |
| 6900 | + | |
| 6901 | + | |
| 6902 | + | |
| 6903 | + | |
| 6904 | + | |
| 6905 | + | |
| 6906 | + | |
| 6907 | + | |
| 6908 | + | |
| 6909 | + | |
| 6910 | + | |
| 6911 | + | |
| 6912 | + | |
| 6913 | + | |
| 6914 | + | |
| 6915 | + | |
| 6916 | + | |
| 6917 | + | |
| 6918 | + | |
| 6919 | + | |
| 6920 | + | |
| 6921 | + | |
| 6922 | + | |
| 6923 | + | |
| 6924 | + | |
| 6925 | + | |
| 6926 | + | |
| 6927 | + | |
| 6928 | + | |
| 6929 | + | |
| 6930 | + | |
| 6931 | + | |
| 6932 | + | |
| 6933 | + | |
| 6934 | + | |
| 6935 | + | |
| 6936 | + | |
| 6937 | + | |
| 6938 | + | |
| 6939 | + | |
| 6940 | + | |
6887 | 6941 | | |
6888 | 6942 | | |
6889 | 6943 | | |
| |||
0 commit comments