I'm not the biggest expert on shared libraries, so I may be wrong here!
If I'm guessing right about what you're trying to do, just link your shared lib against libc.so. You don't want an extra copy of sscanf embedded in your library.
I answered your questions before I had quite figured out what you were getting at, in case you're interested in the answers.
Is there a way to tell ld to only resolve certain symbols when building the shared library?
only extern, not static, functions and variables go in the shared library's symbol table.
When you build your shared library, any symbols not found in objects on the linker command line will remain unresolved. If the linker complains about that, you probably need to link your shared lib against shared libc. You can have shared libs that depend on other shared libs, and ld.so can deal with the dependency chains.
If I had more rep, I'd ask this as a comment:
Do you have a customized version of sprintf/sscanf, or would it be ok for your shared lib to use the implementation in -lc? If -lc is fine, then my answer probably solves your problem. If not, then you need to build your shared lib out of objects that only have the functions you need. i.e. don't link it against /usr/lib/libc.a.
Maybe I'm getting confused by your
libc.a (not actually the "real" libc)
line. /usr/lib/libc.a is really glibc (on linux). It's a statically linked copy of the same code in libc.so. Unless you're talking about your own libc.a (which is what I was thinking at first)...
Turn libc.a into a shared library?
You probably can, but don't, because it's probably not compiled as position-independent code, so it would be require a lot of relocations by ld.so at run time.
Extract sscanf from libc.a and specify that on the linker line?
May be possible. ar t /usr/lib/libc.a to list contents. (ar's args are similar to tar. tar was ar for tapes.... Old school Unix here.) Probably not that easy, because sscanf probably depends on symbols in other .o files in the .a.