Commit 2560c87
committed
Fix nested dynamic library loading via RPATH
There is a bug with dynamic library loading. Suppose
liba.so is on LD_LIBRARY_PATH and it has an RPATH of `$ORIGIN/other_dir`
and loads `libb.so` from other_dir. Then suppose `libb.so` has an RPATH of
`$ORIGIN` and wants to load `libc.so` also from `other_dir`.
Before this PR this doesn't work. The problem is that `flags.rpath.parentLibPath`
is set to `libb.so` and we replace $ORIGIN with `PATH.dirname(parentLibName)`
which is `.`. So unless `other_dir` is on the `LD_LIBRARY_PATH` or is the
current working directory, loading will fail.
The fix: if `findLibraryFS()` returns a value that is not `undefined`, replace
`libName` with the returned value.1 parent a45c791 commit 2560c87
2 files changed
+64
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1051 | 1051 | | |
1052 | 1052 | | |
1053 | 1053 | | |
1054 | | - | |
| 1054 | + | |
1055 | 1055 | | |
1056 | 1056 | | |
1057 | 1057 | | |
| |||
1061 | 1061 | | |
1062 | 1062 | | |
1063 | 1063 | | |
| 1064 | + | |
1064 | 1065 | | |
1065 | 1066 | | |
1066 | 1067 | | |
| |||
1168 | 1169 | | |
1169 | 1170 | | |
1170 | 1171 | | |
| 1172 | + | |
1171 | 1173 | | |
1172 | 1174 | | |
1173 | 1175 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2437 | 2437 | | |
2438 | 2438 | | |
2439 | 2439 | | |
| 2440 | + | |
| 2441 | + | |
| 2442 | + | |
| 2443 | + | |
| 2444 | + | |
| 2445 | + | |
| 2446 | + | |
| 2447 | + | |
| 2448 | + | |
| 2449 | + | |
| 2450 | + | |
| 2451 | + | |
| 2452 | + | |
| 2453 | + | |
| 2454 | + | |
| 2455 | + | |
| 2456 | + | |
| 2457 | + | |
| 2458 | + | |
| 2459 | + | |
| 2460 | + | |
| 2461 | + | |
| 2462 | + | |
| 2463 | + | |
| 2464 | + | |
| 2465 | + | |
| 2466 | + | |
| 2467 | + | |
| 2468 | + | |
| 2469 | + | |
| 2470 | + | |
| 2471 | + | |
| 2472 | + | |
| 2473 | + | |
| 2474 | + | |
| 2475 | + | |
| 2476 | + | |
| 2477 | + | |
| 2478 | + | |
| 2479 | + | |
| 2480 | + | |
| 2481 | + | |
| 2482 | + | |
| 2483 | + | |
| 2484 | + | |
| 2485 | + | |
| 2486 | + | |
| 2487 | + | |
| 2488 | + | |
| 2489 | + | |
| 2490 | + | |
| 2491 | + | |
| 2492 | + | |
| 2493 | + | |
| 2494 | + | |
| 2495 | + | |
| 2496 | + | |
| 2497 | + | |
| 2498 | + | |
| 2499 | + | |
| 2500 | + | |
2440 | 2501 | | |
2441 | 2502 | | |
2442 | 2503 | | |
| |||
0 commit comments