This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

visibility of functions names in Library

Hi, I made a library. when i build executable using library, the map file created shows all functions/variables of library.

Can i strip the library, so that only functions used by executable are visible in map file ?

or when i build library, i can somehow achieve the same by some settings ?

thanks in advance for your time.

regards,
-rajan batra

Parents
  • Perhaps, I keyed off the "visibility" cue.

    If this is more of a dead code elimination question, then the trick with libraries is to break the objects inside into the smallest possible pieces. Some ARM/X86 tools do this using a section-per-function option for the compiler. Others do it by creating a file-per-function. Either way the goal is to allow the linker to determine the actual dependencies, and throw out everything that isn't used/required.

    If the linker isn't that smart you'd need to generate your own dependency trees, and apply that knowledge to the source and librarian tools, and remove as much cruft as possible before letting the linker do it's thing.

Reply
  • Perhaps, I keyed off the "visibility" cue.

    If this is more of a dead code elimination question, then the trick with libraries is to break the objects inside into the smallest possible pieces. Some ARM/X86 tools do this using a section-per-function option for the compiler. Others do it by creating a file-per-function. Either way the goal is to allow the linker to determine the actual dependencies, and throw out everything that isn't used/required.

    If the linker isn't that smart you'd need to generate your own dependency trees, and apply that knowledge to the source and librarian tools, and remove as much cruft as possible before letting the linker do it's thing.

Children
  • Hi Pier, Since i am having 7 .LIB files to be linked in to executable, MAP
    file created by linker will contain all functions/variables referred between 7 .LIB

    As per your suggestion, i will have to make one single .LIB for final linking.
    Size of this One .LIB will be greater then single bank size. so in final linking,using keil,
    i will get warning of .LIB being greater then bank.

    I am using LX51, LX51 creates single HEX format executable as output. Currently i split it into 8 banks before flashing.

    If i could build final executable without assigning .LIB to any bank, i can build my code into
    one big .LIB .

    so the question is

    is it possible to build program in KEIL without assigning bank to .LIB.

    regards,
    -rajan