Fixed
Created: Dec 29, 2015
Updated: Dec 3, 2018
Resolved Date: Mar 9, 2016
Found In Version: 6.0.0.23
Fix Version: 6.0.0.29
Severity: Standard
Applicable for: Wind River Linux 6
Component/s: Toolchain
Customer is trying to enable code coverage support (gcov) on platforms using Windriver Linux 6. They were running into an issue that the compiler team thinks is same as - http://sourceforge.net/p/ltp/mailman/message/31427972/
Apply the attached hotfix. (run the script with '-a' option).
This hotfix can be applied globally in wrlinux install dir, or locally in a project configured with '--enable-stand-alone-project=yes' option.
---------
The problem appears only when pre-existing .gcno files are in the build dir.
Thus a simple work around is to always clean .gcno files before compiling, as in:
$ find . -name '*.gcno' | xargs rm
$ cat bug-gcno.sh
#!/bin/sh
set -e
# Paramaters
CC=/opt/data2/work/nmarguet/juni/lx6-buildtoolchain-rcpl25_prj/bitbake_build/tmp/sysroots/x86_64-linux/usr/bin/x86_64-wrs-linux/x86_64-wrs-linux-gcc
$CC --version
# Clean
rm -f test.o test.gcno test.i
# Generate a "large" file with random content
dd if=/dev/urandom of=test.gcno bs=512 count=100
# Generate a simple .i file
echo "int main() { return 0; }" >test.i
# Compile with coverage enabled
${CC} -ftest-coverage -fprofile-arcs -c -o test.o test.i
# Get byte size of generated .gcno file
gcno_size=`stat --printf=%s test.gcno`
# Check whether .gcno file is correctly truncated
if [ "$gcno_size" = 51200 ]; then
# The gcno file has still some garbage at the end
echo "FAILURE: your compiler has the .gcno file bug"
exit 1
fi
echo "SUCCESS: your compiler does not have the .gcno file bug"
$ ./bug-gcno.sh
x86_64-wrs-linux-gcc (GCC) 4.8.1
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
100+0 records in
100+0 records out
51200 bytes (51 kB) copied, 0.0128873 s, 4.0 MB/s
FAILURE: your compiler has the .gcno file bug