Open Source & Linux Lab

It's better when it's simple

User Tools

Site Tools


etc:users:jcmvbkbc:gcc-xtensa-call0

Call0 ABI support in xtensa gcc backend

Compiler build for full testing

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

  • build toolchain with libc, e.g. by the buildroot
  • configure and build gcc with sysroot of that toolchain:
    export TOOLCHAIN=/home/jcmvbkbc/tmp/br/build-toolchain
    export TARGET=xtensa-buildroot-linux-uclibc  # use for linux
    # export TARGET=xtensa-buildroot-uclinux-uclibc # use for uclinux
    PATH=$TOOLCHAIN/host/usr/bin:$PATH ../gcc/configure \
        --prefix=`pwd`/root --target=$TARGET \
        --disable-shared --disable-libssp --disable-libisl --enable-languages=c,c++ \
        --enable-tls --enable-threads --enable-__cxa_atexit \
        --with-sysroot=$TOOLCHAIN/host/usr/$TARGET/sysroot
    PATH=$TOOLCHAIN/host/usr/bin:$PATH make -j8 all
  • run it on your board (board configuration is a file in a directory specified in the ~/.dejagnurc e.g. ~/boards):
    DEJAGNU_TIMEOUT=1200 PATH=$TOOLCHAIN/host/usr/bin:$PATH \
    RUNTESTFLAGS="CFLAGS_FOR_TARGET=--sysroot=$TOOLCHAIN/host/usr/$TARGET/sysroot --target_board=qemu-xtensa" \
    make -k check

    Timeouts are weird. See gcc/testsuite/lib/timeout.exp for some timeouts, the rest are TBD.

  • run it on linux-user QEMU:
    PATH=$TOOLCHAIN/host/usr/bin:$PATH \
    QEMU_LD_PREFIX=$ROOTFS \
    RUNTESTFLAGS="CFLAGS_FOR_TARGET=--sysroot=$TOOLCHAIN/host/usr/$TARGET/sysroot\ -mauto-litpools" \
    make -k check

    File system in $ROOTFS should have sysroot libraries installed, but nothing else.

  • to run uclinux tests use TARGET=xtensa-buildroot-uclinux-uclibc and provide environment variable FLTFLAGS='-s 0x01000000'. -Wl,-elf2flt='-s 0x01000000' passed in CFLAGS_FOR_TARGET breaks precompiled header tests.
  • to run call0 tests provide environment variable QEMU_XTENSA_ABI_CALL0='' in qemu-4.2+

Compiler build for debug

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

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

etc/users/jcmvbkbc/gcc-xtensa-call0.txt · Last modified: 2019/09/13 22:19 by jcmvbkbc