
On 08/21/2012 01:55 PM, Eric Blake wrote:
When gcc atomic intrinsics are not available (such as on RHEL 5 with gcc 4.1.2), we were getting link errors due to multiple definitions:
./.libs/libvirt_util.a(libvirt_util_la-virobject.o): In function `virAtomicIntXor': /home/dummy/l,ibvirt/src/util/viratomoic.h:404: multiple definition of `virAtomicIntXor' ./.libs/libvirt_util.a(libvirt_util_la-viratomic.o):/home/dummy/libvirt/src/util/viratomic.h:404: first defined here
Solve this by conditionally marking the functions static (the condition avoids falling foul of gcc warnings about unused static function declarations).
* src/util/viratomic.h: When not using gcc intrinsics, use static functions to avoid linker errors on duplicate functions. ---
Pushing under the build-breaker rule. Tested on both RHEL 5 and modern gcc of F17.
I meant to send this as patch 4/1 in the series of RHEL 5 cleanups: https://www.redhat.com/archives/libvir-list/2012-August/msg01383.html
Oh, and I just noticed my indentation is off, while preparing this email; I'll squash in the whitespace fix before pushing.
Except I forgot to amend before pushing, so it turned into two patches. Oh well. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org