On Wed, Jul 05, 2017 at 12:58:51 +0100, Daniel Berrange wrote:
Currently all mockable functions are annotated with the
'noinline'
attribute. This is insufficient to guarantee that a function can
be reliably mocked with an LD_PRELOAD. The C language spec allows
the compiler to assume there is only a single implementation of
each function. It can thus do things like propagating constant
return values into the caller at compile time, or creating
multiple specialized copies of the function body each optimized
for a different caller. To prevent these optimizations we must
also set the 'noclone' and 'weak' attributes.
This fixes the test suite when libvirt.so is built with CLang
with optimization enabled.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
build-aux/mock-noinline.pl | 2 +-
src/check-symfile.pl | 2 +-
src/internal.h | 23 ++++++++++++++++++-----
src/qemu/qemu_capspriv.h | 2 +-
src/rpc/virnetsocket.h | 4 ++--
src/util/vircommand.h | 2 +-
src/util/vircrypto.h | 2 +-
src/util/virfile.h | 2 +-
src/util/virhostcpu.h | 4 ++--
src/util/virmacaddr.h | 2 +-
src/util/virnetdev.h | 8 ++++----
src/util/virnetdevip.h | 2 +-
src/util/virnetdevopenvswitch.h | 2 +-
src/util/virnetdevtap.h | 6 +++---
src/util/virnuma.h | 16 ++++++++--------
src/util/virrandom.h | 6 +++---
src/util/virscsi.h | 2 +-
src/util/virscsivhost.h | 2 +-
src/util/virtpm.h | 2 +-
src/util/virutil.h | 10 +++++-----
src/util/viruuid.h | 2 +-
21 files changed, 58 insertions(+), 45 deletions(-)
ACK