Using profile-guided optimization (PGO)

gcc -O3 -march=native -pg -fprofile-generate ...
# Run a benchmark or program's typical load
gcc -O3 -march=native -fprofile-use ...

Check compiler preprocessor defines

# E.g. check for the version of OpenMP supported
echo | cpp -fopenmp -dM | grep -i open
#define _OPENMP 200805

Compiling gcc

Download gcc tarball, run contrib/download_prerequisites script to download external libraries to build as part of gcc.

./configure --prefix=/opt/gcc-custom --disable-multilib --disable-libada --enable-languages=c,c++

Static compilation

Insane Coding: Creating portable Linux binaries. Use -static-libgcc -static-libstdc++ to include compiler support libraries.

Linux distribution binary compatibility. Discusses glibc symbol versioning, and using the .symver directive to select a version of a functionl. Application Bundles Revisited – Tristan's World. Discusses a vala script that will create a header file targeting an older glibc. Above script w/ CMake integration.


What gcc versions are available in Red Hat Enterprise Linux? - Red Hat Customer Portal: versions of GCC available on various RHEL/CentOS versions, including the Redhat Developer Toolset.

GCC 5.1 dual ABI w.r.t. std::string and std::list: Can be enabled by default in GCC by using --with-default-libstdcxx-abi=c++98

Interesting reading

Performance benchmarks w/ calling DSO libraries: compares DSOs w/ Position Independent Code (PIC) enabled, static libraries, and directly calling functions.

C++-1x/z/etc support in GCC

Parallel STL in gcc

ABI tracking: and


SamatsWiki: CheatSheet/Gcc (last edited 2017-08-04 18:11:55 by SamatJain)