Dynamic linking with "digested" names?

munch@netcom.com (john paulson)
3 Apr 1999 21:57:01 -0500

          From comp.compilers

Related articles
Dynamic linking with "digested" names? munch@netcom.com (1999-04-03)
| List of all articles for this month |
From: munch@netcom.com (john paulson)
Newsgroups: comp.compilers
Date: 3 Apr 1999 21:57:01 -0500
Organization: ICGNetcom
Keywords: linker, question, comment

Problem:
    With shared libraries and dynamic linking, symbol names
    are stored in full in both the shared library and the
    client of the shared library. In some environments,
    (embedded systems which allow dynamic linking of
    client code), the space required for symbols can be
    significant.


    Given that I have complete control over the shared library
    mechanism, what if I mangle the imports and exports in a
    post-linker, replacing the full names with a fixed-length
    digested form. For example, I can feed the symbol name
    "_sprintf" into MD5 and then reduce that signature (by
    XOR? by dividing by 2^64-1?) into an 8byte digested
    symbol.


Question:
    Does anyone have any experience doing this?
    In a C environment, would this produce worthwhile savings?
        What about in a C++ environment?
    Is MD5+XOR a good way to reduce? I don't want to inadvertently
        introduce collisions (two distinct symbols yielding the same
        digest). I'll take my chances with 2^64.
    I'd really like to get by with reducing to 2^32. Any good
        digest functions?


Thanks for any insight.
[Microsoft optionally does this with DLLs, you can import DLL symbols
either by name or by the index in the export table. No need to MD5,
just keep a symbol table available at link time. -John]





Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.