Some compiler flags explained by redhat


(tom) #1

salve

i searched easy explanation from some compilerflags and i found this link and i want to share with you :slight_smile:


(Luca Giambonini) #2

oh nice, good catch!
I need to read that document, very interesting.
Chakra follow (more or less) ArchLinux’s configurations, you can find them here:


(tom) #3

chakra followed arch in general and the near to arch is a huge benefit for us but with a drawback: it drags ballast in to chakra.

gcc manual cflags: https://gcc.gnu.org/onlinedocs/gcc/Invoking-GCC.html
gcc manual ldflags: https://sourceware.org/binutils/docs/ld/Options.html

it could be funny it seems…


(system) automatically bumped #4

(tom) #5

because couldn’t edit my post above:

how to use link time optimization (lto)

CFLAGS="-fno-plt -flto=<nCPU>"
CXXFLAGS="$CFLAGS"
LDFLAGS+="-fuse-ld=gold,-fuse-linker-plugin"
LTOPLUGIN="$(gcc -print-search-dirs | grep install | awk '{print $2 "liblto_plugin.so"}')"
ARFLAGS+=" --plugin $LTOPLUGIN"
RANLIBFLAGS+=" --plugin $LTOPLUGIN"
NMFLAGS+=" --plugin $LTOPLUGIN"

how to use openMP:

sudo pacman -S openmp
CFLAGS="-fopenmp"
CXXFLAGS="$CFLAGS"

how to use graphite (loop optimization):

sudo pacman -S graphite
CFLAGS+=" -fgraphite-identity -floop-nest-optimize -ftree-loop-distribution -ftree-vectorize"
CXXFLAGS="$CFLAGS"

https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html


(system) automatically bumped #6