`Hiding' libc symbols

Terry Lambert tlambert2 at mindspring.com
Tue May 6 07:56:00 PDT 2003


Peter Jeremy wrote:
> What if I define my own printf() that doesn't fully implement all the
> functionality of the FreeBSD printf()?  It works meets all the requirements
> for my code (and maybe even runs correctly elsewhere) but doesn't work
> on FreeBSD because a library internal call (hypothetically) relies on
> functionality that I don't need.

This is actually a library implementation problem, related to
incestuous implementation of library calls.

If another library function doesn't use e.g. strlcpy() internally,
then it will not be effected by an application replacing strlcpy().

It's only when a library function depends on another library
function, rather than itself, that it's at risk for this type of
failure.

Perhaps instead of asking how to prevent symbol replacement, one
should be asking how to get rid of incestuous functions in the
library implementation for standard library functions.

No, I do not expect "_fmt" (or whatever) to go away from common
code in printf/sprintf/whatever.  But I do expect it to be "_fmt"
instead of "fmt", i.e. in implementation space, rather than in
the symbol space legal for users to use.

-- Terry


More information about the freebsd-arch mailing list