[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT/NEWLIB PATCH 2/2] Add patch to fix atomic_* definitions


  • To: "minios-devel@xxxxxxxxxxxxx" <minios-devel@xxxxxxxxxxxxx>
  • From: Vlad-Andrei BĂDOIU (78692) <vlad_andrei.badoiu@xxxxxxxxxxxxxxx>
  • Date: Tue, 17 Dec 2019 17:05:04 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=stud.acs.upb.ro; dmarc=pass action=none header.from=stud.acs.upb.ro; dkim=pass header.d=stud.acs.upb.ro; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rBmTMdJsDJ55nE8flRjqHZ5JcqZC0bSx1k0tzD25Ees=; b=oJAUrWkPsK8uaFxaSJWjz85OUbukmCgxQW5KamPfEgrEB6pAo9Km4c5tgL9TGAK83/yRXorkApwwGUUyps5QIIWw1kDU/A5MWfe0ZbtADYqXEu/YFzAhY69Wkod+HNbX9wVZrX+9PhWVI1c4S6W1LcUmTej0HJVtpElHtrCnmgyMFH8zRMWgtcSLHI4dyNHoJA60r1XM9sSZ90ftpzrA6JkW06A0rlZuh+rr+6qFCEy2wIED7w//IX9tXItTmiXFMt9Zv9T1xmQ3BY4tMzleT8uqyxGOwMQa92leeqhnNM2/ieYfASn+v56BbqOi7+Q7vuivlaJ7BlLbAu7oZ7xZpQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j5/nHyJnnlMqZ5DcUh7mndVrgw1cXXX3vRuOHeiufAdHiF67K0G4LQwMoLcw22Rkza2b8XcnISvD9vrh+rPyusjEbzrz4nw41bXTCICsH+0+b1MCG/e6GA7+mJa4rDYAU2B1WHAIG/9sWk8MWfaGsK7QO3BAHwy0o8Z5Od7M+SARdfIEyLdfNVJj1uc8GluNeJb7mU3ESz4vlo5X2FBskdx9YCuzciqyIewtFOd+Kimop2x3xSvOV/rad78wABNXjWQquaaDhYUF+eXI6Iph51b/Ki9Yc7gFzqg1SCaWeyfVcMbd3hvrmgTAVr+VbNpSEXgcT5YvbHXRV30NiSQyOg==
  • Authentication-results: spf=none (sender IP is ) smtp.mailfrom=vlad_andrei.badoiu@xxxxxxxxxxxxxxx;
  • Cc: "felipe.huici@xxxxxxxxx" <felipe.huici@xxxxxxxxx>, "simon.kuenzer@xxxxxxxxx" <simon.kuenzer@xxxxxxxxx>, Vlad-Andrei BĂDOIU (78692) <vlad_andrei.badoiu@xxxxxxxxxxxxxxx>, "costin.lupu@xxxxxxxxx" <costin.lupu@xxxxxxxxx>
  • Delivery-date: Tue, 17 Dec 2019 17:05:22 +0000
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>
  • Thread-index: AQHVtPwgi0rGE/ScZUeP9mmlOX/nsA==
  • Thread-topic: [UNIKRAFT/NEWLIB PATCH 2/2] Add patch to fix atomic_* definitions

Currently, including stdatomic.h causes the compilation to fail due to
the obsolate definitions of atomic_* functions. We adapt the existing
implementations via a patch to fix this.

Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@xxxxxxxxxxxxxxx>
---
 ...-stdatomic.h-Fix-atomic_-definitions.patch | 93 +++++++++++++++++++
 1 file changed, 93 insertions(+)
 create mode 100644 patches/0009-stdatomic.h-Fix-atomic_-definitions.patch

diff --git a/patches/0009-stdatomic.h-Fix-atomic_-definitions.patch 
b/patches/0009-stdatomic.h-Fix-atomic_-definitions.patch
new file mode 100644
index 0000000..6cb8a82
--- /dev/null
+++ b/patches/0009-stdatomic.h-Fix-atomic_-definitions.patch
@@ -0,0 +1,93 @@
+From 2886f7e1f6546ef85778589cdfe65b8d0fb99002 Mon Sep 17 00:00:00 2001
+From: Vlad-Andrei Badoiu <vlad_andrei.badoiu@xxxxxxxxxxxxxxx>
+Date: Tue, 17 Dec 2019 18:50:03 +0200
+Subject: [PATCH 1/1] stdatomic.h: Fix atomic_* definitions
+
+The current atomic_* do not compile under GCC, we adapt the
+implementation to follow the existing ones from gcc.
+
+Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@xxxxxxxxxxxxxxx>
+---
+ newlib/libc/include/stdatomic.h | 58 ++++++++++++++++++++++++---------
+ 1 file changed, 42 insertions(+), 16 deletions(-)
+
+diff --git a/newlib/libc/include/stdatomic.h b/newlib/libc/include/stdatomic.h
+index 09c0cf7..daa1969 100644
+--- a/newlib/libc/include/stdatomic.h
++++ b/newlib/libc/include/stdatomic.h
+@@ -258,30 +258,56 @@ typedef _Atomic(uintmax_t)               
atomic_uintmax_t;
+ #define       atomic_store_explicit(object, desired, order)                   
\
+       __c11_atomic_store(object, desired, order)
+ #elif defined(__GNUC_ATOMICS)
+-#define       atomic_compare_exchange_strong_explicit(object, expected,       
\
+-    desired, success, failure)                                                
\
+-      __atomic_compare_exchange_n(&(object)->__val, expected,         \
+-          desired, 0, success, failure)
+-#define       atomic_compare_exchange_weak_explicit(object, expected,         
\
+-    desired, success, failure)                                                
\
+-      __atomic_compare_exchange_n(&(object)->__val, expected,         \
+-          desired, 1, success, failure)
++#define       atomic_compare_exchange_strong_explicit(object, expected,       
                \
++    desired, success, failure)                                                
                \
++__extension__                                                                 
        \
++({                                                                            
        \
++      __auto_type __atomic_compare_exchange_ptr = (object);                   
        \
++      __typeof__ (*__atomic_compare_exchange_ptr) 
__atomic_compare_exchange_tmp       \
++      = (desired);                                                            
        \
++      __atomic_compare_exchange (__atomic_compare_exchange_ptr, (expeced),    
        \
++              &__atomic_compare_exchange_tmp,                                 
        \
++              0, (success), (failure));                                       
        \
++  })
++#define       atomic_compare_exchange_weak_explicit(object, expected,         
                \
++    desired, success, failure)                                                
                \
++__extension__                                                                 
        \
++({                                                                            
        \
++      __auto_type __atomic_compare_exchange_ptr = (object);                   
        \
++      __typeof__ (*__atomic_compare_exchange_ptr) 
__atomic_compare_exchange_tmp       \
++      = (desired);                                                            
        \
++      __atomic_compare_exchange (__atomic_compare_exchange_ptr, (expected),   
        \
++              &__atomic_compare_exchange_tmp,                                 
        \
++              1, (success), (failure));                                       
        \
++  })
+ #define       atomic_exchange_explicit(object, desired, order)                
\
+-      __atomic_exchange_n(&(object)->__val, desired, order)
++      __atomic_exchange_n((object), (desired), (order))
+ #define       atomic_fetch_add_explicit(object, operand, order)               
\
+-      __atomic_fetch_add(&(object)->__val, operand, order)
++      __atomic_fetch_add((object), (operand), (order))
+ #define       atomic_fetch_and_explicit(object, operand, order)               
\
+-      __atomic_fetch_and(&(object)->__val, operand, order)
++      __atomic_fetch_and((object), (operand), (order))
+ #define       atomic_fetch_or_explicit(object, operand, order)                
\
+-      __atomic_fetch_or(&(object)->__val, operand, order)
++      __atomic_fetch_or((object), (operand), (order))
+ #define       atomic_fetch_sub_explicit(object, operand, order)               
\
+-      __atomic_fetch_sub(&(object)->__val, operand, order)
++      __atomic_fetch_sub((object), (operand), (order))
+ #define       atomic_fetch_xor_explicit(object, operand, order)               
\
+-      __atomic_fetch_xor(&(object)->__val, operand, order)
++      __atomic_fetch_xor((object), (operand), (order))
+ #define       atomic_load_explicit(object, order)                             
\
+-      __atomic_load_n(&(object)->__val, order)
++__extension__                                                         \
++({                                                                    \
++      __auto_type __atomic_load_ptr = (object);                               
\
++      __typeof__ (*__atomic_load_ptr) __atomic_load_tmp;                      
\
++      __atomic_load (__atomic_load_ptr, &__atomic_load_tmp, (order)); \
++      __atomic_load_tmp;                                                      
\
++})
+ #define       atomic_store_explicit(object, desired, order)                   
\
+-      __atomic_store_n(&(object)->__val, desired, order)
++__extension__                                                         \
++({                                                                    \
++      __auto_type __atomic_store_ptr = (object);                              
\
++      __typeof__ (*__atomic_store_ptr) __atomic_store_tmp = (desired);        
\
++      __atomic_store (__atomic_store_ptr, &__atomic_store_tmp, (order));      
\
++})
++
+ #else
+ #define       __atomic_apply_stride(object, operand) \
+       (((__typeof__((object)->__val))0) + (operand))
+-- 
+2.20.1
+
-- 
2.20.1


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.