This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Detecting -rdynamic
- From: Mike Perry <mikepery at fscked dot org>
- To: gcc-help at gcc dot gnu dot org
- Date: Tue, 28 Oct 2003 00:53:02 -0600
- Subject: Detecting -rdynamic
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