Dwayne Slater
Dwayne Slater

Reputation: 31

Is there a way to extract the symbols from a ELF, and use LD to link another file together with the symbols defined in the previous ELF?

I'm creating an application specifically for the Nintendo Wii using devKitPro. I wanted to make my application modular by offering the ability to load code passed though objcopy -O binary. My problem is, I want the modules to be able to use symbols from the main ELF that is loaded into memory. I have tried various things and I have not come up with any solutions.

I really need help with this, as I am in neither a Windows or Linux environment.

Upvotes: 3

Views: 713

Answers (1)

user545199
user545199

Reputation:

You may consider doing this using libdl which is made precisely to load symbols by name at runtime. Using libdl you can get handles to all of the functions you want to call as part of an initialization subroutine and then have them available to you when your program needs them. best of all, you dont need to have the library you are linking against at compile time so you can replace it with any elf that has those symbols defined without recompiling.

Upvotes: 0

Related Questions