From a937089d6ffcbfe82ac06754451d1d67c12cc36d Mon Sep 17 00:00:00 2001 From: Sandipan Das Date: Thu, 16 Jul 2020 21:35:48 +0530 Subject: [PATCH] systemc: Fix builds on Power systems Based on the 64-bit ELF ABI for Power systems (ppc64 and ppc64le), the data types int64_t and uint64_t are typedefs of long and unsigned long respectively. If the SystemC data types int64 and uint64 point to these, several errors are observed while building the simulator on Power systems due to ambiguity between the types when overloading some operators and functions. E.g. ... build/POWER/systemc/ext/channel/../dt/bit/sc_bit.hh:114:17: error: 'static bool sc_dt::sc_bit::to_value(sc_dt::int64)' cannot be overloaded with 'static bool sc_dt::sc_bit::to_value(long int)' 114 | static bool to_value(tp i) { return to_value((int)i); } | ^~~~~~~~ ... build/POWER/systemc/ext/channel/../dt/bit/sc_bit.hh:114:17: note: previous declaration 'static bool sc_dt::sc_bit::to_value(long int)' 114 | static bool to_value(tp i) { return to_value((int)i); } | ^~~~~~~~ ... This adds a minor change to a SystemC datatype header to ensure that the simulator can be built on Power systems. Change-Id: Icd8bb38134bf98768cc38f9856d7d11a01ebaf21 Signed-off-by: Sandipan Das Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/31414 Reviewed-by: Jason Lowe-Power Maintainer: Gabe Black Tested-by: kokoro --- src/systemc/ext/dt/int/sc_nbdefs.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/systemc/ext/dt/int/sc_nbdefs.hh b/src/systemc/ext/dt/int/sc_nbdefs.hh index 3854a9198..536a0fc2c 100644 --- a/src/systemc/ext/dt/int/sc_nbdefs.hh +++ b/src/systemc/ext/dt/int/sc_nbdefs.hh @@ -164,7 +164,7 @@ typedef unsigned int sc_digit; // 32-bit unsigned integer // Support for the long long type. This type is not in the standard // but is usually supported by compilers. -#if defined(__x86_64__) || defined(__aarch64__) +#if defined(__x86_64__) || defined(__aarch64__) || defined(__powerpc64__) typedef long long int64; typedef unsigned long long uint64; #else -- 2.30.2