In order to build a gcc for a newlib target with a working libgcov, you need build from a unified source tree and configure using --with-headers --with-newlib.
Using current mainline sources, when configuring with: ../srcw/configure --target=sh-elf --with-headers --with-newlib the compiler fails to build with: mv tmp-specs specs echo | /mnt/scratch/nightly/2006-05-31/sh-elf/./gcc/xgcc -B/mnt/scratch/nightly/2006-05-31/sh-elf/./gcc/ -nostdinc -B/mnt/scratch/nightly/2006-05-31/sh-elf/sh-elf/newlib/ -isystem /mnt/scratch/nightly/2006-05-31/sh-elf/sh-elf/newlib/targ-include -isystem /mnt/scratch/nightly/2006-05-31/srcw/newlib/libc/include -B/usr/local/sh-elf/bin/ -B/usr/local/sh-elf/lib/ -isystem /usr/local/sh-elf/include -isystem /usr/local/sh-elf/sys-include -L/mnt/scratch/nightly/2006-05-31/sh-elf/./ld -E -dM - | \ sed -n -e 's/^#define \([^_][a-zA-Z0-9_]*\).*/\1/p' \ -e 's/^#define \(_[^_A-Z][a-zA-Z0-9_]*\).*/\1/p' | \ sort -u > tmp-macro_list /bin/sh ../../srcw/gcc/../move-if-change tmp-macro_list macro_list echo timestamp > s-macro_list The directory that should contain system headers does not exist: /usr/local/sh-elf/sys-include make[1]: *** [stmp-fixinc] Error 1 make[1]: Leaving directory `/mnt/scratch/nightly/2006-05-31/sh-elf/gcc' make: *** [all-gcc] Error 2 -- Summary: gcov-enabled sh-elf compiler fails to build Product: gcc Version: 4.2.0 Status: UNCONFIRMED Keywords: build Severity: blocker Priority: P3 Component: other AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: amylaar at gcc dot gnu dot org GCC target triplet: sh-elf http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27850