Detecting -rdynamic

Mike Perry mikepery@fscked.org
Tue Oct 28 06:53:00 GMT 2003


Hello, I'm the author of a malloc debugger, and I am trying to make use
of glibc's backtrace_symbols_fd. It seems as if applications need to be
linked with -rdynamic in order for me to properly make use of this call.
However, my malloc debugger is written such that it is not necessary to
recompile your executable, so it is unreasonable to simply allow
backtrace_symbols_fd to print jibberish if my users neglected to pass
-rdynamic. 

So my question then is twofold, I suppose.

1. Is it possible to detect if a program has been compiled with
-rdynamic from within an LD_PRELOADed library? Ie, perhaps there is some
symbol that it adds that I can find with a dlopen(NULL)? nm doesn't seem
to list any differences between apps compiled with -rdynamic and
without..

2. Or, is there an alternate method for resolving symbols in a backtrace
(such as one returned from __builtin_return_address) that is more
reliable?

-- 
Mike Perry
Mad Computer Scientist
fscked.org evil labs



More information about the Gcc-help mailing list