Find the answer to your Linux question:
Results 1 to 4 of 4
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Feb 2005
    Delft, Holland

    Omitting undefined symbols

    I want to compile a program for 2 machines, one for the x86 (for testing) and one for the ARM (which is the actual target machine), the ARM machine has an LED screen, and during the program many LED functions are called, these are located in a library that can only be build for the ARM machine.

    When I compile for the x86, I get a lot of undefined errors, which is logical since the linker skips the ARM-library and searches for the functions somewhere else, in vain.
    Can't I tell the linker that if he couldn't find the function, he just removes the actual function call from the binary?

  2. #2
    Probably not.The right time to remove the functions is during compilation
    using #ifdef

  3. #3
    Just Joined!
    Join Date
    Feb 2005
    Delft, Holland
    Well I solved it by creating some stub functions for the x86 compilation.

    I thought about using #ifdef but they make the code so ugly that I only use #ifdef's if there's no other option.

    Still, I'd like to know if removing the functions calls during link-time is uberhaupt possible.

  4. $spacer_open
  5. #4
    Not really.

    If the symbol is there the linker has to resolve it. That's the way it works.
    For stuff like this I create an object file loaded with dummy do-nothing symbols for the calls I cannot resolve and do not need on a test box.

    Then my make files invoke different link paths to bring in either the real or the dummy versions of the code. Just like your stubs.

    cc myfile.c dummy.o -o myfile -L/path/mylibs
    cc myfile.c -o myfile -L/path1  -L/path2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts