Valgrind errors when linked with -static — Why?

后端 未结 2 898
被撕碎了的回忆
被撕碎了的回忆 2020-12-06 17:24

I have a test driver linked to a library I wrote. The library uses autotools so it produces both an archive (.a file) and a dynamic library (.so).

When I link my dri

2条回答
  •  死守一世寂寞
    2020-12-06 18:22

    Does valgrind just not work with -static?

    It does. The problem is not in Valgrind, it's in glibc, which is not Valgrind clean. The glibc developers refused to fix these problems (because the problems are of a "don't care" nature, and fixing them costs (a few) cycles).

    When you link dynamically, these errors come from libc.so.6, and can be easily suppressed, which is what Valgrind does by default.

    But when you link statically, these errors come from your executable (which now includes code from libc.a), and so the default Valgrind suppressions don't suppress them.

    You could write new suppressions (see Valgrind --gen-suppressions=yes documentation).

    Or you could install and use glibc-audit.

提交回复
热议问题