]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
build: fix atomic linking with LTO on s390x private-jcaratza-ceph-6.0-bz2108325-2-patches
authorKen Dreyer <kdreyer@redhat.com>
Mon, 18 Jul 2022 19:06:06 +0000 (15:06 -0400)
committerJustin Caratzas <jcaratza@redhat.com>
Tue, 20 Sep 2022 03:12:48 +0000 (23:12 -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 9f522a750b7866d1dfe490536e52c24fed1e1175..c0806afaf7a857f5e57abb089bda3f413125fc44 100644 (file)
@@ -311,7 +311,6 @@ BuildRequires:  systemtap-sdt-devel
 %if 0%{?fedora}
 BuildRequires:  libubsan
 BuildRequires:  libasan
-BuildRequires:  libatomic
 %endif
 %if 0%{?rhel}
 BuildRequires:  gcc-toolset-9-annobin
@@ -353,6 +352,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 78c0f988707a0577f79878c1f02febfbbe34b7a3..ac697553f08b32798052b7673dcc20a36ed16692 100644 (file)
@@ -24,7 +24,14 @@ function(check_cxx_atomics var)
 // We specifically test access via an otherwise unknown pointer here
 // to ensure we get the most complex case.  If this access can be
 // done without libatomic, then all accesses can be done.
+struct tagged_ptr {
+  int* ptr;
+  std::size_t tag;
+};
+
 bool atomic16(std::atomic<unsigned __int128> *ptr)
+void atomic16(std::atomic<tagged_ptr> *ptr) __attribute__ ((used));
+void atomic16(std::atomic<tagged_ptr> *ptr)
 {
   return *ptr != 0;
 }