++ gcc@gcc.gnu.org

> -----Original Message-----
> From: Wasim Khan
> Sent: 15 April 2025 12:41
> To: gcc-h...@gcc.gnu.org
> Subject: GCOV issue with GCC-14.2
> 
> Hi,
> 
> I am using GCOV for test coverage in a project using instructions for
> freestanding environment
> 
> Below are the flags i use.
> 
> CFLAGS +=  -fprofile-arcs -ftest-coverage -fprofile-info-section LFLAGS += 
> -lgcov
> --coverage
> 
> With these flags, thigs works fine with toolchain version 12.3 but i am facing
> below error if i upgrade to toolchain version 14.2 (AArch32 bare-metal 
> target).
> 
> /opt/arm-gnu-toolchain-14.2.rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-
> none-eabi/14.2.1/../../../../arm-none-eabi/bin/ld: /opt//arm-gnu-toolchain-
> 14.2.rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-
> eabi/14.2.1/thumb/v8-m.main+fp/softfp/libgcov.a(_gcov.o): in function
> `gcov_read_bytes':
> libgcov-driver.c:(.text.gcov_read_bytes+0x10): undefined reference to `fread'
> 
> 
> 
> I found that if i pass '-lgcov --coverage' before '-lc' in linking, then my 
> problem is
> fixed.
> 
> + LFLAGS += -lgcov --coverage
> LFLAGS         += -lc
> -  LFLAGS += -lgcov --coverage
> 
> Need help to understand why such changes/library order is are not required for
> toolchain version 12.3 ?
> 
> 
> Regards,
> Wasim

Reply via email to