All of lore.kernel.org
 help / color / mirror / Atom feed
* [Bug 1910505] [NEW] atomic failure linking with --enable-sanitizers on 32-bit Linux hosts
@ 2021-01-07  8:40 Philippe Mathieu-Daudé
  2021-01-07  9:10 ` Philippe Mathieu-Daudé
  2021-05-09 15:44 ` [Bug 1910505] " Philippe Mathieu-Daudé
  0 siblings, 2 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-01-07  8:40 UTC (permalink / raw)
  To: qemu-devel

Public bug reported:

As of commit 50536341b47, using --enable-sanitizers on 32-bit Linux host:
- displays various warnings
- fails linking

Using Ubuntu 18.04 (release 20201211.1) and Clang10 on i386:

[139/675] Compiling C object softmmu.fa.p/softmmu_icount.c.o
In file included from ../softmmu/icount.c:31:
In file included from include/exec/exec-all.h:23:
In file included from ../target/mips/cpu.h:4:
In file included from ../target/mips/cpu-qom.h:23:
In file included from include/hw/core/cpu.h:23:
In file included from include/hw/qdev-core.h:5:
In file included from include/qemu/bitmap.h:16:
In file included from include/qemu/bitops.h:17:
include/qemu/atomic.h:463:12: warning: misaligned atomic operation may
incur significant performance penalty [-Watomic-alignment]
    return qatomic_read__nocheck(ptr);
           ^
include/qemu/atomic.h:129:5: note: expanded from macro
'qatomic_read__nocheck'
    __atomic_load_n(ptr, __ATOMIC_RELAXED)
    ^
include/qemu/atomic.h:473:5: warning: misaligned atomic operation may
incur significant performance penalty [-Watomic-alignment]
    qatomic_set__nocheck(ptr, val);
    ^
include/qemu/atomic.h:138:5: note: expanded from macro
'qatomic_set__nocheck'
    __atomic_store_n(ptr, i, __ATOMIC_RELAXED)
    ^
2 warnings generated.
[...]

[850/2216] Linking target tests/test-hbitmap
FAILED: tests/test-hbitmap
clang  -o tests/test-hbitmap tests/test-hbitmap.p/test-hbitmap.c.o
tests/test-hbitmap.p/iothread.c.o -Wl,--as-needed -Wl,--no-undefined
-pie -Wl,--whole-archive libblock.fa libcrypto.fa libauthz.fa libqom.fa
libio.fa -Wl,--no-whole-archive -Wl,--warn-common -fsanitize=undefined
-fsanitize=address -Wl,-z,relro -Wl,-z,now -m32 -ggdb
-fstack-protector-strong -Wl,--start-group libqemuutil.a
subprojects/libvhost-user/libvhost-user-glib.a
subprojects/libvhost-user/libvhost-user.a libblock.fa libcrypto.fa
libauthz.fa libqom.fa libio.fa @block.syms -lgio-2.0 -lgobject-2.0
-lglib-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -pthread -lutil -lgnutls
-lm -lgthread-2.0 -lglib-2.0 /usr/lib/i386-linux-gnu/libglib-2.0.so
-liscsi -lgthread-2.0 -lglib-2.0 -laio -lcurl
/usr/lib/i386-linux-gnu/libz.so -lrbd -lrados -lnettle -lgnutls
-Wl,--end-group
libblock.fa(block_io.c.o): In function `stat64_max':
include/qemu/stats64.h:58: undefined reference to `__atomic_load_8'
include/qemu/stats64.h:60: undefined reference to
`__atomic_compare_exchange_8'
libblock.fa(block_qapi.c.o): In function `stat64_get':
include/qemu/stats64.h:40: undefined reference to `__atomic_load_8'
libqemuutil.a(util_qsp.c.o): In function `qatomic_set_u64':
include/qemu/atomic.h:478: undefined reference to `__atomic_store_8'
libqemuutil.a(util_qsp.c.o): In function `qatomic_read_u64':
include/qemu/atomic.h:468: undefined reference to `__atomic_load_8'
clang: error: linker command failed with exit code 1 (use -v to see
invocation)

Issue previously reported on the list here:
https://www.mail-archive.com/qemu-devel@nongnu.org/msg770128.html

** Affects: qemu
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1910505

Title:
  atomic failure linking with --enable-sanitizers on 32-bit Linux hosts

Status in QEMU:
  New

Bug description:
  As of commit 50536341b47, using --enable-sanitizers on 32-bit Linux host:
  - displays various warnings
  - fails linking

  Using Ubuntu 18.04 (release 20201211.1) and Clang10 on i386:

  [139/675] Compiling C object softmmu.fa.p/softmmu_icount.c.o
  In file included from ../softmmu/icount.c:31:
  In file included from include/exec/exec-all.h:23:
  In file included from ../target/mips/cpu.h:4:
  In file included from ../target/mips/cpu-qom.h:23:
  In file included from include/hw/core/cpu.h:23:
  In file included from include/hw/qdev-core.h:5:
  In file included from include/qemu/bitmap.h:16:
  In file included from include/qemu/bitops.h:17:
  include/qemu/atomic.h:463:12: warning: misaligned atomic operation may
  incur significant performance penalty [-Watomic-alignment]
      return qatomic_read__nocheck(ptr);
             ^
  include/qemu/atomic.h:129:5: note: expanded from macro
  'qatomic_read__nocheck'
      __atomic_load_n(ptr, __ATOMIC_RELAXED)
      ^
  include/qemu/atomic.h:473:5: warning: misaligned atomic operation may
  incur significant performance penalty [-Watomic-alignment]
      qatomic_set__nocheck(ptr, val);
      ^
  include/qemu/atomic.h:138:5: note: expanded from macro
  'qatomic_set__nocheck'
      __atomic_store_n(ptr, i, __ATOMIC_RELAXED)
      ^
  2 warnings generated.
  [...]

  [850/2216] Linking target tests/test-hbitmap
  FAILED: tests/test-hbitmap
  clang  -o tests/test-hbitmap tests/test-hbitmap.p/test-hbitmap.c.o
  tests/test-hbitmap.p/iothread.c.o -Wl,--as-needed -Wl,--no-undefined
  -pie -Wl,--whole-archive libblock.fa libcrypto.fa libauthz.fa libqom.fa
  libio.fa -Wl,--no-whole-archive -Wl,--warn-common -fsanitize=undefined
  -fsanitize=address -Wl,-z,relro -Wl,-z,now -m32 -ggdb
  -fstack-protector-strong -Wl,--start-group libqemuutil.a
  subprojects/libvhost-user/libvhost-user-glib.a
  subprojects/libvhost-user/libvhost-user.a libblock.fa libcrypto.fa
  libauthz.fa libqom.fa libio.fa @block.syms -lgio-2.0 -lgobject-2.0
  -lglib-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -pthread -lutil -lgnutls
  -lm -lgthread-2.0 -lglib-2.0 /usr/lib/i386-linux-gnu/libglib-2.0.so
  -liscsi -lgthread-2.0 -lglib-2.0 -laio -lcurl
  /usr/lib/i386-linux-gnu/libz.so -lrbd -lrados -lnettle -lgnutls
  -Wl,--end-group
  libblock.fa(block_io.c.o): In function `stat64_max':
  include/qemu/stats64.h:58: undefined reference to `__atomic_load_8'
  include/qemu/stats64.h:60: undefined reference to
  `__atomic_compare_exchange_8'
  libblock.fa(block_qapi.c.o): In function `stat64_get':
  include/qemu/stats64.h:40: undefined reference to `__atomic_load_8'
  libqemuutil.a(util_qsp.c.o): In function `qatomic_set_u64':
  include/qemu/atomic.h:478: undefined reference to `__atomic_store_8'
  libqemuutil.a(util_qsp.c.o): In function `qatomic_read_u64':
  include/qemu/atomic.h:468: undefined reference to `__atomic_load_8'
  clang: error: linker command failed with exit code 1 (use -v to see
  invocation)

  Issue previously reported on the list here:
  https://www.mail-archive.com/qemu-devel@nongnu.org/msg770128.html

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1910505/+subscriptions


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Bug 1910505] [NEW] atomic failure linking with --enable-sanitizers on 32-bit Linux hosts
  2021-01-07  8:40 [Bug 1910505] [NEW] atomic failure linking with --enable-sanitizers on 32-bit Linux hosts Philippe Mathieu-Daudé
@ 2021-01-07  9:10 ` Philippe Mathieu-Daudé
  2021-01-07 10:23   ` Paolo Bonzini
  2021-05-09 15:44 ` [Bug 1910505] " Philippe Mathieu-Daudé
  1 sibling, 1 reply; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-01-07  9:10 UTC (permalink / raw)
  To: Stefan Hajnoczi, Paolo Bonzini, Emilio G. Cota, Alex Bennée,
	Richard Henderson, Marc-André Lureau
  Cc: qemu-devel, Qemu-block

Cc'ing atomic team and qemu-block@ for "qemu/stats64.h".

On 1/7/21 9:40 AM, Philippe Mathieu-Daudé wrote:
> Public bug reported:
> 
> As of commit 50536341b47, using --enable-sanitizers on 32-bit Linux host:
> - displays various warnings
> - fails linking
> 
> Using Ubuntu 18.04 (release 20201211.1) and Clang10 on i386:
> 
> [139/675] Compiling C object softmmu.fa.p/softmmu_icount.c.o
> In file included from ../softmmu/icount.c:31:
> In file included from include/exec/exec-all.h:23:
> In file included from ../target/mips/cpu.h:4:
> In file included from ../target/mips/cpu-qom.h:23:
> In file included from include/hw/core/cpu.h:23:
> In file included from include/hw/qdev-core.h:5:
> In file included from include/qemu/bitmap.h:16:
> In file included from include/qemu/bitops.h:17:
> include/qemu/atomic.h:463:12: warning: misaligned atomic operation may
> incur significant performance penalty [-Watomic-alignment]
>     return qatomic_read__nocheck(ptr);
>            ^
> include/qemu/atomic.h:129:5: note: expanded from macro
> 'qatomic_read__nocheck'
>     __atomic_load_n(ptr, __ATOMIC_RELAXED)
>     ^
> include/qemu/atomic.h:473:5: warning: misaligned atomic operation may
> incur significant performance penalty [-Watomic-alignment]
>     qatomic_set__nocheck(ptr, val);
>     ^
> include/qemu/atomic.h:138:5: note: expanded from macro
> 'qatomic_set__nocheck'
>     __atomic_store_n(ptr, i, __ATOMIC_RELAXED)
>     ^
> 2 warnings generated.
> [...]
> 
> [850/2216] Linking target tests/test-hbitmap
> FAILED: tests/test-hbitmap
> clang  -o tests/test-hbitmap tests/test-hbitmap.p/test-hbitmap.c.o
> tests/test-hbitmap.p/iothread.c.o -Wl,--as-needed -Wl,--no-undefined
> -pie -Wl,--whole-archive libblock.fa libcrypto.fa libauthz.fa libqom.fa
> libio.fa -Wl,--no-whole-archive -Wl,--warn-common -fsanitize=undefined
> -fsanitize=address -Wl,-z,relro -Wl,-z,now -m32 -ggdb
> -fstack-protector-strong -Wl,--start-group libqemuutil.a
> subprojects/libvhost-user/libvhost-user-glib.a
> subprojects/libvhost-user/libvhost-user.a libblock.fa libcrypto.fa
> libauthz.fa libqom.fa libio.fa @block.syms -lgio-2.0 -lgobject-2.0
> -lglib-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -pthread -lutil -lgnutls
> -lm -lgthread-2.0 -lglib-2.0 /usr/lib/i386-linux-gnu/libglib-2.0.so
> -liscsi -lgthread-2.0 -lglib-2.0 -laio -lcurl
> /usr/lib/i386-linux-gnu/libz.so -lrbd -lrados -lnettle -lgnutls
> -Wl,--end-group
> libblock.fa(block_io.c.o): In function `stat64_max':
> include/qemu/stats64.h:58: undefined reference to `__atomic_load_8'
> include/qemu/stats64.h:60: undefined reference to
> `__atomic_compare_exchange_8'
> libblock.fa(block_qapi.c.o): In function `stat64_get':
> include/qemu/stats64.h:40: undefined reference to `__atomic_load_8'
> libqemuutil.a(util_qsp.c.o): In function `qatomic_set_u64':
> include/qemu/atomic.h:478: undefined reference to `__atomic_store_8'
> libqemuutil.a(util_qsp.c.o): In function `qatomic_read_u64':
> include/qemu/atomic.h:468: undefined reference to `__atomic_load_8'
> clang: error: linker command failed with exit code 1 (use -v to see
> invocation)
> 
> Issue previously reported on the list here:
> https://www.mail-archive.com/qemu-devel@nongnu.org/msg770128.html
> 
> ** Affects: qemu
>      Importance: Undecided
>          Status: New
> 



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Bug 1910505] [NEW] atomic failure linking with --enable-sanitizers on 32-bit Linux hosts
  2021-01-07  9:10 ` Philippe Mathieu-Daudé
@ 2021-01-07 10:23   ` Paolo Bonzini
  0 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2021-01-07 10:23 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé,
	Stefan Hajnoczi, Emilio G. Cota, Alex Bennée,
	Richard Henderson, Marc-André Lureau
  Cc: qemu-devel, Qemu-block

On 07/01/21 10:10, Philippe Mathieu-Daudé wrote:
> libblock.fa(block_io.c.o): In function `stat64_max':
> include/qemu/stats64.h:58: undefined reference to `__atomic_load_8'
> include/qemu/stats64.h:60: undefined reference to
> `__atomic_compare_exchange_8'
> libblock.fa(block_qapi.c.o): In function `stat64_get':
> include/qemu/stats64.h:40: undefined reference to `__atomic_load_8'
> libqemuutil.a(util_qsp.c.o): In function `qatomic_set_u64':
> include/qemu/atomic.h:478: undefined reference to `__atomic_store_8'
> libqemuutil.a(util_qsp.c.o): In function `qatomic_read_u64':
> include/qemu/atomic.h:468: undefined reference to `__atomic_load_8'
> clang: error: linker command failed with exit code 1 (use -v to see
> invocation)
> 
> Issue previously reported on the list here:
> https://www.mail-archive.com/qemu-devel@nongnu.org/msg770128.html

Looks like 64-bit atomics are available without sanitizers, but fall 
back to libatomic with sanitizers (tsan probably?).

So CONFIG_ATOMIC64 is not detected properly in configure, because 
-fsanitize=* flags are added (at "end of CC checks" around line 5000) 
after the atomic64 test (around 400 lines before that).

I'm not sure what breaks if -fsanitize flags are added earlier.

Paolo



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug 1910505] Re: atomic failure linking with --enable-sanitizers on 32-bit Linux hosts
  2021-01-07  8:40 [Bug 1910505] [NEW] atomic failure linking with --enable-sanitizers on 32-bit Linux hosts Philippe Mathieu-Daudé
  2021-01-07  9:10 ` Philippe Mathieu-Daudé
@ 2021-05-09 15:44 ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-09 15:44 UTC (permalink / raw)
  To: qemu-devel

This is an automated cleanup. This bug report has been moved to QEMU's
new bug tracker on gitlab.com and thus gets marked as 'invalid' now.
Please continue with the discussion here:

 https://gitlab.com/qemu-project/qemu/-/issues/235


** Changed in: qemu
       Status: New => Invalid

** Bug watch added: gitlab.com/qemu-project/qemu/-/issues #235
   https://gitlab.com/qemu-project/qemu/-/issues/235

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1910505

Title:
  atomic failure linking with --enable-sanitizers on 32-bit Linux hosts

Status in QEMU:
  Invalid

Bug description:
  As of commit 50536341b47, using --enable-sanitizers on 32-bit Linux host:
  - displays various warnings
  - fails linking

  Using Ubuntu 18.04 (release 20201211.1) and Clang10 on i386:

  [139/675] Compiling C object softmmu.fa.p/softmmu_icount.c.o
  In file included from ../softmmu/icount.c:31:
  In file included from include/exec/exec-all.h:23:
  In file included from ../target/mips/cpu.h:4:
  In file included from ../target/mips/cpu-qom.h:23:
  In file included from include/hw/core/cpu.h:23:
  In file included from include/hw/qdev-core.h:5:
  In file included from include/qemu/bitmap.h:16:
  In file included from include/qemu/bitops.h:17:
  include/qemu/atomic.h:463:12: warning: misaligned atomic operation may
  incur significant performance penalty [-Watomic-alignment]
      return qatomic_read__nocheck(ptr);
             ^
  include/qemu/atomic.h:129:5: note: expanded from macro
  'qatomic_read__nocheck'
      __atomic_load_n(ptr, __ATOMIC_RELAXED)
      ^
  include/qemu/atomic.h:473:5: warning: misaligned atomic operation may
  incur significant performance penalty [-Watomic-alignment]
      qatomic_set__nocheck(ptr, val);
      ^
  include/qemu/atomic.h:138:5: note: expanded from macro
  'qatomic_set__nocheck'
      __atomic_store_n(ptr, i, __ATOMIC_RELAXED)
      ^
  2 warnings generated.
  [...]

  [850/2216] Linking target tests/test-hbitmap
  FAILED: tests/test-hbitmap
  clang  -o tests/test-hbitmap tests/test-hbitmap.p/test-hbitmap.c.o
  tests/test-hbitmap.p/iothread.c.o -Wl,--as-needed -Wl,--no-undefined
  -pie -Wl,--whole-archive libblock.fa libcrypto.fa libauthz.fa libqom.fa
  libio.fa -Wl,--no-whole-archive -Wl,--warn-common -fsanitize=undefined
  -fsanitize=address -Wl,-z,relro -Wl,-z,now -m32 -ggdb
  -fstack-protector-strong -Wl,--start-group libqemuutil.a
  subprojects/libvhost-user/libvhost-user-glib.a
  subprojects/libvhost-user/libvhost-user.a libblock.fa libcrypto.fa
  libauthz.fa libqom.fa libio.fa @block.syms -lgio-2.0 -lgobject-2.0
  -lglib-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -pthread -lutil -lgnutls
  -lm -lgthread-2.0 -lglib-2.0 /usr/lib/i386-linux-gnu/libglib-2.0.so
  -liscsi -lgthread-2.0 -lglib-2.0 -laio -lcurl
  /usr/lib/i386-linux-gnu/libz.so -lrbd -lrados -lnettle -lgnutls
  -Wl,--end-group
  libblock.fa(block_io.c.o): In function `stat64_max':
  include/qemu/stats64.h:58: undefined reference to `__atomic_load_8'
  include/qemu/stats64.h:60: undefined reference to
  `__atomic_compare_exchange_8'
  libblock.fa(block_qapi.c.o): In function `stat64_get':
  include/qemu/stats64.h:40: undefined reference to `__atomic_load_8'
  libqemuutil.a(util_qsp.c.o): In function `qatomic_set_u64':
  include/qemu/atomic.h:478: undefined reference to `__atomic_store_8'
  libqemuutil.a(util_qsp.c.o): In function `qatomic_read_u64':
  include/qemu/atomic.h:468: undefined reference to `__atomic_load_8'
  clang: error: linker command failed with exit code 1 (use -v to see
  invocation)

  Issue previously reported on the list here:
  https://www.mail-archive.com/qemu-devel@nongnu.org/msg770128.html

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1910505/+subscriptions


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-05-09 15:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-07  8:40 [Bug 1910505] [NEW] atomic failure linking with --enable-sanitizers on 32-bit Linux hosts Philippe Mathieu-Daudé
2021-01-07  9:10 ` Philippe Mathieu-Daudé
2021-01-07 10:23   ` Paolo Bonzini
2021-05-09 15:44 ` [Bug 1910505] " Philippe Mathieu-Daudé

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.