diff options
author | Andy Fiddaman <omnios@citrus-it.co.uk> | 2021-03-15 13:49:23 +0000 |
---|---|---|
committer | Andy Fiddaman <omnios@citrus-it.co.uk> | 2021-03-20 10:12:40 +0000 |
commit | 9ecd05bdc59e4a1091c51ce68cce2028d5ba6fd1 (patch) | |
tree | 3e63cf3c1501115dd95de7f7f5716e7947e0d0cd | |
parent | 88a8a2ff3233e21e4ab8bc203109d12dc5d5a189 (diff) | |
download | illumos-joyent-9ecd05bdc59e4a1091c51ce68cce2028d5ba6fd1.tar.gz |
13635 libast does not link with gcc4
Reviewed by: Jason King <jason.king@joyent.com>
Reviewed by: Rich Lowe <richlowe@richlowe.net>
Approved by: Dan McDonald <danmcd@joyent.com>
-rw-r--r-- | usr/src/cmd/ast/README.ast | 5 | ||||
-rw-r--r-- | usr/src/cmd/ast/libast/i386/FEATURE/aso | 26 |
2 files changed, 31 insertions, 0 deletions
diff --git a/usr/src/cmd/ast/README.ast b/usr/src/cmd/ast/README.ast index e9ad2cfff8..9d4a524e56 100644 --- a/usr/src/cmd/ast/README.ast +++ b/usr/src/cmd/ast/README.ast @@ -16,3 +16,8 @@ The FEATURE files can be re-generated based on the current contents of proto using 'make _feature' in this directory. This should be done after adding new features to the standard libraries that AST can detect and use. This needs to be done for all supported architectures. + +Note that for the moment, as long as building gate using gcc 4.4.4 as the +primary compiler is supported, libast/i386/FEATURE/aso has some additional +local edits to use the appropriate atomic ops for 32-bit objects built +with this version of gcc. diff --git a/usr/src/cmd/ast/libast/i386/FEATURE/aso b/usr/src/cmd/ast/libast/i386/FEATURE/aso index 8baa447c72..335c580176 100644 --- a/usr/src/cmd/ast/libast/i386/FEATURE/aso +++ b/usr/src/cmd/ast/libast/i386/FEATURE/aso @@ -2,6 +2,30 @@ #ifndef _def_aso_ast #define _def_aso_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ + +#if defined (__GNUC__) && (__GNUC__ == 4) +/* <atomic.h> atomic_cas_64 */ +#include <atomic.h> +#define _aso_cas8(p,o,n) atomic_cas_8(p,o,n) +#define _aso_inc8(p) (atomic_add_8_nv(p,1)-1) +#define _aso_dec8(p) (atomic_add_8_nv(p,-1)+1) +#define _aso_cas16(p,o,n) atomic_cas_16(p,o,n) +#define _aso_inc16(p) (atomic_add_16_nv(p,1)-1) +#define _aso_dec16(p) (atomic_add_16_nv(p,-1)+1) +#define _aso_cas32(p,o,n) atomic_cas_32(p,o,n) +#define _aso_inc32(p) (atomic_add_32_nv(p,1)-1) +#define _aso_dec32(p) (atomic_add_32_nv(p,-1)+1) +#define _aso_cas64(p,o,n) atomic_cas_64(p,o,n) +#define _aso_inc64(p) (atomic_add_64_nv(p,1)-1) +#define _aso_dec64(p) (atomic_add_64_nv(p,-1)+1) +#if _ast_sizeof_pointer == 8 +#define _aso_casptr(p,o,n) ((void*)atomic_cas_64((uint64_t*)p,(uint64_t)o,(uint64_t)n)) +#else +#define _aso_casptr(p,o,n) ((void*)atomic_cas_32((uint32_t*)p,(uint32_t)o,(uint32_t)n)) +#endif + +#else /* __GNUC__ == 4 */ + /* gcc 4.1+ 64 bit memory atomic operations model */ #define _aso_cas8(p,o,n) __sync_val_compare_and_swap(p,o,n) #define _aso_inc8(p) __sync_fetch_and_add(p,1) @@ -21,4 +45,6 @@ #define _aso_casptr(p,o,n) ((void*)__sync_val_compare_and_swap(p,(uint32_t)o,(uint32_t)n)) #endif +#endif /* __GNUC__ == 4 */ + #endif |