This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Arm GNU Toolchain 11.3.Rel1 missing gcov_* symbols

While building and linking with --coverage I receive missing reference error for __gcov_exit and __gcov_flush. I've checked with nm and it seems those symbols are nowhere to be found in the binary package. They were available in older versions (gcc 10), why they disappeared?

Parents
  • Hi ARM,

    Will the gcov function could be resolved in the next release? I also had a similar issue with gcov:

    GCC version

    $ arm-none-eabi-gcc -v
    Using built-in specs.
    COLLECT_GCC=arm-none-eabi-gcc
    COLLECT_LTO_WRAPPER=prebuilts/gcc/linux/arm/bin/../libexec/gcc/arm-none-eabi/11.3.1/lto-wrapper
    Target: arm-none-eabi
    Configured with: /data/jenkins/workspace/GNU-toolchain/arm-11/src/gcc/configure --target=arm-none-eabi --prefix=/data/jenkins/workspace/GNU-toolchain/arm-11/build-arm-none-eabi/install --with-gmp=/data/jenkins/workspace/GNU-toolchain/arm-11/build-arm-none-eabi/host-tools --with-mpfr=/data/jenkins/workspace/GNU-toolchain/arm-11/build-arm-none-eabi/host-tools --with-mpc=/data/jenkins/workspace/GNU-toolchain/arm-11/build-arm-none-eabi/host-tools --with-isl=/data/jenkins/workspace/GNU-toolchain/arm-11/build-arm-none-eabi/host-tools --disable-shared --disable-nls --disable-threads --disable-tls --enable-checking=release --enable-languages=c,c++,fortran --with-newlib --with-gnu-as --with-gnu-ld --with-sysroot=/data/jenkins/workspace/GNU-toolchain/arm-11/build-arm-none-eabi/install/arm-none-eabi --with-multilib-list=aprofile,rmprofile --with-pkgversion='Arm GNU Toolchain 11.3.Rel1' --with-bugurl=https://bugs.linaro.org/
    Thread model: single
    Supported LTO compression algorithms: zlib
    gcc version 11.3.1 20220712 (Arm GNU Toolchain 11.3.Rel1)

    Test code:

    $ cat main.c
    int __start(void)
    {
    return 0;
    }

    Compiler with arm GCC-11.3:

    $ arm-none-eabi-gcc -c -Wstrict-prototypes -Os -fno-strict-aliasing -fomit-frame-pointer -fprofile-generate -ftest-coverage -mthumb --coverage -fno-common -Wall -Wshadow -Wundef -ffunction-sections -fdata-sections -g -mlittle-endian -mcpu=cortex-m0 -mthumb -mfloat-abi=soft main.c -o main.o

    link error with arm GCC-11.3:


    $ arm-none-eabi-ld --entry=__start -nostdlib --gc-sections -Tpimoroni-tiny2040-flash.ld -o test_gcov --start-group main.o ~/gcc/linux/arm/bin/../lib/gcc/arm-none-eabi/11.3.1/thumb/v6-m/nofp/libgcov.a --end-group
    arm-none-eabi-ld: main.o: in function `__start':
    /home/archer/code/nuttx/n4/incubator-nuttx/main.c:2: undefined reference to `__gcov_indirect_call_profiler_v4'
    arm-none-eabi-ld: /home/archer/code/nuttx/n4/incubator-nuttx/main.c:4: undefined reference to `__gcov_indirect_call'
    arm-none-eabi-ld: /home/archer/code/nuttx/n4/incubator-nuttx/main.c:4: undefined reference to `__gcov_time_profiler_counter'

    link success with arm GCC-10.3:


    $ arm-none-eabi-ld --entry=__start -nostdlib --gc-sections -T/home/archer/code/nuttx/n4/incubator-nuttx/boards/arm/rp2040/pimoroni-tiny2040/scripts/pimoroni-tiny2040-flash.ld -o test_gcov --start-group main.o ~/lib/gcc/arm-none-eabi/10.3.1/thumb/v6-m/nofp/libgcov.a --end-group
    archer@c:~/code/nuttx/n4/incubator-nuttx$ ls -l test_gcov
    -rwxrwxr-x 1 archer archer 68744 10月 24 12:51 test_gcov

Reply
  • Hi ARM,

    Will the gcov function could be resolved in the next release? I also had a similar issue with gcov:

    GCC version

    $ arm-none-eabi-gcc -v
    Using built-in specs.
    COLLECT_GCC=arm-none-eabi-gcc
    COLLECT_LTO_WRAPPER=prebuilts/gcc/linux/arm/bin/../libexec/gcc/arm-none-eabi/11.3.1/lto-wrapper
    Target: arm-none-eabi
    Configured with: /data/jenkins/workspace/GNU-toolchain/arm-11/src/gcc/configure --target=arm-none-eabi --prefix=/data/jenkins/workspace/GNU-toolchain/arm-11/build-arm-none-eabi/install --with-gmp=/data/jenkins/workspace/GNU-toolchain/arm-11/build-arm-none-eabi/host-tools --with-mpfr=/data/jenkins/workspace/GNU-toolchain/arm-11/build-arm-none-eabi/host-tools --with-mpc=/data/jenkins/workspace/GNU-toolchain/arm-11/build-arm-none-eabi/host-tools --with-isl=/data/jenkins/workspace/GNU-toolchain/arm-11/build-arm-none-eabi/host-tools --disable-shared --disable-nls --disable-threads --disable-tls --enable-checking=release --enable-languages=c,c++,fortran --with-newlib --with-gnu-as --with-gnu-ld --with-sysroot=/data/jenkins/workspace/GNU-toolchain/arm-11/build-arm-none-eabi/install/arm-none-eabi --with-multilib-list=aprofile,rmprofile --with-pkgversion='Arm GNU Toolchain 11.3.Rel1' --with-bugurl=https://bugs.linaro.org/
    Thread model: single
    Supported LTO compression algorithms: zlib
    gcc version 11.3.1 20220712 (Arm GNU Toolchain 11.3.Rel1)

    Test code:

    $ cat main.c
    int __start(void)
    {
    return 0;
    }

    Compiler with arm GCC-11.3:

    $ arm-none-eabi-gcc -c -Wstrict-prototypes -Os -fno-strict-aliasing -fomit-frame-pointer -fprofile-generate -ftest-coverage -mthumb --coverage -fno-common -Wall -Wshadow -Wundef -ffunction-sections -fdata-sections -g -mlittle-endian -mcpu=cortex-m0 -mthumb -mfloat-abi=soft main.c -o main.o

    link error with arm GCC-11.3:


    $ arm-none-eabi-ld --entry=__start -nostdlib --gc-sections -Tpimoroni-tiny2040-flash.ld -o test_gcov --start-group main.o ~/gcc/linux/arm/bin/../lib/gcc/arm-none-eabi/11.3.1/thumb/v6-m/nofp/libgcov.a --end-group
    arm-none-eabi-ld: main.o: in function `__start':
    /home/archer/code/nuttx/n4/incubator-nuttx/main.c:2: undefined reference to `__gcov_indirect_call_profiler_v4'
    arm-none-eabi-ld: /home/archer/code/nuttx/n4/incubator-nuttx/main.c:4: undefined reference to `__gcov_indirect_call'
    arm-none-eabi-ld: /home/archer/code/nuttx/n4/incubator-nuttx/main.c:4: undefined reference to `__gcov_time_profiler_counter'

    link success with arm GCC-10.3:


    $ arm-none-eabi-ld --entry=__start -nostdlib --gc-sections -T/home/archer/code/nuttx/n4/incubator-nuttx/boards/arm/rp2040/pimoroni-tiny2040/scripts/pimoroni-tiny2040-flash.ld -o test_gcov --start-group main.o ~/lib/gcc/arm-none-eabi/10.3.1/thumb/v6-m/nofp/libgcov.a --end-group
    archer@c:~/code/nuttx/n4/incubator-nuttx$ ls -l test_gcov
    -rwxrwxr-x 1 archer archer 68744 10月 24 12:51 test_gcov

Children
No data