Open langston-barrett opened 6 days ago
Beware that system loaders vary and you can also get into all kinds of subtle problems... not that there's necessarily a better solution. There's ldd(1) but traditionally it works by setting some environment variables and running the program, and that's not always acceptable. And it seems to be missing on macos. (Though some quick searching suggests the environment variables method does exist.)
Data.Macaw.Memory.ElfLoader.DyanmicDependencies
was ported from ambient-verifier
, and the only reason why ambient-verifier
requires all shared libraries to live in a single directory was because of engineering constraints, not because of deeper technical reasons. I agree that it would be nicer if it could be a little smarter.
I also agree with @sauclovian-g that it's unwise to try and make macaw
's version quite as fully-featured as a system loader, as system loaders are rife with additional complexity that we likely do not want.
(sorry, I feel like maybe I shouldn't rename other people's issues, but that's been bugging me)
Macaw's current mechanism for resolving functions in shared libraries relies on having all of the shared libraries in a single directory. It would be nice to lift this restriction by implementing a library search procedure similar to the one described in
man 8 ld.so
. Then, tools based on Macaw could discover and load shared libraries as would be done by the actual system loader, without further user intervention.