Skip to contentSkip to conversation

build: link with libatomic on powerpc-linux

PATCH Superseded Olaf Hering 2 participants 3 messages Apr 1, 2016

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 build: link with libatomic on powerpc-linux

Building on powerpc-linux fails with undefined reference to __atomic_load_8 in icount_warp_rt(). Force linking to -latomic.

Fixes a0aa44b ("include/qemu/atomic.h: default to __atomic functions")

Cc Paolo Bonzini <[email protected]>
Cc "Daniel P. Berrange" <[email protected]>
Cc Stefan Hajnoczi <[email protected]>
Cc Peter Maydell <[email protected]>
Cc Stefano Stabellini <[email protected]>
---
 configure | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
configure +27 -0
index 81caff6..ee935bb 100755
@@ -4025,6 +4025,33 @@ if test "$usb_redir" != "no" ; then
     fi
 fi
 
+if test "$cpu" = "ppc" && test "$targetos" = "Linux" ; then
+    # Do we need libm
+    cat > $TMPC << EOF
+    #include <unistd.h>
+    #include <stdint.h>
+    #include <qemu/atomic.h>
+    int64_t val;
+    int main(int argc, char **argv)
+    {
+      val = (int64_t)read(0, NULL, 0);
+      if (atomic_read(&val) == -1) {
+        return 0;
+      }
+      return 1;
+    }
+EOF
+    if compile_prog "-Iinclude" "" ; then
+      :
+      echo "No need to link with -latomic on powerpc-linux"
+    elif compile_prog "-Iinclude" "-latomic" ; then
+      echo "Link with -latomic on powerpc-linux"
+      libs_softmmu="$libs_softmmu -latomic"
+    else
+      error_exit "libatomic check failed"
+    fi
+fi
+
 ##########################################
 # check if we have VSS SDK headers for win
 
#1 lore raw
Quoted 2 lines · Olaf Hering

Building on powerpc-linux fails with undefined reference to __atomic_load_8 in icount_warp_rt(). Force linking to -latomic.

We should instead be fixing this by not doing atomic operations on types of larger than void*. This also causes problems on x86 BSDs. I think there's already a proposed patch on the list for that.

thanks
-- PMM

#2 lore raw
Quoted 7 lines · Peter Maydell
Quoted 2 lines · Olaf Hering

Building on powerpc-linux fails with undefined reference to __atomic_load_8 in icount_warp_rt(). Force linking to -latomic.

We should instead be fixing this by not doing atomic operations on types of larger than void*. This also causes problems on x86 BSDs. I think there's already a proposed patch on the list for that.

Do you have a pointer to the proposed patch?
My change does not work for the --enable-linux-user case for some reason.

Olaf