diff options
author | Dan McDonald <danmcd@joyent.com> | 2021-02-11 11:18:55 -0500 |
---|---|---|
committer | Dan McDonald <danmcd@joyent.com> | 2021-02-11 11:19:56 -0500 |
commit | 2f1bf94956d3fe3e668d961403094aa32964d7c1 (patch) | |
tree | 54bbcbfb1790bc7ed1203b2536891321bdec904f | |
parent | cbc25ae7e56661048b2525598c793dd387ad85da (diff) | |
download | illumos-joyent-release-20210211.tar.gz |
OS-8267 New ksh93 breaks gcc4 buildrelease-20210211
Reviewed by: Jason King <jbk@joyent.com>
Approved by: Jason King <jbk@joyent.com>
-rw-r--r-- | usr/src/cmd/ast/libast/amd64/FEATURE/aso | 28 | ||||
-rw-r--r-- | usr/src/cmd/ast/libast/i386/FEATURE/aso | 28 |
2 files changed, 56 insertions, 0 deletions
diff --git a/usr/src/cmd/ast/libast/amd64/FEATURE/aso b/usr/src/cmd/ast/libast/amd64/FEATURE/aso index 8baa447c72..af56c08611 100644 --- a/usr/src/cmd/ast/libast/amd64/FEATURE/aso +++ b/usr/src/cmd/ast/libast/amd64/FEATURE/aso @@ -2,6 +2,33 @@ #ifndef _def_aso_ast #define _def_aso_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ + +/* + * This is horrible, but since SmartOS still compiles with gcc4 in its + * Jenkins pipeline (and for building modern smartos on older systems), + * we need to use sparc-style workaround for the illumos gcc4 compiler. + */ +#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 /* illumos-gcc4 */ /* 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) @@ -20,5 +47,6 @@ #else #define _aso_casptr(p,o,n) ((void*)__sync_val_compare_and_swap(p,(uint32_t)o,(uint32_t)n)) #endif +#endif /* illumos-gcc4 */ #endif diff --git a/usr/src/cmd/ast/libast/i386/FEATURE/aso b/usr/src/cmd/ast/libast/i386/FEATURE/aso index 8baa447c72..af56c08611 100644 --- a/usr/src/cmd/ast/libast/i386/FEATURE/aso +++ b/usr/src/cmd/ast/libast/i386/FEATURE/aso @@ -2,6 +2,33 @@ #ifndef _def_aso_ast #define _def_aso_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ + +/* + * This is horrible, but since SmartOS still compiles with gcc4 in its + * Jenkins pipeline (and for building modern smartos on older systems), + * we need to use sparc-style workaround for the illumos gcc4 compiler. + */ +#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 /* illumos-gcc4 */ /* 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) @@ -20,5 +47,6 @@ #else #define _aso_casptr(p,o,n) ((void*)__sync_val_compare_and_swap(p,(uint32_t)o,(uint32_t)n)) #endif +#endif /* illumos-gcc4 */ #endif |