Patchwork [v6,4/7] arch: toolchain: Introduce binary format FLAT types.

login
register
mail settings
Submitter Sonic Zhang
Date April 18, 2013, 10:06 a.m.
Message ID <1366279592-9055-4-git-send-email-sonic.adi@gmail.com>
Download mbox | patch
Permalink /patch/237598/
State Superseded
Headers show

Comments

Sonic Zhang - April 18, 2013, 10:06 a.m.
From: Sonic Zhang <sonic.zhang@analog.com>

Just introduce the symbol and options in arch generic Config.in.
Add FLAT types specific compiling flags into package makefile.

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

---

v5-change:
- Move FLAT types specific compiling flags back to package makefile.
The flags can't be set to compile Linux kernel.

v3-changes:
- Add dependancy to bfin and m68k
- Add help text for FLAT binary types.
- Split shared flat flags.
---
 arch/Config.in      |   26 ++++++++++++++++++++++++++
 package/Makefile.in |   11 +++++++++++
 2 files changed, 37 insertions(+), 0 deletions(-)
Thomas Petazzoni - April 25, 2013, 2:27 p.m.
Dear Sonic Zhang,

On Thu, 18 Apr 2013 18:06:29 +0800, Sonic Zhang wrote:
> From: Sonic Zhang <sonic.zhang@analog.com>
> 
> Just introduce the symbol and options in arch generic Config.in.
> Add FLAT types specific compiling flags into package makefile.
> 
> Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

You can now add my:

Acked-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

on this one.

> diff --git a/package/Makefile.in b/package/Makefile.in
> index a8bf36b..dd3bc7d 100644
> --- a/package/Makefile.in
> +++ b/package/Makefile.in
> @@ -103,6 +103,17 @@ TARGET_CFLAGS = $(TARGET_CPPFLAGS) $(TARGET_ABI) $(TARGET_OPTIMIZATION) $(TARGET
>  TARGET_CXXFLAGS = $(TARGET_CFLAGS)
>  TARGET_LDFLAGS = $(call qstrip,$(BR2_TARGET_LDFLAGS))
>  
> +ifeq ($(BR2_BINFMT_FLAT_SHARED),y)
> +TARGET_LDFLAGS += -mid-shared-library -mshared-library-id=0
> +TARGET_CFLAGS += -mid-shared-library -mshared-library-id=0
> +TARGET_CXXFLAGS += -mid-shared-library -mshared-library-id=0
> +endif
> +ifeq ($(BR2_BINFMT_FLAT_SEP_DATA),y)
> +TARGET_LDFLAGS += -msep-data
> +TARGET_CFLAGS += -msep-data
> +TARGET_CXXFLAGS += -msep-data
> +endif
> +

I had a discussion with Peter Korsgaard about this, and we've decided
to accept it as is, even though it should normally be part of the
external toolchain wrapper. But we haven't gotten to a nice and simple
solution for it, so let's do what you're proposing here.

Best regards,

Thomas

Patch

diff --git a/arch/Config.in b/arch/Config.in
index 175add5..3ffe82e 100644
--- a/arch/Config.in
+++ b/arch/Config.in
@@ -211,6 +211,32 @@  config BR2_BINFMT_FLAT
 
 endchoice
 
+# Set up flat binary type
+choice
+	prompt "FLAT Binary type"
+	depends on BR2_BINFMT_FLAT
+	default BR2_BINFMT_FLAT_ONE
+
+config BR2_BINFMT_FLAT_ONE
+	bool "One memory region"
+	help
+	  All segments are linked into one memory region.
+
+config BR2_BINFMT_FLAT_SEP_DATA
+	bool "Separate data and code region"
+	depends on BR2_bfin || BR2_m68k
+	help
+	  Allow for the data and text segments to be separated and placed in
+	  different regions of memory.
+
+config BR2_BINFMT_FLAT_SHARED
+	bool "Shared binary"
+	depends on BR2_bfin || BR2_m68k
+	help
+	  Allow to load and link indiviual FLAT binaries at run time.
+
+endchoice
+
 if BR2_arm || BR2_armeb
 source "arch/Config.in.arm"
 endif
diff --git a/package/Makefile.in b/package/Makefile.in
index a8bf36b..dd3bc7d 100644
--- a/package/Makefile.in
+++ b/package/Makefile.in
@@ -103,6 +103,17 @@  TARGET_CFLAGS = $(TARGET_CPPFLAGS) $(TARGET_ABI) $(TARGET_OPTIMIZATION) $(TARGET
 TARGET_CXXFLAGS = $(TARGET_CFLAGS)
 TARGET_LDFLAGS = $(call qstrip,$(BR2_TARGET_LDFLAGS))
 
+ifeq ($(BR2_BINFMT_FLAT_SHARED),y)
+TARGET_LDFLAGS += -mid-shared-library -mshared-library-id=0
+TARGET_CFLAGS += -mid-shared-library -mshared-library-id=0
+TARGET_CXXFLAGS += -mid-shared-library -mshared-library-id=0
+endif
+ifeq ($(BR2_BINFMT_FLAT_SEP_DATA),y)
+TARGET_LDFLAGS += -msep-data
+TARGET_CFLAGS += -msep-data
+TARGET_CXXFLAGS += -msep-data
+endif
+
 ifeq ($(BR2_TOOLCHAIN_BUILDROOT)$(BR2_TOOLCHAIN_CTNG),y)
 TARGET_CROSS=$(HOST_DIR)/usr/bin/$(GNU_TARGET_NAME)-
 else