Skip to contentSkip to conversation

arch: Add blackfin CPU choice.

PATCH New Sonic Zhang 3 participants 30 messages Mar 29, 2013 – Apr 23, 2013 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/7 arch: Add blackfin CPU choice.

From: Sonic Zhang <[email protected]>

v2-changes:
none

v1-changes:
- is patch adds a Target CPU configuration option and uses it to select a -m option for gcc.

---
 arch/Config.in.bfin |   97 +++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 90 insertions(+), 7 deletions(-)
arch/Config.in.bfin +90 -7
index 0b137ae..ac96620 100644
@@ -1,12 +1,65 @@
 choice
-	prompt "Target ABI"
+	prompt "Target CPU"
 	depends on BR2_bfin
-	default BR2_BFIN_FDPIC
-config BR2_BFIN_FDPIC
-	bool "FDPIC"
-config BR2_BFIN_FLAT
-	bool "FLAT"
-	select BR2_PREFER_STATIC_LIB
+	default BR2_bf609
+	help
+	  Specify target CPU
+config BR2_bf606
+	bool "bf606"
+config BR2_bf607
+	bool "bf607"
+config BR2_bf608
+	bool "bf608"
+config BR2_bf609
+	bool "bf609"
+config BR2_bf512
+	bool "bf512"
+config BR2_bf514
+	bool "bf514"
+config BR2_bf516
+	bool "bf516"
+config BR2_bf518
+	bool "bf518"
+config BR2_bf522
+	bool "bf522"
+config BR2_bf523
+	bool "bf523"
+config BR2_bf524
+	bool "bf524"
+config BR2_bf525
+	bool "bf525"
+config BR2_bf526
+	bool "bf526"
+config BR2_bf527
+	bool "bf527"
+config BR2_bf531
+	bool "bf531"
+config BR2_bf532
+	bool "bf532"
+config BR2_bf533
+	bool "bf533"
+config BR2_bf534
+	bool "bf534"
+config BR2_bf536
+	bool "bf536"
+config BR2_bf537
+	bool "bf537"
+config BR2_bf538
+	bool "bf538"
+config BR2_bf539
+	bool "bf539"
+config BR2_bf542
+	bool "bf542"
+config BR2_bf544
+	bool "bf544"
+config BR2_bf547
+	bool "bf547"
+config BR2_bf548
+	bool "bf548"
+config BR2_bf549
+	bool "bf549"
+config BR2_bf561
+	bool "bf561"
 endchoice
 
 config BR2_ARCH
@@ -14,3 +67,33 @@ config BR2_ARCH
 
 config BR2_ENDIAN
         default "LITTLE"
+
+config BR2_GCC_TARGET_CPU
+	default bf606		if BR2_bf606
+	default bf607		if BR2_bf607
+	default bf608		if BR2_bf608
+	default bf609		if BR2_bf609
+	default bf512		if BR2_bf512
+	default bf514		if BR2_bf514
+	default bf516		if BR2_bf516
+	default bf518		if BR2_bf518
+	default bf522		if BR2_bf522
+	default bf523		if BR2_bf523
+	default bf524		if BR2_bf524
+	default bf525		if BR2_bf525
+	default bf526		if BR2_bf526
+	default bf527		if BR2_bf527
+	default bf531		if BR2_bf531
+	default bf532		if BR2_bf532
+	default bf533		if BR2_bf533
+	default bf534		if BR2_bf534
+	default bf536		if BR2_bf536
+	default bf537		if BR2_bf537
+	default bf538		if BR2_bf538
+	default bf539		if BR2_bf539
+	default bf542		if BR2_bf542
+	default bf544		if BR2_bf544
+	default bf547		if BR2_bf547
+	default bf548		if BR2_bf548
+	default bf549		if BR2_bf549
+	default bf561		if BR2_bf561
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH v2 2/7 arch: toolchain: Introduce target CPU revision.

From: Sonic Zhang <[email protected]>

v2-changes:
none

v1-changes:
- Adds the possibility to have a free-form CPU revision string and append it to the target CPU. Only Blackfin actually uses this option.

---
 arch/Config.in                           |    3 +++
 arch/Config.in.bfin                      |    5 +++++
 toolchain/toolchain-external/ext-tool.mk |    4 ++++
 3 files changed, 12 insertions(+), 0 deletions(-)
arch/Config.in +3 -0
index 472b10c..c341848 100644
@@ -174,6 +174,9 @@ config BR2_GCC_TARGET_ABI
 config BR2_GCC_TARGET_CPU
 	string
 
+config BR2_GCC_TARGET_CPU_REVISION
+	string
+
 if BR2_arm || BR2_armeb
 source "arch/Config.in.arm"
 endif
arch/Config.in.bfin +5 -0
index ac96620..021f5fe 100644
@@ -97,3 +97,8 @@ config BR2_GCC_TARGET_CPU
 	default bf548		if BR2_bf548
 	default bf549		if BR2_bf549
 	default bf561		if BR2_bf561
+
+config BR2_GCC_TARGET_CPU_REVISION
+	string "Target CPU revision"
+	help
+	  Specify target cpu revision which is passed to compiler as a parameter.
toolchain/toolchain-external/ext-tool.mk +4 -0
index b477bc0..407e1ad 100644
@@ -134,7 +134,11 @@ TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += \
 endif
 
 CC_TARGET_TUNE_:=$(call qstrip,$(BR2_GCC_TARGET_TUNE))
+ifeq ($(BR2_GCC_TARGET_CPU_REVISION),)
 CC_TARGET_CPU_:=$(call qstrip,$(BR2_GCC_TARGET_CPU))
+else
+CC_TARGET_CPU_:=$(call qstrip,$(BR2_GCC_TARGET_CPU)-$(BR2_GCC_TARGET_CPU_REVISION))
+endif
 CC_TARGET_ARCH_:=$(call qstrip,$(BR2_GCC_TARGET_ARCH))
 CC_TARGET_ABI_:=$(call qstrip,$(BR2_GCC_TARGET_ABI))
 
Signature · 1 line
1.7.0.4
#2 lore raw

PATCH v2 2/7 arch: toolchain: Introduce target CPU revision.

Dear Sonic Zhang,

arch/Config.in.bfin config BR2_GCC_TARGET_CPU · line 104

Quoted 4 lines · Sonic Zhang
arch/Config.in.bfin +4 -0
+config BR2_GCC_TARGET_CPU_REVISION
+	string "Target CPU revision"
+	help
+	  Specify target cpu revision which is passed to compiler as a parameter.

I think this line is slightly too long, it should be wrapped. And I would like more details here in the help text. Maybe something like:

Specify a target CPU revision, which will be appended to the value of the -mcpu option. For example, if the selected CPU is bf607, and then selected CPU revision is "r2", then gcc will receive the -mcpu=bf607-r2 option.

Other than this detail, looks good to me.

Thanks!

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#3 lore raw

PATCH v2 2/7 arch: toolchain: Introduce target CPU revision.

Hi Thomas,

Quoted 9 lines · Thomas Petazzoni

Dear Sonic Zhang,

arch/Config.in.bfin config BR2_GCC_TARGET_CPU · line 104

Quoted 4 lines · Sonic Zhang
arch/Config.in.bfin +4 -0
+config BR2_GCC_TARGET_CPU_REVISION
+     string "Target CPU revision"
+     help
+       Specify target cpu revision which is passed to compiler as a parameter.
Quoted 8 lines

I think this line is slightly too long, it should be wrapped. And I would like more details here in the help text. Maybe something like:

Specify a target CPU revision, which will be appended to the value of the -mcpu option. For example, if the selected CPU is bf607, and then selected CPU revision is "r2", then gcc will receive the -mcpu=bf607-r2 option.

OK.

Regards,

Sonic

#4 lore raw

PATCH v2 3/7 arch: toolchain: Introduce binary formats BINFMT_*.

In reply to Sonic Zhang

From: Sonic Zhang <[email protected]>

v2-changes:
none

v1-changes:
- Just introduce the symbol and options in arch generic Config.in. Append FLAT format link flags to external toolchain wrapper.

---
 arch/Config.in                                     |   13 +++++++++++++
 toolchain/toolchain-external/ext-tool.mk           |    4 ++++
 .../toolchain-external/ext-toolchain-wrapper.c     |    3 +++
 3 files changed, 20 insertions(+), 0 deletions(-)
arch/Config.in +13 -0
index c341848..be475c0 100644
@@ -177,6 +177,19 @@ config BR2_GCC_TARGET_CPU
 config BR2_GCC_TARGET_CPU_REVISION
 	string
 
+# Set up target binary format
+choice
+	prompt "Target Binary Format"
+	default BR2_BINFMT_ELF
+config BR2_BINFMT_ELF
+	bool "ELF"
+config BR2_BINFMT_FDPIC
+	bool "FDPIC"
+config BR2_BINFMT_FLAT
+	bool "FLAT"
+	select BR2_PREFER_STATIC_LIB
+endchoice
+
 if BR2_arm || BR2_armeb
 source "arch/Config.in.arm"
 endif
toolchain/toolchain-external/ext-tool.mk +4 -0
index 407e1ad..27fd296 100644
@@ -164,6 +164,10 @@ ifneq ($(CC_TARGET_ABI_),)
 TOOLCHAIN_EXTERNAL_CFLAGS += -mabi=$(CC_TARGET_ABI_)
 TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_ABI='"$(CC_TARGET_ABI_)"'
 endif
+ifeq ($(BR2_BINFMT_FLAT),y)
+TOOLCHAIN_EXTERNAL_CFLAGS += -Wl,-elf2flt
+TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_BINFMT_FLAT
+endif
 
 ifneq ($(BR2_TARGET_OPTIMIZATION),)
 TOOLCHAIN_EXTERNAL_CFLAGS += $(call qstrip,$(BR2_TARGET_OPTIMIZATION))
toolchain/toolchain-external/ext-toolchain-wrapper.c +3 -0
index a92bada..9a2fc70 100644
@@ -47,6 +47,9 @@ static char *predef_args[] = {
 #ifdef BR_64
 	"-m64",
 #endif
+#ifdef BR_BINFMT_FLAT
+	"-Wl,-elf2flt",
+#endif
 #ifdef BR_ADDITIONAL_CFLAGS
 	BR_ADDITIONAL_CFLAGS
 #endif
Signature · 1 line
1.7.0.4
#5 lore raw

PATCH v2 3/7 arch: toolchain: Introduce binary formats BINFMT_*.

Dear Sonic Zhang,

Quoted 10 lines · Sonic Zhang

From: Sonic Zhang <[email protected]>

v2-changes:
none

v1-changes:
- Just introduce the symbol and options in arch generic Config.in. Append FLAT format link flags to external toolchain wrapper.

As detailed in my comments to PATCH 1/7, this patch needs to be refactored with BR2_BFIN_FDPIC/BR2_BFIN_FLAT to avoid breaking existing code.

Also, I believe we want to add some architecture dependencies here. For the beginning, we at least want something like:

+# Set up target binary format
+choice
+ prompt "Target Binary Format"
+ default BR2_BINFMT_ELF
+config BR2_BINFMT_ELF
+ bool "ELF"
+ depends on !BR2_bfin
+config BR2_BINFMT_FDPIC
+ bool "FDPIC"
+ depends on BR2_bfin
+config BR2_BINFMT_FLAT
+ bool "FLAT"
+ select BR2_PREFER_STATIC_LIB
+ depends on BR2_bfin
+endchoice

Of course, this might be extended later on if we enable FLAT support on other architectures. But for now, it ensures that users can't make an invalid choice (like chose FDPIC on ARM).

Thanks!

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#6 lore raw

PATCH v2 3/7 arch: toolchain: Introduce binary formats BINFMT_*.

Hi Thomas,

Quoted 12 lines · Thomas Petazzoni

Dear Sonic Zhang,

Quoted 9 lines · Sonic Zhang

From: Sonic Zhang <[email protected]>

v2-changes:
none

v1-changes:
- Just introduce the symbol and options in arch generic Config.in. Append FLAT format link flags to external toolchain wrapper.

Quoted 5 lines
Quoted 1 line

As detailed in my comments to PATCH 1/7, this patch needs to be refactored with BR2_BFIN_FDPIC/BR2_BFIN_FLAT to avoid breaking existing code.

OK.

Quoted 10 lines

Also, I believe we want to add some architecture dependencies here. For the beginning, we at least want something like:

arch/Config.in +5 -0
+# Set up target binary format
+choice
+       prompt "Target Binary Format"
+       default BR2_BINFMT_ELF
+config BR2_BINFMT_ELF

arch/Config.in config BR2_GCC_TARGET_CPU · line 191

Quoted 10 lines
arch/Config.in +10 -0
+       bool "ELF"
+       depends on !BR2_bfin
+config BR2_BINFMT_FDPIC
+       bool "FDPIC"
+       depends on BR2_bfin
+config BR2_BINFMT_FLAT
+       bool "FLAT"
+       select BR2_PREFER_STATIC_LIB
+       depends on BR2_bfin
+endchoice

No problem.

Regards,

Sonic

#7 lore raw

PATCH v2 3/7 arch: toolchain: Introduce binary formats BINFMT_*.

In reply to Sonic Zhang

Dear Sonic Zhang,

arch/Config.in config BR2_GCC_TARGET_CPU · line 191

Quoted 11 lines · Sonic Zhang
arch/Config.in +11 -0
+choice
+	prompt "Target Binary Format"
+	default BR2_BINFMT_ELF
+config BR2_BINFMT_ELF
+	bool "ELF"
+config BR2_BINFMT_FDPIC
+	bool "FDPIC"
+config BR2_BINFMT_FLAT
+	bool "FLAT"
+	select BR2_PREFER_STATIC_LIB
+endchoice

Maybe some help text would also be nice for each choice.

Thanks,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#8 lore raw

PATCH v2 3/7 arch: toolchain: Introduce binary formats BINFMT_*.

Hi Thomas,

Quoted 4 lines · Thomas Petazzoni

Dear Sonic Zhang,

On Fri, 29 Mar 2013 17:50:39 +0800, Sonic Zhang wrote:

Quoted 14 lines

arch/Config.in config BR2_GCC_TARGET_CPU · line 191

Quoted 11 lines
arch/Config.in +11 -0
+choice
+     prompt "Target Binary Format"
+     default BR2_BINFMT_ELF
+config BR2_BINFMT_ELF
+     bool "ELF"
+config BR2_BINFMT_FDPIC
+     bool "FDPIC"
+config BR2_BINFMT_FLAT
+     bool "FLAT"
+     select BR2_PREFER_STATIC_LIB
+endchoice

Maybe some help text would also be nice for each choice.

OK

Regards,

Sonic

#9 lore raw

PATCH v2 4/7 arch: toolchain: Introduce binary format FLAT types.

In reply to Sonic Zhang

From: Sonic Zhang <[email protected]>

v2-changes:
none

v1-changes:
- Just introduce the symbol and options in arch generic Config.in. Append FLAT types specific link flags into external toolchain wrapper.

---
 arch/Config.in                                     |   13 +++++++++++++
 toolchain/toolchain-external/ext-tool.mk           |    8 ++++++++
 .../toolchain-external/ext-toolchain-wrapper.c     |    6 ++++++
 3 files changed, 27 insertions(+), 0 deletions(-)
arch/Config.in +13 -0
index be475c0..cf081a3 100644
@@ -190,6 +190,19 @@ config BR2_BINFMT_FLAT
 	select BR2_PREFER_STATIC_LIB
 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 binary"
+config BR2_BINFMT_FLAT_SEP_DATA
+	bool "Separate data and code"
+config BR2_BINFMT_FLAT_SHARED
+	bool "Shared binary"
+endchoice
+
 if BR2_arm || BR2_armeb
 source "arch/Config.in.arm"
 endif
toolchain/toolchain-external/ext-tool.mk +8 -0
index 27fd296..0ca1307 100644
@@ -168,6 +168,14 @@ ifeq ($(BR2_BINFMT_FLAT),y)
 TOOLCHAIN_EXTERNAL_CFLAGS += -Wl,-elf2flt
 TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_BINFMT_FLAT
 endif
+ifeq ($(BR2_BINFMT_FLAT_SEP_DATA),y)
+TOOLCHAIN_EXTERNAL_CFLAGS += -msep-data
+TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_BINFMT_FLAT_SEP_DATA
+endif
+ifeq ($(BR2_BINFMT_FLAT_SHARED),y)
+TOOLCHAIN_EXTERNAL_CFLAGS += -mid-shared-library -mshared-library-id=0
+TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_BINFMT_FLAT_SHARED
+endif
 
 ifneq ($(BR2_TARGET_OPTIMIZATION),)
 TOOLCHAIN_EXTERNAL_CFLAGS += $(call qstrip,$(BR2_TARGET_OPTIMIZATION))
toolchain/toolchain-external/ext-toolchain-wrapper.c +6 -0
index 9a2fc70..c0eb2db 100644
@@ -50,6 +50,12 @@ static char *predef_args[] = {
 #ifdef BR_BINFMT_FLAT
 	"-Wl,-elf2flt",
 #endif
+#ifdef BR_BINFMT_FLAT_SEP_DATA
+	"-msep-data",
+#endif
+#ifdef BR_BINFMT_FLAT_SHARED
+	"-mid-shared-library -mshared-library-id=0",
+#endif
 #ifdef BR_ADDITIONAL_CFLAGS
 	BR_ADDITIONAL_CFLAGS
 #endif
Signature · 1 line
1.7.0.4
#10 lore raw

PATCH v2 4/7 arch: toolchain: Introduce binary format FLAT types.

Dear Sonic Zhang,

arch/Config.in config BR2_BINFMT_FLAT · line 201

Quoted 9 lines · Sonic Zhang
arch/Config.in +9 -0
+# 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 binary"
+config BR2_BINFMT_FLAT_SEP_DATA
+	bool "Separate data and code"
	depends on BR2_bfin || BR2_m68k

I know I've suggested on PATCH 3/7 to make FLAT depend on bfin, so technically this isn't needed. But since -msep-data is really an option that is only available on bfin and m68k, while the flat format can be used potentially on other architectures, I'd prefer to make this architecture dependency explicit here as well.

arch/Config.in config BR2_BINFMT_FLAT · line 203

Quoted 2 lines
arch/Config.in +2 -0
+config BR2_BINFMT_FLAT_SHARED
+	bool "Shared binary"
	depends on BR2_bfin || BR2_m68k

Same reason: -mid-shared-library is only available for Blackfin and m68k.

Quoted 1 line

+endchoice

I would have originally thought of putting those choices directly within the list of BR2_BINFMT_* (i.e have a list containing elf, fdpic, flat-one, flat-sep-data, flat-shared). But maybe it makes more sense the way you did, some I'm fine with that.

Having some help text for each choice would be nice.

Thanks!

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#11 lore raw

PATCH v2 4/7 arch: toolchain: Introduce binary format FLAT types.

Hi Thomas,

Quoted 22 lines · Thomas Petazzoni

Dear Sonic Zhang,

arch/Config.in config BR2_BINFMT_FLAT · line 201

Quoted 9 lines · Sonic Zhang
arch/Config.in +9 -0
+# 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 binary"
+config BR2_BINFMT_FLAT_SEP_DATA
+     bool "Separate data and code"
        depends on BR2_bfin || BR2_m68k

I know I've suggested on PATCH 3/7 to make FLAT depend on bfin, so technically this isn't needed. But since -msep-data is really an option that is only available on bfin and m68k, while the flat format can be used potentially on other architectures, I'd prefer to make this architecture dependency explicit here as well.

Quoted 7 lines

arch/Config.in config BR2_BINFMT_FLAT · line 203

Quoted 2 lines
arch/Config.in +2 -0
+config BR2_BINFMT_FLAT_SHARED
+     bool "Shared binary"
        depends on BR2_bfin || BR2_m68k

Same reason: -mid-shared-library is only available for Blackfin and m68k.

OK.

Quoted 10 lines
Quoted 2 lines

+endchoice

I would have originally thought of putting those choices directly within the list of BR2_BINFMT_* (i.e have a list containing elf, fdpic, flat-one, flat-sep-data, flat-shared). But maybe it makes more sense the way you did, some I'm fine with that.

Having some help text for each choice would be nice.

OK.

Regards,

Sonic

#12 lore raw

PATCH v2 4/7 arch: toolchain: Introduce binary format FLAT types.

In reply to Thomas Petazzoni

Hi Thomas,

Just figure out the compiling flags for BINFMT_FLAT_SHARED and BINFMT_FLAT_SEP can't be put into the toolchain wrapper, because these flags are for application only, they can't be used to build Linux kernel.

-mid-shared-library -mshared-library-id=0
-msep-data

So, I have to move them back to file package/Makefile.in .

Regards,

Sonic

#13 lore raw

PATCH v2 4/7 arch: toolchain: Introduce binary format FLAT types.

Dear Sonic Zhang,

Quoted 9 lines · Sonic Zhang

Just figure out the compiling flags for BINFMT_FLAT_SHARED and BINFMT_FLAT_SEP can't be put into the toolchain wrapper, because these flags are for application only, they can't be used to build Linux kernel.

(quoted diff) +0 -2
-mid-shared-library -mshared-library-id=0
-msep-data

So, I have to move them back to file package/Makefile.in .

Hum, that is not really nice, because the idea of the external toolchain wrapper is to ensure that when the user will use output/host/usr/bin/<arch>-gcc, he will get binaries that are built for the same architecture/flags than the binaries built by Buildroot. That's more or less the whole idea of the external toolchain wrapper thing.

One option is to have something like:

ifeq ($(BR2_bfin),y)
LINUX_MAKE_FLAGS =

	KBUILD_CFLAGS = "$(TARGET_CFLAGS) -mno-id-shared-library ..."

endif

Not sure exactly if that's the right solution or not. Peter, you're the one who did the external toolchain wrapper originally. Could you comment on this specific issue?

Thanks!

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#14 lore raw

PATCH v2 4/7 arch: toolchain: Introduce binary format FLAT types.

Hi Thomas,

Quoted 23 lines · Thomas Petazzoni

Dear Sonic Zhang,

Quoted 9 lines · Sonic Zhang

Just figure out the compiling flags for BINFMT_FLAT_SHARED and BINFMT_FLAT_SEP can't be put into the toolchain wrapper, because these flags are for application only, they can't be used to build Linux kernel.

(quoted diff) +0 -2
-mid-shared-library -mshared-library-id=0
-msep-data

So, I have to move them back to file package/Makefile.in .

Hum, that is not really nice, because the idea of the external toolchain wrapper is to ensure that when the user will use output/host/usr/bin/<arch>-gcc, he will get binaries that are built for the same architecture/flags than the binaries built by Buildroot. That's more or less the whole idea of the external toolchain wrapper thing.

One option is to have something like:

Quoted 9 lines

ifeq ($(BR2_bfin),y)
LINUX_MAKE_FLAGS =

        KBUILD_CFLAGS = "$(TARGET_CFLAGS) -mno-id-shared-library ..."

endif

Not sure exactly if that's the right solution or not. Peter, you're the one who did the external toolchain wrapper originally. Could you comment on this specific issue?

The LINUX_MAKE_FLAGS should not include the shared flat specific flags "-mno-id-shared-library ...". Your suggestion doesn't work when building Linux kernel. We need some ways to remove flags "-mno-id-shared-library ..." from the gcc wrapper for the shared flat binary format when building Linux kernel.

My new patch is to append the shared flat flags only when building applications.

Any better solution?

Regards,

Sonic

#15 lore raw

PATCH v2 4/7 arch: toolchain: Introduce binary format FLAT types.

Dear Sonic Zhang,

Quoted 9 lines · Sonic Zhang
Quoted 4 lines

Not sure exactly if that's the right solution or not. Peter, you're the one who did the external toolchain wrapper originally. Could you comment on this specific issue?

The LINUX_MAKE_FLAGS should not include the shared flat specific flags "-mno-id-shared-library ...". Your suggestion doesn't work when building Linux kernel. We need some ways to remove flags "-mno-id-shared-library ..." from the gcc wrapper for the shared flat binary format when building Linux kernel.

Hm? If you pass -mno-id-shared-library after -mid-shared-library, it will be just as if you hadn't passed the option at all. So if the external toolchain wrapper passes -mid-shared-library, but then the CFLAGS passed to the kernel override that by passing -mno-id-shared-library, it will be just as if the external wrapper hadn't passed -mid-shared-library.

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#16 lore raw

PATCH v2 4/7 arch: toolchain: Introduce binary format FLAT types.

Hi Thomas,

Quoted 14 lines · Thomas Petazzoni

Dear Sonic Zhang,

Quoted 9 lines · Sonic Zhang
Quoted 4 lines

Not sure exactly if that's the right solution or not. Peter, you're the one who did the external toolchain wrapper originally. Could you comment on this specific issue?

The LINUX_MAKE_FLAGS should not include the shared flat specific flags "-mno-id-shared-library ...". Your suggestion doesn't work when building Linux kernel. We need some ways to remove flags "-mno-id-shared-library ..." from the gcc wrapper for the shared flat binary format when building Linux kernel.

Quoted 8 lines

Hm? If you pass -mno-id-shared-library after -mid-shared-library, it will be just as if you hadn't passed the option at all. So if the external toolchain wrapper passes -mid-shared-library, but then the CFLAGS passed to the kernel override that by passing -mno-id-shared-library, it will be just as if the external wrapper hadn't passed -mid-shared-library.

The blackfin GNU toolchain doesn't understand flag "-mno-shared-library-id", "-mno-shared-library-id=" and "-mno-shared-library-id=0". Flag "-mshared-library-id=0" set in wrapper can't be canceled by passing "-mno-shared-library-id" later in linux.mk.

ifeq ($(BR2_bfin),y)
LINUX_MAKE_FLAGS += KBUILD_CFLAGS="$(TARGET_CFLAGS) -mno-id-shared-library -mno-shared-library-id -mno-sep-data"
endif

PATH="/home/sonic/projects/buildroot/output/host/bin:/home/sonic/projects/buildroot/output/host/usr/bin:/home/sonic/projects/buildroot/output/host/usr/sbin/:/opt/arm/bin:/opt/uclinux/bfin-elf/bin/:/opt/uclinux/bfin-uclinux/bin/:/opt/uclinux/bfin-linux-uclibc/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games" PERLLIB="/home/sonic/projects/buildroot/output/host/usr/lib/perl"
/usr/bin/make -j4
O="/home/sonic/projects/buildroot/output/build/linux-custom"
HOSTCC="/usr/bin/gcc" HOSTCFLAGS="" ARCH=blackfin
INSTALL_MOD_PATH=/home/sonic/projects/buildroot/output/target
CROSS_COMPILE="
/home/sonic/projects/buildroot/output/host/usr/bin/bfin-uclinux-"
DEPMOD=/home/sonic/projects/buildroot/output/host/usr/sbin/depmod
KBUILD_CFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
-D_FILE_OFFSET_BITS=64 -pipe -Os -D__NOMMU__ -D__uClinux__
-mno-id-shared-library -mno-shared-library-id -mno-sep-data" -C
"linux/linux-kernel"/ uImage
make[1]: Entering directory
`/home/sonic/projects/buildroot/linux/linux-kernel'

  GEN     /home/sonic/projects/buildroot/output/build/linux-custom/Makefile
  CHK     include/generated/uapi/linux/version.h
  CC      scripts/mod/empty.o

cc1: error: unrecognized command line option "-mno-shared-library-id" /home/sonic/projects/buildroot/linux/linux-kernel/scripts/mod/empty.c:1:
error: -mshared-library-id= specified without -mid-shared-library make[4]: *** [scripts/mod/empty.o] Error 1
make[3]: *** [scripts/mod] Error 2
make[2]: *** [scripts] Error 2

Regards,

Sonic
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20130417/2e8a91f1/attachment.html>

#17 lore raw

PATCH v2 4/7 arch: toolchain: Introduce binary format FLAT types.

Hi Peter and Thomas,

Any further suggestion on how can I push forward this patch?

Compiler parameter -mno-xxx is not an option for blackfin specific flag id-shared-library=0.

Regards,

Sonic

Quoted 67 lines · Sonic Zhang

Hi Thomas,

Quoted 15 lines · Thomas Petazzoni

Dear Sonic Zhang,

Quoted 1 line · Sonic Zhang
Quoted 1 line

Not sure exactly if that's the right solution or not. Peter, you're

the

Quoted 8 lines
Quoted 3 lines

one who did the external toolchain wrapper originally. Could you comment on this specific issue?

The LINUX_MAKE_FLAGS should not include the shared flat specific flags "-mno-id-shared-library ...". Your suggestion doesn't work when building Linux kernel. We need some ways to remove flags "-mno-id-shared-library ..." from the gcc wrapper for the shared flat binary format when building Linux kernel.

Quoted 8 lines

Hm? If you pass -mno-id-shared-library after -mid-shared-library, it will be just as if you hadn't passed the option at all. So if the external toolchain wrapper passes -mid-shared-library, but then the CFLAGS passed to the kernel override that by passing -mno-id-shared-library, it will be just as if the external wrapper hadn't passed -mid-shared-library.

The blackfin GNU toolchain doesn't understand flag "-mno-shared-library-id", "-mno-shared-library-id=" and "-mno-shared-library-id=0". Flag "-mshared-library-id=0" set in wrapper can't be canceled by passing "-mno-shared-library-id" later in linux.mk.

ifeq ($(BR2_bfin),y)
LINUX_MAKE_FLAGS += KBUILD_CFLAGS="$(TARGET_CFLAGS) -mno-id-shared-library -mno-shared-library-id -mno-sep-data"
endif

PATH="/home/sonic/projects/buildroot/output/host/bin:/home/sonic/projects/buildroot/output/host/usr/bin:/home/sonic/projects/buildroot/output/host/usr/sbin/:/opt/arm/bin:/opt/uclinux/bfin-elf/bin/:/opt/uclinux/bfin-uclinux/bin/:/opt/uclinux/bfin-linux-uclibc/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games" PERLLIB="/home/sonic/projects/buildroot/output/host/usr/lib/perl"
/usr/bin/make -j4
O="/home/sonic/projects/buildroot/output/build/linux-custom"
HOSTCC="/usr/bin/gcc" HOSTCFLAGS="" ARCH=blackfin
INSTALL_MOD_PATH=/home/sonic/projects/buildroot/output/target
CROSS_COMPILE="
/home/sonic/projects/buildroot/output/host/usr/bin/bfin-uclinux-"
DEPMOD=/home/sonic/projects/buildroot/output/host/usr/sbin/depmod
KBUILD_CFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE

(quoted diff) +0 -2
-D_FILE_OFFSET_BITS=64  -pipe -Os  -D__NOMMU__ -D__uClinux__
-mno-id-shared-library -mno-shared-library-id -mno-sep-data" -C

"linux/linux-kernel"/ uImage
make[1]: Entering directory `/home/sonic/projects/buildroot/linux/linux-kernel'

  GEN     /home/sonic/projects/buildroot/output/build/linux-custom/Makefile
  CHK     include/generated/uapi/linux/version.h
  CC      scripts/mod/empty.o

cc1: error: unrecognized command line option "-mno-shared-library-id" /home/sonic/projects/buildroot/linux/linux-kernel/scripts/mod/empty.c:1:
error: -mshared-library-id= specified without -mid-shared-library make[4]: *** [scripts/mod/empty.o] Error 1
make[3]: *** [scripts/mod] Error 2
make[2]: *** [scripts] Error 2

Quoted 4 lines

Regards,

Sonic

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20130423/d5499318/attachment-0001.html>

#18 lore raw

PATCH v2 5/7 package: Introduce package-specific BINFMT_FLAT options.

In reply to Sonic Zhang

From: Sonic Zhang <[email protected]>

v2-changes:
- Fix typo error in macro BINFMT_FLAT

v1-changes:
- Add new option <PKG>_FLAT_STACKSIZE. The document needs to be updated.

---
 package/pkg-autotools.mk |    5 +++++
 package/pkg-generic.mk   |    5 +++++
 2 files changed, 10 insertions(+), 0 deletions(-)
package/pkg-autotools.mk +5 -0
index 890506b..bdfea20 100644
@@ -82,6 +82,11 @@ $(2)_CLEAN_OPT			?= clean
 $(2)_UNINSTALL_STAGING_OPT	?= DESTDIR=$$(STAGING_DIR) uninstall
 $(2)_UNINSTALL_TARGET_OPT	?= DESTDIR=$$(TARGET_DIR)  uninstall
 
+ifeq ($(BR2_BINFMT_FLAT),y)
+ ifneq ($$($(2)_FLAT_STACKSIZE),)
+  $(2)_CONF_ENV			+= LDFLAGS="$(TARGET_LDFLAGS) -Wl,-elf2flt=-s$$($(2)_FLAT_STACKSIZE)"
+ endif
+endif
 
 #
 # Configure step. Only define it if not already defined by the package
package/pkg-generic.mk +5 -0
index 57b0fd0..8ee2b20 100644
@@ -303,6 +303,11 @@ endif
 
 $(2)_REDISTRIBUTE		?= YES
 
+ifeq ($(BR2_BINFMT_FLAT),y)
+ ifneq ($$($(2)_FLAT_STACKSIZE),)
+  $(2)_FLAT_LDFLAGS = -Wl,-elf2flt=-s$$($(2)_FLAT_STACKSIZE)
+ endif
+endif
 
 $(2)_DEPENDENCIES ?= $(filter-out $(1),$(patsubst host-host-%,host-%,$(addprefix host-,$($(3)_DEPENDENCIES))))
 
Signature · 1 line
1.7.0.4
#19 lore raw

PATCH v2 5/7 package: Introduce package-specific BINFMT_FLAT options.

Dear Sonic Zhang,

Quoted 21 lines · Sonic Zhang
package/pkg-autotools.mk +5 -0
index 890506b..bdfea20 100644
@@ -82,6 +82,11 @@ $(2)_CLEAN_OPT			?= clean
 $(2)_UNINSTALL_STAGING_OPT	?= DESTDIR=$$(STAGING_DIR) uninstall
 $(2)_UNINSTALL_TARGET_OPT	?= DESTDIR=$$(TARGET_DIR)  uninstall
 
+ifeq ($(BR2_BINFMT_FLAT),y)
+ ifneq ($$($(2)_FLAT_STACKSIZE),)
+  $(2)_CONF_ENV			+= LDFLAGS="$(TARGET_LDFLAGS) -Wl,-elf2flt=-s$$($(2)_FLAT_STACKSIZE)"
+ endif
+endif
 
 #
 # Configure step. Only define it if not already defined by the package
package/pkg-generic.mk +0 -0
index 57b0fd0..8ee2b20 100644

package/pkg-generic.mk endif · line 312

Quoted 10 lines
package/pkg-generic.mk +5 -0
@@ -303,6 +303,11 @@ endif
 
 $(2)_REDISTRIBUTE		?= YES
 
+ifeq ($(BR2_BINFMT_FLAT),y)
+ ifneq ($$($(2)_FLAT_STACKSIZE),)
+  $(2)_FLAT_LDFLAGS = -Wl,-elf2flt=-s$$($(2)_FLAT_STACKSIZE)
+ endif
+endif
 
 $(2)_DEPENDENCIES ?= $(filter-out $(1),$(patsubst host-host-%,host-%,$(addprefix host-,$($(3)_DEPENDENCIES))))

I understand the problem but I'm still not really happy with the solution here. Maybe Arnout will have some suggestions.

The problem I see with the pkg-autotools change is that some packages already override LDFLAGS in their <pkg>_CONF_ENV. For example:

NDISC6_CONF_ENV += LDFLAGS="$(TARGET_LDFLAGS) -lintl"

Since your <pkg>_CONF_ENV += assignment will be done after the ones coming from the package .mk file, you're going to remove the -lintl that had been added by the package.

For the pkg-generic change, I'm not entirely happy because it means each and every package should use <pkg>_FLAT_LDFLAGS, while we have told for a long time our packagers to just use $(TARGET_CONFIGURE_OPTS) to get all the right compiler/linker flags.

So I think it seems we somehow need to make $(TARGET_LDFLAGS) a per-package variable? Arnout what do you think about this? Do you have ideas?

Thanks!

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#20 lore raw

PATCH v2 5/7 package: Introduce package-specific BINFMT_FLAT options.

Quoted 34 lines · Thomas Petazzoni

Dear Sonic Zhang,

Quoted 30 lines · Sonic Zhang
package/pkg-autotools.mk +5 -0
index 890506b..bdfea20 100644
@@ -82,6 +82,11 @@ $(2)_CLEAN_OPT			?= clean
  $(2)_UNINSTALL_STAGING_OPT	?= DESTDIR=$$(STAGING_DIR) uninstall
  $(2)_UNINSTALL_TARGET_OPT	?= DESTDIR=$$(TARGET_DIR)  uninstall
 
+ifeq ($(BR2_BINFMT_FLAT),y)
+ ifneq ($$($(2)_FLAT_STACKSIZE),)
+  $(2)_CONF_ENV			+= LDFLAGS="$(TARGET_LDFLAGS) -Wl,-elf2flt=-s$$($(2)_FLAT_STACKSIZE)"
+ endif
+endif
 
  #
  # Configure step. Only define it if not already defined by the package
package/pkg-generic.mk +5 -0
index 57b0fd0..8ee2b20 100644
@@ -303,6 +303,11 @@ endif
 
  $(2)_REDISTRIBUTE		?= YES
 
+ifeq ($(BR2_BINFMT_FLAT),y)
+ ifneq ($$($(2)_FLAT_STACKSIZE),)
+  $(2)_FLAT_LDFLAGS = -Wl,-elf2flt=-s$$($(2)_FLAT_STACKSIZE)
+ endif
+endif
 
Quoted 4 lines

package/pkg-generic.mk endif · line 312

Quoted 1 line
package/pkg-generic.mk +0 -0
  $(2)_DEPENDENCIES ?= $(filter-out $(1),$(patsubst host-host-%,host-%,$(addprefix host-,$($(3)_DEPENDENCIES))))

I understand the problem but I'm still not really happy with the solution here. Maybe Arnout will have some suggestions.

I had exactly the same thoughts while reading the patch...

Quoted 9 lines

The problem I see with the pkg-autotools change is that some packages already override LDFLAGS in their <pkg>_CONF_ENV. For example:

NDISC6_CONF_ENV += LDFLAGS="$(TARGET_LDFLAGS) -lintl"

Since your <pkg>_CONF_ENV += assignment will be done after the ones coming from the package .mk file, you're going to remove the -lintl that had been added by the package.

Quoted 8 lines

For the pkg-generic change, I'm not entirely happy because it means each and every package should use <pkg>_FLAT_LDFLAGS, while we have told for a long time our packagers to just use $(TARGET_CONFIGURE_OPTS) to get all the right compiler/linker flags.

So I think it seems we somehow need to make $(TARGET_LDFLAGS) a per-package variable? Arnout what do you think about this? Do you have ideas?

In fact, it can easily be made a per-package variable. In the
definition of TARGET_LDFLAGS, we can add:

TARGET_LDFLAGS = ... \
	$($(PKG)_LDFLAGS)
  The $(PKG) is only evaluated when the TARGET_LDFLAGS variable is used.

Outside the scope of the generic rules, $(PKG) evaluates to nothing,
and _LDFLAGS is not defined, so the $($(PKG)_LDFLAGS) has no effect.

Inside the scope of the generic rules, $(PKG) is always defined. So we
just have to add the following to the pkg-generic macro:

ifeq ($(BR2_BINFMT_FLAT),y)
$(2)_LDFLAGS += -Wl,-elf2flt=-s$$($(2)_FLAT_STACKSIZE)
endif

As far as I can see, that should work nicely. No need to change
anything in autotools. Unfortunately, it does require changing the packages that have something like:

DOSFSTOOLS_LDFLAGS = $(TARGET_LDFLAGS)

Also, it is not very intuitive, because in a non-autotools package
where you can't use the LDFLAGS environment variable, you'll have something like:

AXEL_LDFLAGS = -lpthread
define AXEL_BUILD_CMDS

         $(TARGET_CONFIGURE_OPTS) $(MAKE) \
         LFLAGS="$(TARGET_LDFLAGS)" -C $(@D)

endef

i.e. you're defining AXEL_LDFLAGS but using TARGET_LDFLAGS. Not a really big issue, I think, but not very nice either.

For this patch list, however, I think changing the 15 uses of
FOO_LDFLAGS is going a bit too far. So I propose to make the following change instead in package/Makefile.in:

ifeq ($(BR2_BINFMT_FLAT),y)

TARGET_LDFLAGS += $(if $($(PKG)_FLAT_STACKSIZE),\
	-Wl,-elf2flt=-s$($(PKG)_FLAT_STACKSIZE))

endif

AFAICS, that should work for any package without any further change.
But needs to be tested, of course...

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#21 lore raw

PATCH v2 5/7 package: Introduce package-specific BINFMT_FLAT options.

Hi Arnout,

Quoted 105 lines · Arnout Vandecappelle
Quoted 36 lines · Thomas Petazzoni

Dear Sonic Zhang,

Quoted 31 lines · Sonic Zhang
package/pkg-autotools.mk +5 -1
index 890506b..bdfea20 100644
@@ -82,6 +82,11 @@ $(2)_CLEAN_OPT                       ?= clean
  $(2)_UNINSTALL_STAGING_OPT    ?= DESTDIR=$$(STAGING_DIR) uninstall
  $(2)_UNINSTALL_TARGET_OPT     ?= DESTDIR=$$(TARGET_DIR)  uninstall
 
+ifeq ($(BR2_BINFMT_FLAT),y)
+ ifneq ($$($(2)_FLAT_STACKSIZE),)
+  $(2)_CONF_ENV                        += LDFLAGS="$(TARGET_LDFLAGS)
-Wl,-elf2flt=-s$$($(2)_FLAT_STACKSIZE)"
+ endif
+endif
 
  #
  # Configure step. Only define it if not already defined by the package
package/pkg-generic.mk +5 -0
index 57b0fd0..8ee2b20 100644
@@ -303,6 +303,11 @@ endif
 
  $(2)_REDISTRIBUTE             ?= YES
 
+ifeq ($(BR2_BINFMT_FLAT),y)
+ ifneq ($$($(2)_FLAT_STACKSIZE),)
+  $(2)_FLAT_LDFLAGS = -Wl,-elf2flt=-s$$($(2)_FLAT_STACKSIZE)
+ endif
+endif
 
Quoted 6 lines

package/pkg-generic.mk endif · line 313

Quoted 2 lines
package/pkg-generic.mk +0 -0
  $(2)_DEPENDENCIES ?= $(filter-out $(1),$(patsubst
 host-host-%,host-%,$(addprefix host-,$($(3)_DEPENDENCIES))))

I understand the problem but I'm still not really happy with the solution here. Maybe Arnout will have some suggestions.

I had exactly the same thoughts while reading the patch...

Quoted 9 lines

The problem I see with the pkg-autotools change is that some packages already override LDFLAGS in their <pkg>_CONF_ENV. For example:

NDISC6_CONF_ENV += LDFLAGS="$(TARGET_LDFLAGS) -lintl"

Since your <pkg>_CONF_ENV += assignment will be done after the ones coming from the package .mk file, you're going to remove the -lintl that had been added by the package.

Quoted 8 lines

For the pkg-generic change, I'm not entirely happy because it means each and every package should use <pkg>_FLAT_LDFLAGS, while we have told for a long time our packagers to just use $(TARGET_CONFIGURE_OPTS) to get all the right compiler/linker flags.

So I think it seems we somehow need to make $(TARGET_LDFLAGS) a per-package variable? Arnout what do you think about this? Do you have ideas?

In fact, it can easily be made a per-package variable. In the definition of
TARGET_LDFLAGS, we can add:

TARGET_LDFLAGS = ... \
        $($(PKG)_LDFLAGS)

The $(PKG) is only evaluated when the TARGET_LDFLAGS variable is used.

Outside the scope of the generic rules, $(PKG) evaluates to nothing, and
_LDFLAGS is not defined, so the $($(PKG)_LDFLAGS) has no effect.

Inside the scope of the generic rules, $(PKG) is always defined. So we just
have to add the following to the pkg-generic macro:

ifeq ($(BR2_BINFMT_FLAT),y)
$(2)_LDFLAGS += -Wl,-elf2flt=-s$$($(2)_FLAT_STACKSIZE)
endif

As far as I can see, that should work nicely. No need to change anything in
autotools. Unfortunately, it does require changing the packages that have something like:

DOSFSTOOLS_LDFLAGS = $(TARGET_LDFLAGS)

Also, it is not very intuitive, because in a non-autotools package where
you can't use the LDFLAGS environment variable, you'll have something like:

AXEL_LDFLAGS = -lpthread
define AXEL_BUILD_CMDS

        $(TARGET_CONFIGURE_OPTS) $(MAKE) \
        LFLAGS="$(TARGET_LDFLAGS)" -C $(@D)

endef

i.e. you're defining AXEL_LDFLAGS but using TARGET_LDFLAGS. Not a really big issue, I think, but not very nice either.

Quoted 9 lines

For this patch list, however, I think changing the 15 uses of FOO_LDFLAGS
is going a bit too far. So I propose to make the following change instead in package/Makefile.in:

ifeq ($(BR2_BINFMT_FLAT),y)

TARGET_LDFLAGS += $(if $($(PKG)_FLAT_STACKSIZE),\
        -Wl,-elf2flt=-s$($(PKG)_FLAT_STACKSIZE))

endif

This doesn't work.

/home/sonic/projects/buildroot/output/host/usr/bin/bfin-uclinux-gcc -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -pipe -Os -D__NOMMU__ -D__uClinux__ -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Wl --static bfin-dma.c
-o bfin-dma
cc1: error: unrecognized command line option "-Wl" make[1]: *** [bfin-dma] Error 1

In addition, if 2 generic makefile packages set different flat stack sizes, are both of these stack size flags added to the same TARGE_LDFLAGS macro with your change?

Regards,

Sonic

#22 lore raw

PATCH v2 5/7 package: Introduce package-specific BINFMT_FLAT options.

Quoted 3 lines · Sonic Zhang

Hi Arnout,

On Wed, Apr 10, 2013 at 1:47 PM, Arnout Vandecappelle <[email protected]> wrote:

[snip]

Quoted 13 lines
Quoted 5 lines

ifeq ($(BR2_BINFMT_FLAT),y)

TARGET_LDFLAGS += $(if $($(PKG)_FLAT_STACKSIZE),\
         -Wl,-elf2flt=-s$($(PKG)_FLAT_STACKSIZE))

endif

This doesn't work.

/home/sonic/projects/buildroot/output/host/usr/bin/bfin-uclinux-gcc

(quoted diff) +0 -3
-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
-pipe -Os  -D__NOMMU__ -D__uClinux__ -D_LARGEFILE_SOURCE
-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Wl --static  bfin-dma.c
  -o bfin-dma
Quoted 2 lines

cc1: error: unrecognized command line option "-Wl" make[1]: *** [bfin-dma] Error 1

Ah yes, of course, the comma. If should be:

ifeq ($(BR2_BINFMT_FLAT),y)

TARGET_LDFLAGS += $(if $($(PKG)_FLAT_STACKSIZE),\
         -Wl$(comma)-elf2flt=-s$($(PKG)_FLAT_STACKSIZE))

endif

Quoted 3 lines

In addition, if 2 generic makefile packages set different flat stack sizes, are both of these stack size flags added to the same TARGE_LDFLAGS macro with your change?

That is the magic of late binding in make. The value of TARGET_LDFLAGS
is only evaluated at the time when it is used, and it is only at that time that the $(PKG) is expanded. And if it is used in the body of a pattern rule, then the expansion only takes place when the rule is instantiated.

For example, there are two packages, FOO and BAR, that set
FOO_FLAT_STACKSIZE and BAR_FLAT_STACKSIZE. They both use TARGET_LDFLAGS in their BUILD_CMDS. The BUILD_CMDS are used in the following pattern rule from pkg-generic.mk:

# Build
$(BUILD_DIR)/%/.stamp_built::

         @$(call MESSAGE,"Building")
         $($(PKG)_BUILD_CMDS)
         $(foreach hook,$($(PKG)_POST_BUILD_HOOKS),$(call $(hook))$(sep))
         $(Q)touch $@

When this rule is instantiated for package foo, then the PKG variable
is set to FOO. So $($(PKG)_BUILD_CMDS) expands to $(FOO_BUILD_CMDS), which expands to something like

$(MAKE) LDFLAGS="$(TARGET_LDFLAGS)"

which expands to

make -j8 LDFLAGS="$(call qstrip,$(BR2_TARGET_LDFLAGS))\
	--static\
	$(if $($(PKG)_FLAT_STACKSIZE),\
         	-Wl$(comma)-elf2flt=-s$($(PKG)_FLAT_STACKSIZE))"

which expands to

make -j8 LDFLAGS="$(call qstrip,"")\
	--static\
	$(if $(FOO_FLAT_STACKSIZE),\
         	-Wl$(comma)-elf2flt=-s$($(PKG)_FLAT_STACKSIZE))"

which expands to

make -j8 LDFLAGS="\
	--static\
	$(if 2048,\
         	-Wl$(comma)-elf2flt=-s$($(PKG)_FLAT_STACKSIZE))"

which expands to

make -j8 LDFLAGS="\
	--static\
	-Wl$(comma)-elf2flt=-s$($(PKG)_FLAT_STACKSIZE)"

which expands to

make -j8 LDFLAGS="\
	--static\
	-W,-elf2flt=-s$(FOO_FLAT_STACKSIZE)"

which expands to

make -j8 LDFLAGS=" --static -W,-elf2flt=-s2048"

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#23 lore raw

PATCH v2 6/7 arch: Introduce blackfin-specific Makefile

In reply to Sonic Zhang

From: Sonic Zhang <[email protected]>

v2-changes:
- Remove useless Macro __uClinux__

v1-changes:
- Create arch makefile.
- Create blackfin makefile.
- Add FDPIC and FLAT library options and makefile targets to install libraries for different binary formats into the same rootfs image.
- update the TARGET_EXCEPTIONS variable in support/scripts/graph-depends for new custom targets

---
 Makefile                      |    2 ++
 arch/Config.in.bfin           |   21 +++++++++++++++++++++
 arch/Makefile.in              |    5 +++++
 arch/Makefile.in.bfin         |   22 ++++++++++++++++++++++
 support/scripts/graph-depends |    2 ++
 5 files changed, 52 insertions(+), 0 deletions(-)
 create mode 100644 arch/Makefile.in
 create mode 100644 arch/Makefile.in.bfin
Makefile +2 -0
index 7f0822f..c2f43a4 100644
@@ -329,6 +329,8 @@ ifneq ($(PACKAGE_OVERRIDE_FILE),)
 -include $(PACKAGE_OVERRIDE_FILE)
 endif
 
+include arch/Makefile.in
+
 include package/*/*.mk
 
 include boot/common.mk
arch/Config.in.bfin +21 -0
index 021f5fe..038da4a 100644
@@ -62,6 +62,27 @@ config BR2_bf561
 	bool "bf561"
 endchoice
 
+config BR2_BFIN_INSTALL_FDPIC_SHARED
+	depends on BR2_bfin && !BR2_BINFMT_FDPIC
+	bool "Install FDPIC shared libraries"
+	default y
+	help
+	  Blackfin Linux kernel supports running both FDPIC and FLAT applications
+	  concurrently if the binary format specific libraries installed properly.
+	  This option allow developer to install FDPIC libraries into a buildroot
+	  rootfs image built with binary format macro other than BR2_BINFMT_FDPIC.
+
+config BR2_BFIN_INSTALL_FLAT_SHARED
+	depends on BR2_bfin && !BR2_BINFMT_FLAT_SHARED
+	bool "Install FLAT shared libraries"
+	default y
+	help
+	  Blackfin Linux kernel supports running both FDPIC and FLAT applications
+	  concurrently if the binary format specific libraries installed properly.
+	  This option allow developer to install FLAT libraries into a buildroot
+	  rootfs image built with binary format macro other than
+	  BR2_BINFMT_FLAT_SHARED.
+
 config BR2_ARCH
 	default "bfin"
 
arch/Makefile.in new file +5 -0
new file mode 100644
index 0000000..d791118
@@ -0,0 +1,5 @@
+# The architecture specific Makefile.in.$ARCH should be included only
+# when the arch macro is selected.
+ifeq ($(BR2_bfin),y)
+include arch/Makefile.in.bfin
+endif
arch/Makefile.in.bfin new file +22 -0
new file mode 100644
index 0000000..9089bc5
@@ -0,0 +1,22 @@
+TARGETS_BFIN-$(BR2_BFIN_INSTALL_FDPIC_SHARED) += target-shared-libs-fdpic
+TARGETS_BFIN-$(BR2_BFIN_INSTALL_FLAT_SHARED) += target-shared-libs-flat
+TARGETS += $(TARGETS_BFIN-y)
+
+CROSS_COMPILE_SHARED_FDPIC ?= bfin-linux-uclibc-
+target-shared-libs-fdpic:
+	set -e; \
+	t=`$(CROSS_COMPILE_SHARED_FDPIC)gcc $(CPUFLAGS) -print-file-name=libc.a`; \
+	t=`dirname $$t`/../..; \
+	for i in $$t/lib/*so*; do \
+		i=`readlink -f "$$i"`; \
+		soname=`$(CROSS_COMPILE_SHARED_FDPIC)readelf -d "$$i" | sed -n '/(SONAME)/s:.*[[]\(.*\)[]].*:\1:p'`; \
+		$(INSTALL) -D $$i $(TARGET_DIR)/lib/$$soname; \
+	done
+
+CROSS_COMPILE_SHARED_FLAT ?= bfin-uclinux-
+target-shared-libs-flat:
+	set -e; \
+	t=`$(CROSS_COMPILE_SHARED_FLAT)gcc $(CPUFLAGS) -mid-shared-library -print-file-name=libc`; \
+	if [ -f $$t -a ! -h $$t ] ; then \
+		$(INSTALL) -D $$t $(TARGET_DIR)/lib/lib1.so; \
+	fi
support/scripts/graph-depends +2 -0
index 1163d79..227d085 100755
@@ -168,6 +168,8 @@ TARGET_EXCEPTIONS = [
     "erase-fakeroots",
     "target-generic-hostname",
     "target-root-passwd",
+    "target-shared-libs-fdpic",
+    "target-shared-libs-flat",
 ]
 
 # In full mode, start with the result of get_targets() to get the main
Signature · 1 line
1.7.0.4
#24 lore raw

PATCH v2 6/7 arch: Introduce blackfin-specific Makefile

Dear Sonic Zhang,

arch/Config.in.bfin config BR2_bf561 · line 68

Quoted 4 lines · Sonic Zhang
arch/Config.in.bfin +4 -0
+config BR2_BFIN_INSTALL_FDPIC_SHARED
+	depends on BR2_bfin && !BR2_BINFMT_FDPIC
+	bool "Install FDPIC shared libraries"
+	default y

Any reason to have this default to y ?

Review

Quoted 2 lines
(quoted diff) +2 -0
+	help
+	  Blackfin Linux kernel supports running both FDPIC and FLAT applications

The Blackfin Linux kernel ...

Review

Quoted 1 line
(quoted diff) +1 -0
+	  concurrently if the binary format specific libraries installed properly.

are installed properly.

arch/Config.in.bfin config BR2_bf561 · line 72

Quoted 1 line
arch/Config.in.bfin +1 -0
+	  This option allow developer to install FDPIC libraries into a buildroot

allows the developer

arch/Config.in.bfin config BR2_bf561 · line 73

Quoted 1 line
arch/Config.in.bfin +1 -0
+	  rootfs image built with binary format macro other than BR2_BINFMT_FDPIC.

built with a binary format that is not FDPIC.

arch/Config.in.bfin config BR2_bf561 · line 84

Quoted 11 lines
arch/Config.in.bfin +11 -0
+
+config BR2_BFIN_INSTALL_FLAT_SHARED
+	depends on BR2_bfin && !BR2_BINFMT_FLAT_SHARED
+	bool "Install FLAT shared libraries"
+	default y
+	help
+	  Blackfin Linux kernel supports running both FDPIC and FLAT applications
+	  concurrently if the binary format specific libraries installed properly.
+	  This option allow developer to install FLAT libraries into a buildroot
+	  rootfs image built with binary format macro other than
+	  BR2_BINFMT_FLAT_SHARED.

Same typos.

Quoted 18 lines
arch/Makefile.in.bfin new file +12 -0
new file mode 100644
index 0000000..9089bc5
@@ -0,0 +1,22 @@
+TARGETS_BFIN-$(BR2_BFIN_INSTALL_FDPIC_SHARED) += target-shared-libs-fdpic
+TARGETS_BFIN-$(BR2_BFIN_INSTALL_FLAT_SHARED) += target-shared-libs-flat
+TARGETS += $(TARGETS_BFIN-y)
+
+CROSS_COMPILE_SHARED_FDPIC ?= bfin-linux-uclibc-
+target-shared-libs-fdpic:
+	set -e; \
+	t=`$(CROSS_COMPILE_SHARED_FDPIC)gcc $(CPUFLAGS) -print-file-name=libc.a`; \
+	t=`dirname $$t`/../..; \
+	for i in $$t/lib/*so*; do \
+		i=`readlink -f "$$i"`; \
+		soname=`$(CROSS_COMPILE_SHARED_FDPIC)readelf -d "$$i" | sed -n '/(SONAME)/s:.*[[]\(.*\)[]].*:\1:p'`; \

arch/Makefile.in.bfin line 22

Quoted 10 lines
arch/Makefile.in.bfin new file +10 -0
+		$(INSTALL) -D $$i $(TARGET_DIR)/lib/$$soname; \
+	done
+
+CROSS_COMPILE_SHARED_FLAT ?= bfin-uclinux-
+target-shared-libs-flat:
+	set -e; \
+	t=`$(CROSS_COMPILE_SHARED_FLAT)gcc $(CPUFLAGS) -mid-shared-library -print-file-name=libc`; \
+	if [ -f $$t -a ! -h $$t ] ; then \
+		$(INSTALL) -D $$t $(TARGET_DIR)/lib/lib1.so; \
+	fi

I am still not happy with this, because it simply doesn't work unless you have the Blackfin toolchain installed globally on your system, which simply isn't the case for normal users.

So I believe we should extend the external toolchain logic to be able to use three variants of the Blackfin toolchain:

* Only FDPIC
* Only FLAT
* Both FLAT and FDPIC

And then, this logic should be moved in the external toolchain logic, where we already do the process of copying libraries from the toolchain to the target, and from the toolchain to the staging directory.

Also:

* $(CPUFLAGS) isn't defined anywhere

* the logic to determine which .so files to copy should use the $(LIB_EXTERNAL_LIBS) and $(USR_LIB_EXTERNAL_LIBS) that we already use in ext-tool.mk.

* I don't quite understand the logic you're using for the shared flat library copying. You use -print-file-name=libc, but then you copy it under the name 'lib1.so'. I think a comment above this part would be useful.

Thanks!

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#25 lore raw

PATCH v2 6/7 arch: Introduce blackfin-specific Makefile

Hi Thomas,

Quoted 10 lines · Thomas Petazzoni

Dear Sonic Zhang,

arch/Config.in.bfin config BR2_bf561 · line 68

Quoted 4 lines · Sonic Zhang
arch/Config.in.bfin +4 -0
+config BR2_BFIN_INSTALL_FDPIC_SHARED
+     depends on BR2_bfin && !BR2_BINFMT_FDPIC
+     bool "Install FDPIC shared libraries"
+     default y

Any reason to have this default to y ?

No. Can be removed.

Quoted 18 lines

Review

Quoted 3 lines
(quoted diff) +2 -0
+     help
+       Blackfin Linux kernel supports running both FDPIC and FLAT applications

The Blackfin Linux kernel ...

Quoted 1 line

+ concurrently if the binary format specific libraries installed properly.

are installed properly.

Quoted 1 line

+ This option allow developer to install FDPIC libraries into a buildroot

allows the developer

Quoted 1 line

+ rootfs image built with binary format macro other than BR2_BINFMT_FDPIC.

built with a binary format that is not FDPIC.

Quoted 13 lines

arch/Config.in.bfin config BR2_bf561 · line 84

Quoted 11 lines
arch/Config.in.bfin +11 -0
+
+config BR2_BFIN_INSTALL_FLAT_SHARED
+     depends on BR2_bfin && !BR2_BINFMT_FLAT_SHARED
+     bool "Install FLAT shared libraries"
+     default y
+     help
+       Blackfin Linux kernel supports running both FDPIC and FLAT applications
+       concurrently if the binary format specific libraries installed properly.
+       This option allow developer to install FLAT libraries into a buildroot
+       rootfs image built with binary format macro other than
+       BR2_BINFMT_FLAT_SHARED.

Same typos.

Thanks.

Quoted 37 lines
Quoted 19 lines
arch/Makefile.in.bfin new file +12 -0
new file mode 100644
index 0000000..9089bc5
@@ -0,0 +1,22 @@
+TARGETS_BFIN-$(BR2_BFIN_INSTALL_FDPIC_SHARED) += target-shared-libs-fdpic
+TARGETS_BFIN-$(BR2_BFIN_INSTALL_FLAT_SHARED) += target-shared-libs-flat
+TARGETS += $(TARGETS_BFIN-y)
+
+CROSS_COMPILE_SHARED_FDPIC ?= bfin-linux-uclibc-
+target-shared-libs-fdpic:
+     set -e; \
+     t=`$(CROSS_COMPILE_SHARED_FDPIC)gcc $(CPUFLAGS) -print-file-name=libc.a`; \
+     t=`dirname $$t`/../..; \
+     for i in $$t/lib/*so*; do \
+             i=`readlink -f "$$i"`; \
+             soname=`$(CROSS_COMPILE_SHARED_FDPIC)readelf -d "$$i" | sed -n '/(SONAME)/s:.*[[]\(.*\)[]].*:\1:p'`; \

arch/Makefile.in.bfin line 22

Quoted 10 lines
arch/Makefile.in.bfin new file +10 -0
+             $(INSTALL) -D $$i $(TARGET_DIR)/lib/$$soname; \
+     done
+
+CROSS_COMPILE_SHARED_FLAT ?= bfin-uclinux-
+target-shared-libs-flat:
+     set -e; \
+     t=`$(CROSS_COMPILE_SHARED_FLAT)gcc $(CPUFLAGS) -mid-shared-library -print-file-name=libc`; \
+     if [ -f $$t -a ! -h $$t ] ; then \
+             $(INSTALL) -D $$t $(TARGET_DIR)/lib/lib1.so; \
+     fi

I am still not happy with this, because it simply doesn't work unless you have the Blackfin toolchain installed globally on your system, which simply isn't the case for normal users.

So I believe we should extend the external toolchain logic to be able to use three variants of the Blackfin toolchain:

Quoted 7 lines

* Only FDPIC
* Only FLAT
* Both FLAT and FDPIC

And then, this logic should be moved in the external toolchain logic, where we already do the process of copying libraries from the toolchain to the target, and from the toolchain to the staging directory.

Since FPDIC libraries are installed by default if BINFMT_FDPIC is selected, how about making INSTALL_FDPIC_LIB option depend on BINFMT_FLAT only? So do the INSTALL_FLAT_LIB option. And no "Both FLAT and FDPIC" is needed in this case.

Quoted 4 lines

Also:

* $(CPUFLAGS) isn't defined anywhere

Yes, forgot to define it after switching to the toolchain wrapper solution.

Quoted 3 lines

* the logic to determine which .so files to copy should use the $(LIB_EXTERNAL_LIBS) and $(USR_LIB_EXTERNAL_LIBS) that we already use in ext-tool.mk.

This only applies to the FDPIC libraries. The FLAT libraries use a different name policy.

Quoted 4 lines

* I don't quite understand the logic you're using for the shared flat library copying. You use -print-file-name=libc, but then you copy it under the name 'lib1.so'. I think a comment above this part would be useful.

The flat libraries are found and linked according to the index in it name "libN.so". Index 1 is reserved for the standard C library. Customer libraries can use 4 and above. That's why the libc is renamed to lib1.so in target rootfs.

Regards,

Sonic.

#26 lore raw

PATCH v2 6/7 arch: Introduce blackfin-specific Makefile

Dear Sonic Zhang,

Quoted 11 lines · Sonic Zhang
Quoted 11 lines

I am still not happy with this, because it simply doesn't work unless you have the Blackfin toolchain installed globally on your system, which simply isn't the case for normal users.

So I believe we should extend the external toolchain logic to be able to use three variants of the Blackfin toolchain:

* Only FDPIC
* Only FLAT
* Both FLAT and FDPIC

Quoted 7 lines
Quoted 3 lines

And then, this logic should be moved in the external toolchain logic, where we already do the process of copying libraries from the toolchain to the target, and from the toolchain to the staging directory.

Since FPDIC libraries are installed by default if BINFMT_FDPIC is selected, how about making INSTALL_FDPIC_LIB option depend on BINFMT_FLAT only? So do the INSTALL_FLAT_LIB option.

Yes, this makes sense.

Quoted 1 line

And no "Both FLAT and FDPIC" is needed in this case.

In fact, I looked again at our support for Blackfin external toolchains, and I was wrong: we always install *both* the FDPIC and Flat shared libraries. So in fact, you don't need to handle the variants of the external toolchain.

Just move your logic into the external toolchain logic that copies libraries, and that should be fine. I believe it belongs to the external toolchain logic, because it is highly specific to Analog Devices toolchains. If we ever support Blackfin in the internal backend, it will always either be FDPIC *or* FLAT, but not both at the same time.

Quoted 6 lines
Quoted 3 lines

* the logic to determine which .so files to copy should use the $(LIB_EXTERNAL_LIBS) and $(USR_LIB_EXTERNAL_LIBS) that we already use in ext-tool.mk.

This only applies to the FDPIC libraries. The FLAT libraries use a different name policy.

Yes, sure, but I was referring to the FDPIC libraries in this part (sorry if it wasn't clear).

Quoted 9 lines
Quoted 4 lines

* I don't quite understand the logic you're using for the shared flat library copying. You use -print-file-name=libc, but then you copy it under the name 'lib1.so'. I think a comment above this part would be useful.

The flat libraries are found and linked according to the index in it name "libN.so". Index 1 is reserved for the standard C library. Customer libraries can use 4 and above. That's why the libc is renamed to lib1.so in target rootfs.

Oh, ok, interesting. Could you just copy/paste this explanation as a comment above the relevant part of the code?

Thanks a lot Sonic for your very quick feedback in this discussion, I think we're making great progress!

Thanks,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#27 lore raw

PATCH v2 7/7 package: Introduce NOMMU symbol

In reply to Sonic Zhang

From: Sonic Zhang <[email protected]>

v2-changes:
none

v1-chagnes:
- Introduce NOMMU symbol __NOMMU__

---
 package/Makefile.in |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
package/Makefile.in +4 -0
index a8bf36b..3a26b09 100644
@@ -103,6 +103,10 @@ TARGET_CFLAGS = $(TARGET_CPPFLAGS) $(TARGET_ABI) $(TARGET_OPTIMIZATION) $(TARGET
 TARGET_CXXFLAGS = $(TARGET_CFLAGS)
 TARGET_LDFLAGS = $(call qstrip,$(BR2_TARGET_LDFLAGS))
 
+ifneq ($(BR2_USE_MMU), y)
+TARGET_CFLAGS += -D__NOMMU__
+endif
+
 ifeq ($(BR2_TOOLCHAIN_BUILDROOT)$(BR2_TOOLCHAIN_CTNG),y)
 TARGET_CROSS=$(HOST_DIR)/usr/bin/$(GNU_TARGET_NAME)-
 else
Signature · 1 line
1.7.0.4
#28 lore raw

PATCH v2 1/7 arch: Add blackfin CPU choice.

In reply to Sonic Zhang

Dear Sonic Zhang,

Thanks for continuing the work on this!

Quoted 19 lines · Sonic Zhang

From: Sonic Zhang <[email protected]>

v2-changes:
none

v1-changes:
- is patch adds a Target CPU configuration option and uses it to select a -m option for gcc.

---
 arch/Config.in.bfin |   97 +++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 90 insertions(+), 7 deletions(-)
arch/Config.in.bfin +0 -0
index 0b137ae..ac96620 100644

arch/Config.in.bfin line 9

Quoted 10 lines
arch/Config.in.bfin +1 -7
@@ -1,12 +1,65 @@
 choice
-	prompt "Target ABI"
+	prompt "Target CPU"
 	depends on BR2_bfin
-	default BR2_BFIN_FDPIC
-config BR2_BFIN_FDPIC
-	bool "FDPIC"
-config BR2_BFIN_FLAT
-	bool "FLAT"
-	select BR2_PREFER_STATIC_LIB

You can't just remove BR2_BFIN_FDPIC and BR2_BFIN_FLAT, they are used in the external toolchain logic of Buildroot:

$ git grep BR2_BFIN_FDPIC .
arch/Config.in.bfin:	default BR2_BFIN_FDPIC
arch/Config.in.bfin:config BR2_BFIN_FDPIC
toolchain/toolchain-external/Config.in:	default "bfin-uclinux"		 if BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX_2011R1 && !BR2_BFIN_FDPIC
toolchain/toolchain-external/Config.in:	default "bfin-linux-uclibc"	 if BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX_2011R1 && BR2_BFIN_FDPIC
toolchain/toolchain-external/Config.in:	default "bfin-uclinux"		 if BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX_2012R1 && !BR2_BFIN_FDPIC
toolchain/toolchain-external/Config.in:	default "bfin-linux-uclibc"	 if BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX_2012R1 && BR2_BFIN_FDPIC
toolchain/toolchain-external/Config.in:	default "bfin-uclinux"		 if BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX_2012R2 && !BR2_BFIN_FDPIC
toolchain/toolchain-external/Config.in:	default "bfin-linux-uclibc"	 if BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX_2012R2 && BR2_BFIN_FDPIC

So, I think your patch 3/7 should be first in the series, and it should be followed by a patch that removes BR2_BFIN_FDPIC and BR2_BFIN_FLAT and use the new BR2_BINFMT_* symbols in the external toolchain logic.

Basically, your patch set should not break things! When you remove a symbol, make sure it isn't used anymore.

Other than that, I'm fine with this patch adding the blackfin CPU variants.

Best regards,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#29 lore raw

PATCH v2 1/7 arch: Add blackfin CPU choice.

Hi Thomas,

Quoted 48 lines · Thomas Petazzoni

Dear Sonic Zhang,

Thanks for continuing the work on this!

Quoted 19 lines · Sonic Zhang

From: Sonic Zhang <[email protected]>

v2-changes:
none

v1-changes:
- is patch adds a Target CPU configuration option and uses it to select a -m option for gcc.

---
 arch/Config.in.bfin |   97 +++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 90 insertions(+), 7 deletions(-)
arch/Config.in.bfin +0 -0
index 0b137ae..ac96620 100644

arch/Config.in.bfin line 9

Quoted 10 lines
arch/Config.in.bfin +1 -7
@@ -1,12 +1,65 @@
 choice
-     prompt "Target ABI"
+     prompt "Target CPU"
      depends on BR2_bfin
-     default BR2_BFIN_FDPIC
-config BR2_BFIN_FDPIC
-     bool "FDPIC"
-config BR2_BFIN_FLAT
-     bool "FLAT"
-     select BR2_PREFER_STATIC_LIB

You can't just remove BR2_BFIN_FDPIC and BR2_BFIN_FLAT, they are used in the external toolchain logic of Buildroot:

$ git grep BR2_BFIN_FDPIC .
arch/Config.in.bfin:    default BR2_BFIN_FDPIC
arch/Config.in.bfin:config BR2_BFIN_FDPIC
toolchain/toolchain-external/Config.in: default "bfin-uclinux"           if BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX_2011R1 && !BR2_BFIN_FDPIC
toolchain/toolchain-external/Config.in: default "bfin-linux-uclibc"      if BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX_2011R1 && BR2_BFIN_FDPIC
toolchain/toolchain-external/Config.in: default "bfin-uclinux"           if BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX_2012R1 && !BR2_BFIN_FDPIC
toolchain/toolchain-external/Config.in: default "bfin-linux-uclibc"      if BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX_2012R1 && BR2_BFIN_FDPIC
toolchain/toolchain-external/Config.in: default "bfin-uclinux"           if BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX_2012R2 && !BR2_BFIN_FDPIC
toolchain/toolchain-external/Config.in: default "bfin-linux-uclibc"      if BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX_2012R2 && BR2_BFIN_FDPIC
Quoted 4 lines

So, I think your patch 3/7 should be first in the series, and it should be followed by a patch that removes BR2_BFIN_FDPIC and BR2_BFIN_FLAT and use the new BR2_BINFMT_* symbols in the external toolchain logic.

OK. I will move 3/7 ahead.

Regards,

Sonic