From: Florian K. <fl...@ei...> - 2025-05-11 13:28:06
|
Hi Paul, thx for the experiments.. On 11.05.25 12:01, Paul Floyd via Valgrind-developers wrote: > > The only alternative I have for the moment is to drop the optimization level to > 01 as in the godbolt link above. There are 4 places in the code where I had to > do that (3 strlen replacements and drd_pre_mem_read_asciiz which is effectively > doing an strlen as a check before calling DRD_(trace_load)). > I just realise, that we will not miss any -Wformat warnings in most of valgrind code because we're not calling any functions from C library headers there. VEX, the core and the tools get compiled for a freestanding environment and we run our own versions of printf: VG_(printf) vex_printf etc. which have proper attributes. And they are complex enough that GCC will not do anything clever with them. That's good news in the sense that we do not need to change Makefile.all.am at all. We might want to consider replacing -fno-builtin with -freestanding (which implies the former). That reflects better what we do. There are only a few bits that are linked against libc: auxprogs/valgrind-listener auxprogs/getoff-<platform> auxprogs/valgrind-di-server coregrind/valgrind coregrind/vgdb memcheck/tests/vbit-test/vbit-test none/s390x/tests/disasm-test/disasm-test To get -Wformat warnings for those the only thing to do is to add -fhosted at the end of the CFLAGS thereby overriding -fno-builtin. drd/drd_intercepts helgrind/hg_intercepts preload shared objects These get compiled with AM_CFLAGS_PSO_BASE but adding -fhosted to those made memcheck/tests/wcpncpy fail. It seems to me that those flags are particularly crafted. So I left it alone. Attached patch regtested on x86_64-linux-gnu and s390x-ibm-linux-gnu with no failures. Florian |