how to tune libstdc++ to the native architecture when building gcc

3

I recently found that when I build my C++ software, I get about a 10% speedup by using the g++ march=native option. When compiling gcc and libstc++, is it possible to tune the libstdc++ library to the native architecture as well? I couldn't find any mention of this in the gcc install configuration documentation. (I'm building gcc 4.6.2 on Linux Mint 11 with an Intel Core i7 Sandy Bridge-E processor.)

Clarification:

I normally build libstc++ when I build gcc, e.g. here is exactly what I'm doing and I'm looking to add some tuning options:

$ wget http://mirrors-us.seosue.com/gcc/releases/gcc-4.6.2/gcc-4.6.2.tar.gz 
$ tar -xzf gcc-4.6.2.tar.gz 
$ mkdir gcc-4.6.2-objdir 
$ cd gcc-4.6.2-objdir/ 
$ ../gcc-4.6.2/configure 
$ make
# make install

JDiMatteo

Posted 2012-06-08T03:35:25.393

Reputation: 521

Good question, but it may be better on Stack Overflow. – Hassan – 2012-06-08T03:57:28.413

@Hassan, not sure it is on topic there, but it is certainly on topic here. – soandos – 2012-06-08T03:58:29.660

Answers

0

Unless you compiled libstc++ yourself, you likely just downloaded the object files. If that is the case then you will be unable to change anything about it.

To get the performance that you are looking you, you might have to download the source code and compile it with the options that you want to use.

Notes:

Having more than one version of libstc++ installed on a system can get tricky (I had a few issues with this on Ubuntu, and to took a full removal of one of the version to get resolved, though I am sure there is a way to manage it).

If you compile code with the -mtune=generic flag, but the wrong version of the library, you should not expect the resulting binary to run on the target machine (assuming that it is a different machine).

soandos

Posted 2012-06-08T03:35:25.393

Reputation: 22 744