You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2020/11/19 08:50:38 UTC

[incubator-nuttx] 33/34: sim types.h: A workaround for macOS MODULECC

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 123d882027e9d1d90cccb4233df8e17ae0bca28b
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Mon Nov 16 10:12:13 2020 +0900

    sim types.h: A workaround for macOS MODULECC
---
 arch/sim/include/inttypes.h | 2 +-
 arch/sim/include/types.h    | 9 ++++++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/arch/sim/include/inttypes.h b/arch/sim/include/inttypes.h
index 68f2dd5..35cef6e 100644
--- a/arch/sim/include/inttypes.h
+++ b/arch/sim/include/inttypes.h
@@ -44,7 +44,7 @@
  * Pre-processor Definitions
  ****************************************************************************/
 
-#if defined(CONFIG_HOST_MACOS)
+#if defined(__APPLE_CC__) || !defined(_LP64)
 #  define _PRI64PREFIX "ll"
 #  define _SCN64PREFIX "ll"
 #  define INT64_C(x)  x ## ll
diff --git a/arch/sim/include/types.h b/arch/sim/include/types.h
index 955e189..5d0958e 100644
--- a/arch/sim/include/types.h
+++ b/arch/sim/include/types.h
@@ -75,9 +75,16 @@ typedef unsigned int       _uint32_t;
 /* Note about host OS types:
  * - int64_t is long long for 64-bit macOS
  * - int64_t is long for Ubuntu x86-64
+ *
+ * Note for sim/macOS modules:
+ * For sim/macOS, usually x86_64-elf-gcc from homebrew is used
+ * as MODULECC. It seems to be configured as __INT64_TYPE__ == long int.
+ * The __APPLE_CC__ check below is to workaround it.
+ * (The host cc defines __APPLE_CC__, while x86_64-elf-gcc doesn't.)
+ * XXX It is a problem if you need C++ symbols in symtabs for modules.
  */
 
-#if defined(CONFIG_HOST_MACOS) || !defined(_LP64)
+#if defined(__APPLE_CC__) || !defined(_LP64)
 typedef signed long long   _int64_t;
 typedef unsigned long long _uint64_t;
 #else