On 04/22/10 10:06, Maule Mark wrote:
Hi all:

I have some code which constructs unique symbol names at compile time
and assigns a static value to them. For esample:

func()
{
static const char * __attribute__ ((used)) <unique_symbol_name> = <some
value>;

...
}

These symbols are not used at runtime. Rather, they are used to hold
static tracing information that we pick out by post processing the
binaries looking for these special symbols.

My problem is that I can't seem to figure out how to keep these symbols
from being optimized out by the studio 12 toolchain. Alternately,
perhaps the names are being mangled or hidden.

The above works fine on gcc 4x, however studio does recognize the "used"
attribute, and I cannot figure out how to get these unused symbols
preserved so that I can post-process the binaries.

Drop the static declaration, and use a mapfile to scope the symbols
locally during link.

We have the same issues w/ static declarations being optimized out
in the kernel....

- Bart


--
Bart Smaalders                  Solaris Kernel Performance
[email protected]       http://blogs.sun.com/barts
"You will contribute more with mercurial than with thunderbird."
_______________________________________________
tools-compilers mailing list
[email protected]

Reply via email to