LD_PRELOAD and LD_AUDIT are the features of the dynamic linker or ld.so. The dynamic linker is a process to read an executable and DSOs in memory, fix up images in memory to make it really ready to be executed by a CPU. lld is a linker which creates executable or DSO files. That is different from the dynamic linker.
Re:New ELF Linker from the LLVM Project
by unclesaamm on Tuesday December 01, 2015 @11:05AM
(#10656375)
> The basics of dynamic linking is actually pretty simple, but it's tricky to find reference materials outside of reading the source code itself.
I recommend the dynamic linking chapter in "Linkers & Loaders" by John Levine: http://www.iecc.com/linker/
Re:New ELF Linker from the LLVM Project
by Aardwolf on Tuesday December 01, 2015 @11:20AM
(#10656514)
Hyperdrives ancient technology? Are you from the future, or from the Star Wars universe? :)
This may be a reference to a SciFi trope where a space faring society has use of hyperdrive technology that it bought/stole/inherited from an older civilization, but doesn't have any ability to create and/repair
The basics of dynamic linking is actually pretty simple, but it's tricky to find reference materials outside of reading the source code itself. A modern, mature dynamic linker supports a lot of very interesting and very powerful features, from LD_PRELOAD to LD_AUDIT to `dlmopen` (linker namespaces.)
I wonder whether this new linker plans to support all of these advanced features.
I've spent some time with these features to accomplish tasks such as:
- embedding Python interpreters within themselves using `dlmopen` (linker namespaces): https://gist.github.com/dutc/cf808ec7d8e1c36e01cc https://gist.github.com/dutc/423d0d0ccba771cf910f https://gist.github.com/dutc/eba9b2f7980f400f6287 https://gist.github.com/dutc/2866d969d5e9209d501a
- writing LD_PRELOAD-like modules in Python: https://gist.github.com/dutc/6500c804b2f0141c9757
I think the LD_AUDIT approach taken by the latter project could also lead to re-implementing a dynamic linker in Python itself via the system's linker's auditing mechanism. This might be a very interesting educational exercise!