* [Buildroot] [PATCH v2 2/4] toolchain: add bfin support
@ 2016-05-13 12:15 Waldemar Brodkorb
2016-05-28 13:33 ` Thomas Petazzoni
0 siblings, 1 reply; 4+ messages in thread
From: Waldemar Brodkorb @ 2016-05-13 12:15 UTC (permalink / raw)
To: buildroot
With gcc 6.1.0 and binutils 2.26 internal bfin toolchain
can be used. A gcc patch is required, which was reported upstream.
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
---
v1 -> v2:
- remove conditional patch requested by Thomas Petazzoni
- do not enable BR2_GCC_TARGET_CPU, may be we can use
BR2_TARGET_CPU later for passing -mcpu= via CFLAGS
---
arch/Config.in.bfin | 5 +++--
package/binutils/Config.in.host | 8 +++++---
package/gcc/6.1.0/892-disable-dwarf-bfin.patch | 24 ++++++++++++++++++++++++
package/gcc/Config.in.host | 8 ++++----
package/gcc/gcc.mk | 1 +
package/uclibc/Config.in | 1 +
toolchain/Config.in | 1 -
7 files changed, 38 insertions(+), 10 deletions(-)
create mode 100644 package/gcc/6.1.0/892-disable-dwarf-bfin.patch
diff --git a/arch/Config.in.bfin b/arch/Config.in.bfin
index 415fc89..2258ff9 100644
--- a/arch/Config.in.bfin
+++ b/arch/Config.in.bfin
@@ -68,7 +68,8 @@ config BR2_ARCH
config BR2_ENDIAN
default "LITTLE"
-config BR2_GCC_TARGET_CPU
+config BR2_TARGET_CPU
+ string "Target CPU"
default bf606 if BR2_bf606
default bf607 if BR2_bf607
default bf608 if BR2_bf608
@@ -98,7 +99,7 @@ config BR2_GCC_TARGET_CPU
default bf549 if BR2_bf549
default bf561 if BR2_bf561
-config BR2_GCC_TARGET_CPU_REVISION
+config BR2_TARGET_CPU_REVISION
string "Target CPU revision"
help
Specify a target CPU revision, which will be appended to the
diff --git a/package/binutils/Config.in.host b/package/binutils/Config.in.host
index e42918e..ec6d2d8 100644
--- a/package/binutils/Config.in.host
+++ b/package/binutils/Config.in.host
@@ -9,7 +9,7 @@ choice
config BR2_BINUTILS_VERSION_2_23_X
depends on !BR2_aarch64 && !BR2_microblaze && \
- !BR2_powerpc64le && !BR2_nios2
+ !BR2_powerpc64le && !BR2_nios2 && !BR2_bfin
# Unsupported for MIPS R6
depends on !BR2_mips_32r6 && !BR2_mips_64r6
# Unsupported ARM cores
@@ -17,8 +17,8 @@ choice
bool "binutils 2.23.2"
config BR2_BINUTILS_VERSION_2_24_X
- # supported, but broken on Nios-II and powerpc64le
- depends on !BR2_nios2 && !BR2_powerpc64le
+ # supported, but broken on Nios-II, Blackfin and powerpc64le
+ depends on !BR2_nios2 && !BR2_powerpc64le && !BR2_bfin
# Unsupported for MIPS R6
depends on !BR2_mips_32r6 && !BR2_mips_64r6
# Unsupported ARM cores
@@ -27,6 +27,8 @@ choice
config BR2_BINUTILS_VERSION_2_25_X
bool "binutils 2.25.1"
+ # supported but broken on Blackfin
+ depends on !BR2_bfin
config BR2_BINUTILS_VERSION_2_26_X
bool "binutils 2.26"
diff --git a/package/gcc/6.1.0/892-disable-dwarf-bfin.patch b/package/gcc/6.1.0/892-disable-dwarf-bfin.patch
new file mode 100644
index 0000000..81acde7
--- /dev/null
+++ b/package/gcc/6.1.0/892-disable-dwarf-bfin.patch
@@ -0,0 +1,24 @@
+Dwarf support does not compile
+
+Reported upstream:
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68468
+
+Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
+
+diff -Nur gcc-6.1.0.orig/libgcc/config.host gcc-6.1.0/libgcc/config.host
+--- gcc-6.1.0.orig/libgcc/config.host 2016-02-26 21:02:28.000000000 +0100
++++ gcc-6.1.0/libgcc/config.host 2016-05-12 19:26:30.973350274 +0200
+@@ -230,6 +230,13 @@
+ ;;
+ esac
+ ;;
++bfin-*-*linux*)
++ tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver t-linux"
++ extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o"
++ if test x$enable_vtable_verify = xyes; then
++ extra_parts="$extra_parts vtv_start.o vtv_end.o vtv_start_preinit.o vtv_end_preinit.o"
++ fi
++ ;;
+ *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu)
+ tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver t-linux"
+ extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o"
diff --git a/package/gcc/Config.in.host b/package/gcc/Config.in.host
index 8cf2d56..45cd1f7 100644
--- a/package/gcc/Config.in.host
+++ b/package/gcc/Config.in.host
@@ -18,7 +18,7 @@ choice
depends on BR2_DEPRECATED_SINCE_2016_05
# Broken or unsupported architectures
depends on !BR2_microblaze && !BR2_aarch64 && !BR2_arc \
- && !BR2_powerpc64le && !BR2_nios2
+ && !BR2_powerpc64le && !BR2_nios2 && !BR2_bfin
# Broken or unsupported ARM cores
depends on !BR2_cortex_a12 && !BR2_pj4 && !BR2_cortex_a17
# Broken or unsupported PPC cores
@@ -37,7 +37,7 @@ choice
bool "gcc 4.8.x"
# Broken or unsupported architectures
depends on !BR2_microblaze && !BR2_arc \
- && !BR2_powerpc64le && !BR2_nios2
+ && !BR2_powerpc64le && !BR2_nios2 && !BR2_bfin
# Broken or unsupported ARM cores
depends on !BR2_cortex_a12 && !BR2_cortex_a17
# Broken or unsupported PPC cores
@@ -61,7 +61,7 @@ choice
config BR2_GCC_VERSION_4_9_X
bool "gcc 4.9.x"
# Broken or unsupported architectures
- depends on !BR2_arc
+ depends on !BR2_arc && !BR2_bfin
# Broken or unsupported ARM cores
depends on !BR2_cortex_a17
# Unsupported for MIPS R6
@@ -74,7 +74,7 @@ choice
config BR2_GCC_VERSION_5_X
bool "gcc 5.x"
# Broken or unsupported architectures
- depends on !BR2_arc
+ depends on !BR2_arc && !BR2_bfin
select BR2_GCC_NEEDS_MPC
select BR2_GCC_SUPPORTS_GRAPHITE
select BR2_TOOLCHAIN_GCC_AT_LEAST_5
diff --git a/package/gcc/gcc.mk b/package/gcc/gcc.mk
index 46f05ff..6bf4ef1 100644
--- a/package/gcc/gcc.mk
+++ b/package/gcc/gcc.mk
@@ -189,6 +189,7 @@ endif
ifneq ($(call qstrip,$(BR2_GCC_TARGET_ABI)),)
HOST_GCC_COMMON_CONF_OPTS += --with-abi=$(BR2_GCC_TARGET_ABI)
endif
+
ifneq ($(call qstrip,$(BR2_GCC_TARGET_CPU)),)
ifneq ($(call qstrip,$(BR2_GCC_TARGET_CPU_REVISION)),)
HOST_GCC_COMMON_CONF_OPTS += --with-cpu=$(call qstrip,$(BR2_GCC_TARGET_CPU)-$(BR2_GCC_TARGET_CPU_REVISION))
diff --git a/package/uclibc/Config.in b/package/uclibc/Config.in
index efa84e9..cfa2c9b 100644
--- a/package/uclibc/Config.in
+++ b/package/uclibc/Config.in
@@ -125,6 +125,7 @@ config BR2_UCLIBC_TARGET_ARCH
string
default "arc" if BR2_arcle || BR2_arceb
default "arm" if BR2_arm || BR2_armeb
+ default "bfin" if BR2_bfin
default "m68k" if BR2_m68k
default "mips" if BR2_mips || BR2_mipsel || BR2_mips64 || BR2_mips64el
default "powerpc" if BR2_powerpc
diff --git a/toolchain/Config.in b/toolchain/Config.in
index fc30c6e..b9ba677 100644
--- a/toolchain/Config.in
+++ b/toolchain/Config.in
@@ -40,7 +40,6 @@ choice
config BR2_TOOLCHAIN_BUILDROOT
bool "Buildroot toolchain"
- depends on !BR2_bfin
select BR2_TOOLCHAIN_HAS_SHADOW_PASSWORDS
config BR2_TOOLCHAIN_EXTERNAL
--
2.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread* [Buildroot] [PATCH v2 2/4] toolchain: add bfin support
2016-05-13 12:15 [Buildroot] [PATCH v2 2/4] toolchain: add bfin support Waldemar Brodkorb
@ 2016-05-28 13:33 ` Thomas Petazzoni
2016-05-28 15:42 ` Waldemar Brodkorb
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Petazzoni @ 2016-05-28 13:33 UTC (permalink / raw)
To: buildroot
Hello,
On Fri, 13 May 2016 14:15:57 +0200, Waldemar Brodkorb wrote:
> -config BR2_GCC_TARGET_CPU
> +config BR2_TARGET_CPU
This seems wrong. Why are you doing this?
> + string "Target CPU"
And this?
> default bf606 if BR2_bf606
> default bf607 if BR2_bf607
> default bf608 if BR2_bf608
> @@ -98,7 +99,7 @@ config BR2_GCC_TARGET_CPU
> default bf549 if BR2_bf549
> default bf561 if BR2_bf561
>
> -config BR2_GCC_TARGET_CPU_REVISION
> +config BR2_TARGET_CPU_REVISION
Ditto here.
At the very least, it needs to be explained in the commit log,
including the impact on the Blackfin external toolchain support.
> diff --git a/package/gcc/gcc.mk b/package/gcc/gcc.mk
> index 46f05ff..6bf4ef1 100644
> --- a/package/gcc/gcc.mk
> +++ b/package/gcc/gcc.mk
> @@ -189,6 +189,7 @@ endif
> ifneq ($(call qstrip,$(BR2_GCC_TARGET_ABI)),)
> HOST_GCC_COMMON_CONF_OPTS += --with-abi=$(BR2_GCC_TARGET_ABI)
> endif
> +
Useless change.
> ifneq ($(call qstrip,$(BR2_GCC_TARGET_CPU)),)
> ifneq ($(call qstrip,$(BR2_GCC_TARGET_CPU_REVISION)),)
So you essentially broke this code by renaming the options.
> HOST_GCC_COMMON_CONF_OPTS += --with-cpu=$(call qstrip,$(BR2_GCC_TARGET_CPU)-$(BR2_GCC_TARGET_CPU_REVISION))
> diff --git a/package/uclibc/Config.in b/package/uclibc/Config.in
> index efa84e9..cfa2c9b 100644
> --- a/package/uclibc/Config.in
> +++ b/package/uclibc/Config.in
> @@ -125,6 +125,7 @@ config BR2_UCLIBC_TARGET_ARCH
> string
> default "arc" if BR2_arcle || BR2_arceb
> default "arm" if BR2_arm || BR2_armeb
> + default "bfin" if BR2_bfin
> default "m68k" if BR2_m68k
> default "mips" if BR2_mips || BR2_mipsel || BR2_mips64 || BR2_mips64el
> default "powerpc" if BR2_powerpc
> diff --git a/toolchain/Config.in b/toolchain/Config.in
> index fc30c6e..b9ba677 100644
> --- a/toolchain/Config.in
> +++ b/toolchain/Config.in
> @@ -40,7 +40,6 @@ choice
>
> config BR2_TOOLCHAIN_BUILDROOT
> bool "Buildroot toolchain"
> - depends on !BR2_bfin
> select BR2_TOOLCHAIN_HAS_SHADOW_PASSWORDS
>
> config BR2_TOOLCHAIN_EXTERNAL
Thanks,
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Buildroot] [PATCH v2 2/4] toolchain: add bfin support
2016-05-28 13:33 ` Thomas Petazzoni
@ 2016-05-28 15:42 ` Waldemar Brodkorb
2016-05-28 17:10 ` Thomas Petazzoni
0 siblings, 1 reply; 4+ messages in thread
From: Waldemar Brodkorb @ 2016-05-28 15:42 UTC (permalink / raw)
To: buildroot
Hi Thomas,
Thomas Petazzoni wrote,
> Hello,
>
> On Fri, 13 May 2016 14:15:57 +0200, Waldemar Brodkorb wrote:
>
> > -config BR2_GCC_TARGET_CPU
> > +config BR2_TARGET_CPU
>
> This seems wrong. Why are you doing this?
In the first patch I disabled --with-cpu for gcc and bfin, as gcc
does not support --with-cpu on bfin. You could use
-mcpu=$(BR2_TARGET_CPU) to optimize code for a specific Bfin CPU,
that is the reason the second version of the patch renamed
the config symbols for a later use.
> > + string "Target CPU"
>
> And this?
>
> > default bf606 if BR2_bf606
> > default bf607 if BR2_bf607
> > default bf608 if BR2_bf608
> > @@ -98,7 +99,7 @@ config BR2_GCC_TARGET_CPU
> > default bf549 if BR2_bf549
> > default bf561 if BR2_bf561
> >
> > -config BR2_GCC_TARGET_CPU_REVISION
> > +config BR2_TARGET_CPU_REVISION
>
> Ditto here.
>
> At the very least, it needs to be explained in the commit log,
> including the impact on the Blackfin external toolchain support.
I thought it has no impact on the external toolchain.
Is BR2_GCC_TARGET_CPU used in any way for external toolchains?
> So you essentially broke this code by renaming the options.
Not broke, disabled it here my intention :=)
So how we go further with the internal Bfin toolchain stuff?
best regards
Waldemar
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Buildroot] [PATCH v2 2/4] toolchain: add bfin support
2016-05-28 15:42 ` Waldemar Brodkorb
@ 2016-05-28 17:10 ` Thomas Petazzoni
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Petazzoni @ 2016-05-28 17:10 UTC (permalink / raw)
To: buildroot
Hello,
On Sat, 28 May 2016 17:42:29 +0200, Waldemar Brodkorb wrote:
> > > -config BR2_GCC_TARGET_CPU
> > > +config BR2_TARGET_CPU
> >
> > This seems wrong. Why are you doing this?
>
> In the first patch I disabled --with-cpu for gcc and bfin, as gcc
> does not support --with-cpu on bfin. You could use
> -mcpu=$(BR2_TARGET_CPU) to optimize code for a specific Bfin CPU,
> that is the reason the second version of the patch renamed
> the config symbols for a later use.
Hum, this is really annoying. All the internal toolchain backend of
Buildroot is based on the assumption that the gcc configure options
--with-arch, --with-cpu, --with-float, --with-fpu and --with-abi allow
to specify the default values for -march, -mcpu, -mfloat, -mfpu and
-mabi. For this reason, we pass the values at gcc configure time, but
then afterwards we don't pass any mcpu/mfloat/march/... values when
building packages, because gcc is supposed to generate by default code
for the selected arch/cpu.
It seems like Blackfin violates this assumption, and it will require a
bit more work than the patch you're submitting to make things working.
It seems like we need to distinguish the cases where the arch/cpu/etc.
can be defined at gcc configure time from the cases where it cannot.
According to the gcc installation documentation
(https://gcc.gnu.org/install/configure.html) :
"""
--with-cpu=cpu
--with-cpu-32=cpu
--with-cpu-64=cpu
Specify which cpu variant the compiler should generate code for by
default. cpu will be used as the default value of the -mcpu= switch.
This option is only supported on some targets, including ARC, ARM,
i386, M68k, PowerPC, and SPARC. It is mandatory for ARC. The
--with-cpu-32 and --with-cpu-64 options specify separate default CPUs
for 32-bit and 64-bit modes; these options are only supported for
i386, x86-64 and PowerPC.
"""
So indeed, there is no guarantee that --with-cpu is supported on all
architectures.
> > At the very least, it needs to be explained in the commit log,
> > including the impact on the Blackfin external toolchain support.
>
> I thought it has no impact on the external toolchain.
> Is BR2_GCC_TARGET_CPU used in any way for external toolchains?
It is, yes. See toolchain-external.mk:
ifeq ($(call qstrip,$(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
ifneq ($(CC_TARGET_CPU_),)
TOOLCHAIN_EXTERNAL_CFLAGS += -mcpu=$(CC_TARGET_CPU_)
TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_CPU='"$(CC_TARGET_CPU_)"'
endif
And then in the toolchain wrapper:
#ifdef BR_CPU
*cur++ = "-mcpu=" BR_CPU;
#endif
This logic ensures that the value of BR2_GCC_TARGET_CPU is always
passed as -mcpu by the toolchain wrapper.
Since the toolchain wrapper is also used for the internal toolchain, we
can re-use the same strategy to hardcode the mcpu value.
> So how we go further with the internal Bfin toolchain stuff?
The easiest option by far is to have a per-architecture hidden
Config.in boolean option that says whether the arch/mcpu/etc. options
should be set at gcc configure time or not. If it's set to "y", then we
do like we do today. If it's not set to "y", then the logic to build
the toolchain wrapper for the internal toolchain case should be
modified to pass -mcpu/-mabi/-mfloat/etc.
Best regards,
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-05-28 17:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-13 12:15 [Buildroot] [PATCH v2 2/4] toolchain: add bfin support Waldemar Brodkorb
2016-05-28 13:33 ` Thomas Petazzoni
2016-05-28 15:42 ` Waldemar Brodkorb
2016-05-28 17:10 ` Thomas Petazzoni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox