]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
build: fix atomic linking with LTO on s390x
authorKen Dreyer <kdreyer@redhat.com>
Mon, 18 Jul 2022 19:06:06 +0000 (15:06 -0400)
committerKen Dreyer <kdreyer@redhat.com>
Mon, 18 Jul 2022 19:19:02 +0000 (15:19 -0400)
Prior to this change, Fedora and RHEL 9 on s390x would incorrectly pass
the HAVE_CXX11_ATOMIC check. As a consequence, the rest of Ceph would
fail to link because of missing atomic methods "__atomic_load_16",
"__atomic_store_16", "__atomic_compare_exchange_16".

Mark this method so that it is not optimized out, even with LTO. With
this change, s390x properly fails HAVE_CXX11_ATOMIC and falls back to
HAVE_LIBATOMIC.

Move the "BuildRequires: libatomic" RPM line out from the seastar+fedora
conditional and into the main fedora+rhel conditional so that the
HAVE_LIBATOMIC check will pass.

Fixes: https://tracker.ceph.com/issues/54514
Fixes: https://tracker.ceph.com/issues/56492
Co-authored-by: Kaleb S. Keithley <kkeithle@redhat.com>
Signed-off-by: Ken Dreyer <kdreyer@redhat.com>
ceph.spec.in
cmake/modules/CheckCxxAtomic.cmake

index becee7bb7485f63be031f0b6274a5e50c667903f..d06a9fe5468358ce5180600caeaa8f601fbffa10 100644 (file)
@@ -324,7 +324,6 @@ BuildRequires:  systemtap-sdt-devel
 %if 0%{?fedora}
 BuildRequires:  libubsan
 BuildRequires:  libasan
-BuildRequires:  libatomic
 %endif
 %if 0%{?rhel}
 BuildRequires:  gcc-toolset-11-annobin-plugin-gcc
@@ -366,6 +365,7 @@ Requires:   systemd
 BuildRequires:  boost-random
 BuildRequires: nss-devel
 BuildRequires: keyutils-libs-devel
+BuildRequires:  libatomic
 BuildRequires: libibverbs-devel
 BuildRequires:  librdmacm-devel
 BuildRequires:  ninja-build
index 02d55612e818e17393f5d10305edf3edc7608a5e..8bbeaa09f36fd99d03cabc87af2841233758a2bd 100644 (file)
@@ -27,6 +27,7 @@ struct tagged_ptr {
   std::size_t tag;
 };
 
+void atomic16(std::atomic<tagged_ptr> *ptr) __attribute__ ((used));
 void atomic16(std::atomic<tagged_ptr> *ptr)
 {
   tagged_ptr p{nullptr, 1};