Table of Contents

GCC support for Xtensa

Compiler build for full testing

gcc testsuite requires libc, so the easiest way is the following:

Compiler build for debug

../gcc/configure \
    --prefix=`pwd`/root --target=$TARGET \
    --disable-libssp --disable-libisl --enable-languages=c,c++ \
    --enable-debug --enable-valgrind-annotations --disable-docs \
    --enable-checking=all \
    CFLAGS='-O0 -g3' CXXFLAGS='-O0 -g3'
    
make -j8 all-gcc
make -j8 install-gcc

For –enable-valgrind-annotations to work valgrind must be installed.

To use ASAN add the following to configure:

../gcc/configure \
    ... \
    --with-stage1-libs="-lstdc++ -ldl" \
    CXXFLAGS=-fsanitize=address \
    LDFLAGS=-fsanitize=address \
    ...

and have

ASAN_OPTIONS='detect_leaks=0'

in the environment when building. When testing check

diff --git a/gcc/testsuite/lib/asan-dg.exp b/gcc/testsuite/lib/asan-dg.exp
index 53210ca9627c..545a92ff112c 100644
--- a/gcc/testsuite/lib/asan-dg.exp
+++ b/gcc/testsuite/lib/asan-dg.exp
@@ -121,7 +121,7 @@ proc asan_init { args } {
     global asan_saved_TEST_ALWAYS_FLAGS
     global asan_saved_ALWAYS_CXXFLAGS

-    setenv ASAN_OPTIONS "color=never"
+    setenv ASAN_OPTIONS "color=never:detect_leaks=0"

     set needs_cxx [lindex $args 0]
     set link_flags ""

See also