Thread: Elf and linking

  1. #1
    Registered User
    Join Date
    Oct 2004
    Posts
    36

    Elf and linking

    Hi all,

    I am cross compiling for an ARM device and don't have access to the dloopen/dlsym etc functions to manipulate shared ELF libraries - what I do have is access to libelf.

    I am wondering if anyone has experience with libelf, or manually resolving symbols in shared libraries?

    I have a simple shared library (for testing) with two simple functions in it, and no external dependencies. The 'add' function just adds one to the number that you pass it and returns it, and the 'subtract' function returns the input minus one.

    After I have loaded the .text and .data section to memory, how can I find out the addresses of the two functions (similar to the dlsym( lib, 'subtract'); type call that would be used if dlopen was available).

    Any help greatly appreciated.

    Pea

  2. #2
    Registered Luser cwr's Avatar
    Join Date
    Jul 2005
    Location
    Sydney, Australia
    Posts
    869
    This is immensely offtopic.

    At the very least, it belongs in Linux programming, but 5 seconds on google would show that libelf has its own support list:

    http://directory.fsf.org/libs/misc/libelf.html

  3. #3
    Registered User
    Join Date
    Oct 2004
    Posts
    36
    Thanks CWR, though why so nasty?

    My ARM device has nothing to do with linux, and ELF isn't linux specific.

    Also, i have been googling ELF and linkers for a few weeks, and for some reason have managed to miss this link.

    Cheers,
    Pea

  4. #4
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,079
    Quote Originally Posted by Pea
    Thanks CWR, though why so nasty?
    Hey, that's just how he rolls.

    Also, this isn't quite on the topic of C programming. Sorry I can't really help with your question, though. The only ELF I know have pointy ears.
    Sent from my iPadŽ

  5. #5
    Registered User
    Join Date
    Oct 2004
    Posts
    36
    Yeah, sorry, if its any consolation, development is all in c - plus there are many,many members here so i hoped someone could help.

    Thanks guys - the link from CWR is an email address so I will try there.

  6. #6
    Registered Luser cwr's Avatar
    Join Date
    Jul 2005
    Location
    Sydney, Australia
    Posts
    869
    Quote Originally Posted by Pea
    Thanks CWR, though why so nasty?

    My ARM device has nothing to do with linux, and ELF isn't linux specific.

    Also, i have been googling ELF and linkers for a few weeks, and for some reason have managed to miss this link.

    Cheers,
    Pea
    Sorry for seeming nasty.

    I googled for libelf and clicked "I'm feeling lucky" to get that link. It was quite skillful

    You're right that ELF isn't linux specific, but given that we have "C Programming", "Windows Programming" and "Linux Programming", someone with knowledge of what ELF is would probably know that it's more appropriate to post something related to ELF in a Linux forum given the above choices.

    Since you gave no indication that you'd looked for the answer anywhere else, my reply may have sounded harsh. Had you said something like "I've looked at resource X, Y, and Z but found nothing", I'd have probably replied more amicably.

  7. #7
    Registered User
    Join Date
    Oct 2004
    Posts
    36
    No problem. I would have done the same . I'll try the linux board too.

    Cheers,
    Pea

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. linking to assembly
    By xixpsychoxix in forum C Programming
    Replies: 21
    Last Post: 07-16-2008, 03:51 PM
  2. Elf and Linking
    By Pea in forum Linux Programming
    Replies: 0
    Last Post: 11-22-2005, 11:50 PM