We don't know the symbol names ahead of time - they are generated and include __LINE__ as part of the generated name.
I'm not rote on the mapfile - is there wildcarding to apply scoping to a set of symbols? Sent from my Verizon Wireless BlackBerry -----Original Message----- From: Bart Smaalders <[email protected]> Date: Thu, 22 Apr 2010 15:46:34 To: <[email protected]> Subject: Re: [tools-compilers] equivalent for gcc __attribute__ ((used)) 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] _______________________________________________ tools-compilers mailing list [email protected]
