These are the errors made by the compiler.
/usr/lib/gcc-cross/arm-linux-gnueabi/9/../../../../arm-linux-gnueabi/bin/ld: /tmp/Prova_linuxarmv7.IKA0IY.ltrans0.ltrans.o: in function `Func1.constprop.0':
<artificial>:(.text+0xfdc): undefined reference to `__gcov_one_value_profiler_atomic'
/usr/lib/gcc-cross/arm-linux-gnueabi/9/../../../../arm-linux-gnueabi/bin/ld: /tmp/Prova_linuxarmv7.IKA0IY.ltrans0.ltrans.o: in function `Func2.lto_priv.0':
<artificial>:(.text+0x1364): undefined reference to `__gcov_one_value_profiler_atomic'
/usr/lib/gcc-cross/arm-linux-gnueabi/9/../../../../arm-linux-gnueabi/bin/ld: <artificial>:(.text+0x1878): undefined reference to `__gcov_one_value_profiler_atomic'
/usr/lib/gcc-cross/arm-linux-gnueabi/9/../../../../arm-linux-gnueabi/bin/ld: <artificial>:(.text+0x2004): undefined reference to `__gcov_one_value_profiler_atomic'
/usr/lib/gcc-cross/arm-linux-gnueabi/9/../../../../arm-linux-gnueabi/bin/ld: <artificial>:(.text+0x2134): undefined reference to `__gcov_one_value_profiler_atomic'
/usr/lib/gcc-cross/arm-linux-gnueabi/9/../../../../arm-linux-gnueabi/bin/ld: /tmp/Prova_linuxarmv7.IKA0IY.ltrans1.ltrans.o:<artificial>:(.text+0x37c): more undefined references to `__gcov_one_value_profiler_atomic' follow
collect2: error: ld returned 1 exit status
This is the compilation command:
arm-linux-gnueabi-gcc ./main.c -s -static -pthread -O3 -flto -std=gnu11 -DNDEBUG -Wall -Wextra -lm -march=armv7-a -mfpu=neon -mfloat-abi=softfp -DNEON -o ./Prova_linuxarmv7 -fprofile-generate -lgcov
The same command without "-fprofile-generate -lgcov" works well.
ProblemType: Bug
DistroRelease: Ubuntu 20.04
Package: gcc-9-arm-linux-gnueabi 9.3.0-17ubuntu1~20.04cross2
ProcVersionSignature: Ubuntu 5.8.0-59.66~20.04.1-generic 5.8.18
Uname: Linux 5.8.0-59-generic x86_64
ApportVersion: 2.20.11-0ubuntu27.18
Architecture: amd64
CasperMD5CheckResult: skip
CurrentDesktop: ubuntu:GNOME
Date: Fri Jul 23 17:04:24 2021
InstallationDate: Installed on 2020-05-01 (448 days ago)
InstallationMedia: Ubuntu 20.04 LTS "Focal Fossa" - Release amd64 (20200423)
SourcePackage: gcc-9-cross
UpgradeStatus: No upgrade log present (probably fresh install)