Oracle Blog

Tim Cook's Weblog

Tuesday Jan 23, 2007

("cc CSI")

Introduction

Performance engineers often look at improving application performance
by getting the compiler to produce more efficient binaries from the
same source. This is done by changing what compiler options are used.
In this modern era of Open Source Software, you can often get your
hands on a number of binary distributions of an application, but if
you really want to roll your sleeves up, the source is there, just
waiting to be compiled with the latest compiler and optimisations.

Now, it might be useful to have as a reference the compiler version and
flags that were originally used on the binary distribution you tried
out, or you just might be interested to know. Read on for details on the
forensic tools.

What architecture was the executable compiled for?

Solaris supports 64 and 32-bit programming models on SPARC and x86.
You may need to know which one an application is using - it's easy
enough to find out.

There is a non-linear relationship between versions of the compiler
("Sun C") and the development suite ("Sun Studio", "Forte Developer",
"Sun WorkShop", etc.). You can figure it out using
Sun Studio Support Matrix.

Can I figure out what compiler flags were used?

It depends on what compiler was used, and whether you have objects.

For Sun Studio 11, use "dwarfdump -i", and look for
"DW_AT_SUN_command_line" in the output.

For Sun Studio 10 and earlier, use "dumpstabs -s", and look for
"CMDLINE" in the output.

For GCC, you can only figure out what version of GCC was used
(see above).