Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Franck Bui-Huu <vagabon.xyz@gmail.com>
To: ralf@linux-mips.org
Cc: linux-mips@linux-mips.org, anemo@mba.ocn.ne.jp, macro@linux-mips.org
Subject: [PATCH 2/3] Automatically set CONFIG_BUILD_ELF64
Date: Tue, 13 Feb 2007 10:18:08 +0100	[thread overview]
Message-ID: <11713582901742-git-send-email-fbuihuu@gmail.com> (raw)
In-Reply-To: <1171358289786-git-send-email-fbuihuu@gmail.com>

From: Franck Bui-Huu <fbuihuu@gmail.com>

We do not rely on user anymore to setup this config correctly.
Instead we make our choice depending on the load address.

If we want to force Kbuild to use ELF64 format whatever
the load address we can still do:

        $ make BUILD_ELF32=no

Signed-off-by: Franck Bui-Huu <fbuihuu@gmail.com>
---
 arch/mips/Kconfig  |   15 ---------------
 arch/mips/Makefile |   23 ++++++++++++++++++++---
 2 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 54acbf5..89020b6 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -2009,21 +2009,6 @@ source "fs/Kconfig.binfmt"
 config TRAD_SIGNALS
 	bool
 
-config BUILD_ELF64
-	bool "Use 64-bit ELF format for building"
-	depends on 64BIT
-	help
-	  A 64-bit kernel is usually built using the 64-bit ELF binary object
-	  format as it's one that allows arbitrary 64-bit constructs.  For
-	  kernels that are loaded within the KSEG compatibility segments the
-	  32-bit ELF format can optionally be used resulting in a somewhat
-	  smaller binary, but this option is not explicitly supported by the
-	  toolchain and since binutils 2.14 it does not even work at all.
-
-	  Say Y to use the 64-bit format or N to use the 32-bit one.
-
-	  If unsure say Y.
-
 config BINFMT_IRIX
 	bool "Include IRIX binary compatibility"
 	depends on CPU_BIG_ENDIAN && 32BIT && BROKEN
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 4240ca1..626771c 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -60,9 +60,6 @@ vmlinux-32		= vmlinux.32
 vmlinux-64		= vmlinux
 
 cflags-y		+= -mabi=64
-ifndef CONFIG_BUILD_ELF64
-cflags-y		+= $(call cc-option,-msym32)
-endif
 endif
 
 
@@ -614,6 +611,26 @@ else
 JIFFIES			= jiffies_64
 endif
 
+#
+# Automatically detect the build format. By default we choose
+# the elf format according to the load address.
+# We can always force a build with a 64-bits symbol format by
+# passing 'BUILD_ELF32=no' option to the make's command line.
+#
+ifdef CONFIG_64BIT
+  ifndef BUILD_ELF32
+    ifeq ($(shell expr $(load-y) \< 0xffffffff80000000), 0)
+      BUILD_ELF32 = y
+    endif
+  endif
+
+  ifeq ("$(BUILD_ELF32)", "y")
+    cflags-y += -msym32
+  else
+    cflags-y += -DCONFIG_BUILD_ELF64
+  endif
+endif # CONFIG_64BIT
+
 AFLAGS		+= $(cflags-y)
 CFLAGS		+= $(cflags-y)
 
-- 
1.4.4.3.ge6d4

  parent reply	other threads:[~2007-02-13  9:21 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-13  9:18 [RFC] Kill CONFIG_BUILD_ELF64 from Kconfig Franck Bui-Huu
2007-02-13  9:18 ` [PATCH 1/3] Remove '-mno-explicit-relocs' option when CONFIG_BUILD_ELF64 Franck Bui-Huu
2007-02-13  9:18 ` Franck Bui-Huu [this message]
2007-02-13 16:12   ` [PATCH 2/3] Automatically set CONFIG_BUILD_ELF64 Atsushi Nemoto
2007-02-13 17:02     ` Franck Bui-Huu
2007-02-13 16:18   ` Ralf Baechle
2007-02-13 17:09     ` Franck Bui-Huu
2007-02-13 20:05       ` Franck Bui-Huu
2007-02-14  1:28       ` Atsushi Nemoto
2007-02-14  8:20         ` Franck Bui-Huu
2007-02-14 16:14           ` Atsushi Nemoto
2007-02-15  8:36             ` Franck Bui-Huu
2007-02-14 11:42         ` Maciej W. Rozycki
2007-02-13  9:18 ` [PATCH 3/3] Rename CONFIG_BUILD_ELF64 into CONFIG_64BIT_BUILD_ELF32 Franck Bui-Huu
  -- strict thread matches above, loose matches on Subject: below --
2007-02-15 13:04 [PATCH 1/3] Remove '-mno-explicit-relocs' option when CONFIG_BUILD_ELF64 Franck Bui-Huu
2007-02-15 13:04 ` [PATCH 2/3] Automatically set CONFIG_BUILD_ELF64 Franck Bui-Huu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11713582901742-git-send-email-fbuihuu@gmail.com \
    --to=vagabon.xyz@gmail.com \
    --cc=anemo@mba.ocn.ne.jp \
    --cc=linux-mips@linux-mips.org \
    --cc=macro@linux-mips.org \
    --cc=ralf@linux-mips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox