https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106979
Bug ID: 106979 Summary: Gcov tutorial for Freestanding Environments failing Product: gcc Version: 11.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: gcov-profile Assignee: unassigned at gcc dot gnu.org Reporter: rob at lightmatter dot co CC: marxin at gcc dot gnu.org Target Milestone: --- cat /etc/os-release PRETTY_NAME="Ubuntu 22.04.1 LTS" gcc --version gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0 Following the documentation here: https://gcc.gnu.org/onlinedocs/gcc/Freestanding-Environments.html ---------- Warning ---------- The following step: Compile app.c and main.c with test coverage and -fprofile-info-section. Produces a warning: gcc -fprofile-arcs -ftest-coverage -fprofile-info-section -c main.c main.c: In function 'filename': main.c:35:3: warning: implicit declaration of function '__gcov_filename_to_gcfn' [-Wimplicit-function-declaration] 35 | __gcov_filename_to_gcfn (f, dump, arg); | ^~~~~~~~~~~~~~~~~~~~~~~ main.c: In function 'dump_gcov_info': main.c:63:5: warning: implicit declaration of function '__gcov_info_to_gcda' [-Wimplicit-function-declaration] 63 | __gcov_info_to_gcda (*info, filename, dump, allocate, arg); | ^~~~~~~~~~~~~~~~~~~ ---------- Failure ---------- Subsequent step fails: gcc --coverage main.o app.o -T linkcmds -Wl,-Map,app.map /usr/bin/ld: main.o: in function `filename': main.c:(.text+0x10c): undefined reference to `__gcov_filename_to_gcfn' /usr/bin/ld: main.o: in function `dump_gcov_info': main.c:(.text+0x196): undefined reference to `__gcov_info_to_gcda' collect2: error: ld returned 1 exit status make: *** [Makefile:38: test3] Error 1