Runtime dynamic loader in LLVM-libc

Hello,

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?

Cheers,


Gaby

Hi Gaby,

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.

Regards,

1 Like

Hi dpxf,

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!

Cheers,


Gaby

Great! I look forward to following your progress.

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?

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? :slight_smile:

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 :smile:

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.