Hi Tommynux!
First to answer some of your original questions:
What problems should I expect to encounter in the current
preview release of Sun Studio for linux with respect to
gcc & glibc & ABI compatibility?
The short answer is that with each Sun Studio Express build
we put out there (Sun Studio Express is the new program which
replaced Compilers On Linux Technology Preview) you
should expect more and more compatibility and by the
time this product gets released we hope to achieve
100% compatibility on the C side and do our best for C++.
A somewhat longer answer would be:
1. As far as glibc is concerned we should be compatible already
if you notice we are not -- file a bug or post to this forum.
2. As far as gcc (as in C compiler) compatibility goes we currently
are ABI compatible, but we're still working on full implementation
of the following gcc source level features:
2.1.
_asm_ extensions
2.2.
_attribute_ extensions
If you have lots of those in your code -- it probably won't work. That
said, however, we would appreciate if you tell us exactly what
doesn't work so that we can implement those particular extensions
first.
3. As far as G++ compatibility goes we've got quite a lot of work ahead
of us. Currently we are
NOT G++ ABI compatible and we implement
our own C++ ABI on Linux (compatible with Solaris one). Which means
that if you have some 3rd party C++ libraries and you don't have an
option of recompiling them with Sun Studio C++ compiler -- you're
in trouble.
What are the recommended equivalent CFLAGS to something
like "-O2 -march=i686 -pipe -fomit-frame-pointer" for Sun Studio in linux?
I have one slide that I like to call "30 seconds optimization school". Basically
with Sun Studio it as always a good idea to start with:
-fast -xipo=2 -xarch=<target cpu>
Once you build your project that way -- use Performance Analyzer to
see what's going on and start experimenting with different options.
We've got a nice introduction into this magic available at the
following URL: http://developers.sun.com/prodtech/cc/articles/amdopt.html
Also I'm about to publish my slides here:
http://blogs.sun.com/rvs
once I'm done fixing the mess they've created
there by upgrading blogging software. :-(
May I assume that the code compiled with Sun Studio in linux is less
suceptible to buffer overflow attacks, i.e. is it like having smash stack
protection in gcc?
Not really.
Is it possible to bootstrap gcc or compile glibc with Sun Studio for
Linux or is it pointless?
gcc by default bootstraps itself anyway, so it doesn't matter what you use
to compile boot0 phase. glibc, at least theoretically, can benefit from
Sun Studio. It'll be very nice if you can try that and post the results to
this forum.
I mantain a build of Ipcop linux firewall tuned to my
specific system administration and security needs.
The build scripts are derived form LFS (Linux from
scratch), and they pass to the build system compile
time options, i.e. "-O2 -march=$arch ... etc." plus
some packages have their own independant CFLAGS which
are not set by the main config file. So, my current
goal here is to experiment with Sun Studio for Linux
to build better code which is less vulnerable to
attacks due to the fact that I used Sun Studio
instead of gcc 3.x.x.
As I keep pointing out -- if you're really serious about
performance of your application you should make performance
testign part of your routine as much as everybody has
regression testing as part of their routine. Start with
the flags outline in the quoted article and keep poking
around with Performance Analyzer -- that's exactly what
I did for ffmpeg.
I would be more than happy to assist you, but you
have to help me first by coming up with the meaningful
set of performance related workloads of your app.
I think that someone like Roman may clarify the issue
for good and save me & my team a lot of time and
frustration.
I'd be very happy to do that for you.
I would love some apps, for instance the full
LAMP stack plus squid and snort to compile cleanly in
Sun Studio 11 for Linux. That would be my little
piece of heaven. :D
Now that is an interesting proposition. I'm pretty
sure that LAMP should be totally compatible with
Sun Studio on Linux even now. Tuning it for
performance might be an interestign excersize
as well. It actually looks like a very nice subject
for a whitepaper treatment. Say, would you be
interested in [co-]authoring such a whitepaper
with a chance of getting a due recognition ? ;-)
http://developers.sun.com/prodtech/cc/heroes.html
In his SDN interview, Roman explained how he
profiled/optimized ffmpeg's code using sunstudio on
sparc and that the benefits were seen on all of the
architectures that the code supported. This example
is the kind of accomplishment I want to achieve and
the fact that we have sunstudio for linux could mean
we may see a "better" linux in the near future.
That's exactly our hope as well.
Thanks,
Roman.