April 28, 2023, 9:55am
I am creating this post to query the status of LLVM-libc regarding dynamic linking.
Has the runtime loader already been implemented in LLVM-libc ? From a quick scan of the source tree, I failed to find it.
I would be interested in following its development and even participating to it if there is still some work to do.
I have already written a simple dynamic loader a few years ago (only x86_64 and only a subset of relocation types) and enjoyed it very much.
Would this be of interest to the LLVM-libc project?
April 28, 2023, 5:24pm
Dynamic linking and runtime loading are not currently areas of focus for anyone. So there’s definitely work to do in this area if you are interested in contributing.
April 28, 2023, 6:18pm
Thanks for the reply!
If no one has gotten into this, I will try and spend some time working on this on my end. I should be able to allocate a few hours per-week to work on this.
If I make any meaningful progress, I will update this thread!
April 28, 2023, 6:49pm
Great! I look forward to following your progress.
April 30, 2023, 1:41am
We already have two dynamic loaders in LLVM as part of ExecutionEngine. Is there a meaningful way to share code between them rather than having yet another one?
April 30, 2023, 2:34am
Oh possibly? That’s definitely something to investigate. I agree that would be good, but I’m not familiar with the code. Do you know how “standalone” it is, or if it would make sense to move it under the libc tree, or if it can easily be used by the libc? (E.g. though the implementation is in C++ we cannot use code that relies on the C++ runtime.). And why are there two of them already and not one?
April 30, 2023, 10:31am
Sharing the code seems like it would be a good idea to some extent.
(E.g. though the implementation is in C++ we cannot use code that relies on the C++ runtime.)
For the runtime loader, I’d go even further and say we can’t even rely on the
libc until we load it and do its relocations since that’s our job
For that reason, we would have to try and keep dependencies to a minimum for a big part of the loader’s code.
I’m not sure what a “clean” way to do this would be yet. I can try and take a look at what musl and Glibc do for this.