summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-01-18 07:38:50 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-01-18 07:38:50 -0600
commit1cc717520d36623c08f8b60f9cd7fede1bd8f1c1 (patch)
treee6b405ac17b052a1ab9bdfb0286f08eff0e8dea6
parent4f8b0d0a714a7f8302e876e217e8f49e2c5901d5 (diff)
downloadnuttx-1cc717520d36623c08f8b60f9cd7fede1bd8f1c1.tar.gz
nuttx-1cc717520d36623c08f8b60f9cd7fede1bd8f1c1.tar.bz2
nuttx-1cc717520d36623c08f8b60f9cd7fede1bd8f1c1.zip
X86: Add a configuration option to select the -m32 compiler option when needed
-rw-r--r--nuttx/ChangeLog4
-rw-r--r--nuttx/arch/x86/Kconfig25
-rw-r--r--nuttx/configs/qemu-i486/nsh/Make.defs12
-rw-r--r--nuttx/configs/qemu-i486/ostest/Make.defs12
4 files changed, 36 insertions, 17 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog
index 8ffb11d47..ee7ce7829 100644
--- a/nuttx/ChangeLog
+++ b/nuttx/ChangeLog
@@ -6480,3 +6480,7 @@
little harder, I re-implemented the backed-out custom configuration
feature. The new version does not have bad side-effect (1) (but stil
has bad side-effect (2)) (2014-1-16).
+ * arch/x86/Kconfig and configs/qemu-i486/nsh/Make.defs and
+ ostest/Make.defs: Add a configuration option to select the -m32
+ compiler option when building for a 32-bit target on a native 64-bit
+ compiler (2014-1-18).
diff --git a/nuttx/arch/x86/Kconfig b/nuttx/arch/x86/Kconfig
index 10c081fab..42e47dc39 100644
--- a/nuttx/arch/x86/Kconfig
+++ b/nuttx/arch/x86/Kconfig
@@ -12,6 +12,7 @@ choice
config ARCH_I486
bool "i486"
+ select ARCH_X86_HAVE_32BIT
---help---
Intel i486 architecture
@@ -19,15 +20,33 @@ endchoice
config ARCH_CHIP_QEMU
bool "Qemu x86 emulation"
+ default n
---help---
Intel i486 architecture
config ARCH_CHIP
string
- default "qemu" if ARCH_CHIP_QEMU
+ default "qemu" if ARCH_CHIP_QEMU
+
+config ARCH_X86_HAVE_32BIT
+ bool
+ default n
+
+config ARCH_X86_M32
+ bool "Build 32-bit system with a 64-bit machine"
+ default n
+ depends on ARCH_X86_HAVE_32BIT
+ ---help---
+ If you are building for a 32-bit target using a native 64-bit
+ toolchain, then you need to add compilation options to select the
+ 32-bit target. Selecting this option will add the -m32 option to
+ the compiler command line.
source arch/x86/src/common/Kconfig
+if ARCH_I486
source arch/x86/src/i486/Kconfig
+endif # ARCH_I486
+if ARCH_CHIP_QEMU
source arch/x86/src/qemu/Kconfig
-
-endif
+endif # ARCH_CHIP_QEMU
+endif # ARCH_X86
diff --git a/nuttx/configs/qemu-i486/nsh/Make.defs b/nuttx/configs/qemu-i486/nsh/Make.defs
index acd5a6ce9..1bd412f9e 100644
--- a/nuttx/configs/qemu-i486/nsh/Make.defs
+++ b/nuttx/configs/qemu-i486/nsh/Make.defs
@@ -1,7 +1,7 @@
############################################################################
# configs/qemu-i486/nsh/Make.defs
#
-# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Copyright (C) 2011, 2014 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@@ -69,11 +69,10 @@ ARCHPICFLAGS = -fpic
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
ARCHDEFINES =
-ifeq ($(HOSTOS),FreeBSD)
- HOST_ARCH = ${shell uname -m 2>/dev/null || echo "Other"}
- ifeq ($(HOST_ARCH),amd64)
- ARCHCPUFLAGS += -m32
- endif
+# Check if building a 32-bit target with a 64-bit toolchain
+
+ifeq ($(ARCH_X86_M32),y)
+ARCHCPUFLAGS += -m32
endif
# We have to use a cross-development toolchain under Cygwin because the native
@@ -105,7 +104,6 @@ ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
LDFLAGS += -g
endif
-
MKDEP = $(TOPDIR)/tools/mkdeps.sh
HOSTCC = gcc
diff --git a/nuttx/configs/qemu-i486/ostest/Make.defs b/nuttx/configs/qemu-i486/ostest/Make.defs
index 937588fc2..0ed7cc3df 100644
--- a/nuttx/configs/qemu-i486/ostest/Make.defs
+++ b/nuttx/configs/qemu-i486/ostest/Make.defs
@@ -1,7 +1,7 @@
############################################################################
# configs/qemu-i486/ostest/Make.defs
#
-# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Copyright (C) 2011, 2014 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@@ -69,11 +69,10 @@ ARCHPICFLAGS = -fpic
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
ARCHDEFINES =
-ifeq ($(HOSTOS),FreeBSD)
- HOST_ARCH = ${shell uname -m 2>/dev/null || echo "Other"}
- ifeq ($(HOST_ARCH),amd64)
- ARCHCPUFLAGS += -m32
- endif
+# Check if building a 32-bit target with a 64-bit toolchain
+
+ifeq ($(ARCH_X86_M32),y)
+ARCHCPUFLAGS += -m32
endif
# We have to use a cross-development toolchain under Cygwin because the native
@@ -105,7 +104,6 @@ ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
LDFLAGS += -g
endif
-
MKDEP = $(TOPDIR)/tools/mkdeps.sh
HOSTCC = gcc