diff options
author | Andrew Morrow <acm@mongodb.com> | 2021-12-06 15:58:07 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-12-09 19:49:08 +0000 |
commit | 2752e6291178bb3df11f766985061bbba81f3b6d (patch) | |
tree | 18b0dc97c3f87076518608c4dd083e202b8d9ecb | |
parent | 6ea30e6fce2cea6a1080156cf9a5b11037f1fdb1 (diff) | |
download | mongo-2752e6291178bb3df11f766985061bbba81f3b6d.tar.gz |
SERVER-61929 Add basic riscv64 support
-rw-r--r-- | SConstruct | 23 | ||||
-rw-r--r-- | src/mongo/platform/atomic_word.h | 6 | ||||
-rw-r--r-- | src/third_party/IntelRDFPMathLib20U1/SConscript | 2 | ||||
-rw-r--r-- | src/third_party/wiredtiger/SConscript | 1 |
4 files changed, 14 insertions, 18 deletions
diff --git a/SConstruct b/SConstruct index 425d1a79938..03dfdff4b91 100644 --- a/SConstruct +++ b/SConstruct @@ -1350,26 +1350,17 @@ endian = get_option( "endian" ) if endian == "auto": endian = sys.byteorder -# These preprocessor macros came from -# http://nadeausoftware.com/articles/2012/02/c_c_tip_how_detect_processor_type_using_compiler_predefined_macros -# -# NOTE: Remember to add a trailing comma to form any required one -# element tuples, or your configure checks will fail in strange ways. processor_macros = { - 'arm' : { 'endian': 'little', 'defines': ('__arm__',) }, - 'aarch64' : { 'endian': 'little', 'defines': ('__arm64__', '__aarch64__')}, - 'i386' : { 'endian': 'little', 'defines': ('__i386', '_M_IX86')}, - 'ppc64le' : { 'endian': 'little', 'defines': ('__powerpc64__',)}, - 's390x' : { 'endian': 'big', 'defines': ('__s390x__',)}, - 'sparc' : { 'endian': 'big', 'defines': ('__sparc',)}, - 'x86_64' : { 'endian': 'little', 'defines': ('__x86_64', '_M_AMD64')}, - 'emscripten' : { 'endian': 'little', 'defines': ('__EMSCRIPTEN__', )}, + 'aarch64' : { 'endian': 'little', 'check': '(defined(__arm64__) || defined(__aarch64__))' }, + 'emscripten' : { 'endian': 'little', 'check': '(defined(__EMSCRIPTEN__))' }, + 'ppc64le' : { 'endian': 'little', 'check': '(defined(__powerpc64__))' }, + 'riscv64' : { 'endian': 'little', 'check': '(defined(__riscv)) && (__riscv_xlen == 64)' }, + 's390x' : { 'endian': 'big', 'check': '(defined(__s390x__))' }, + 'x86_64' : { 'endian': 'little', 'check': '(defined(__x86_64) || defined(_M_AMD64))' }, } def CheckForProcessor(context, which_arch): def run_compile_check(arch): - full_macros = " || ".join([ "defined(%s)" % (v) for v in processor_macros[arch]['defines']]) - if not endian == processor_macros[arch]['endian']: return False @@ -1379,7 +1370,7 @@ def CheckForProcessor(context, which_arch): #else #error not {1} #endif - """.format(full_macros, arch) + """.format(processor_macros[arch]['check'], arch) return context.TryCompile(textwrap.dedent(test_body), ".c") diff --git a/src/mongo/platform/atomic_word.h b/src/mongo/platform/atomic_word.h index 1f3f0a83892..c277497b15c 100644 --- a/src/mongo/platform/atomic_word.h +++ b/src/mongo/platform/atomic_word.h @@ -125,8 +125,12 @@ public: } protected: + // At least with GCC 10, this assertion fails for small types like bool. +#if !defined(__riscv) MONGO_STATIC_ASSERT(std::atomic<WordType>::is_always_lock_free); // NOLINT - std::atomic<WordType> _value; // NOLINT +#endif + + std::atomic<WordType> _value; // NOLINT }; /** diff --git a/src/third_party/IntelRDFPMathLib20U1/SConscript b/src/third_party/IntelRDFPMathLib20U1/SConscript index b53c1f7762c..6fc8163484a 100644 --- a/src/third_party/IntelRDFPMathLib20U1/SConscript +++ b/src/third_party/IntelRDFPMathLib20U1/SConscript @@ -313,7 +313,7 @@ elif processor == "aarch64": cpp_defines['efi2'] = '1' cpp_defines['EFI2'] = '1' # Using 64 bit little endian -elif processor == 'x86_64' or processor == 'ppc64le': +elif processor == 'x86_64' or processor == 'ppc64le' or processor == 'riscv64': cpp_defines['efi2'] = '1' cpp_defines['EFI2'] = '1' # Using 64 bit big endian diff --git a/src/third_party/wiredtiger/SConscript b/src/third_party/wiredtiger/SConscript index b7f50e9ff62..084b8281bc3 100644 --- a/src/third_party/wiredtiger/SConscript +++ b/src/third_party/wiredtiger/SConscript @@ -154,6 +154,7 @@ condition_map = { 'ARM64_HOST' : env['TARGET_ARCH'] == 'aarch64', 'POWERPC_HOST' : env['TARGET_ARCH'] == 'ppc64le', + 'RISCV64_HOST' : env['TARGET_ARCH'] == 'riscv64', 'X86_HOST' : env['TARGET_ARCH'] == 'x86_64', 'ZSERIES_HOST' : env['TARGET_ARCH'] == 's390x', } |