diff mbox

[U-Boot] error when building env

Message ID 20140519121403.GA6376@w500.lan
State RFC
Delegated to: Tom Rini
Headers show

Commit Message

Luka Perkov May 19, 2014, 12:14 p.m. UTC
Hi Tom,

On Fri, May 16, 2014 at 01:58:05PM -0400, Tom Rini wrote:
> On Fri, May 16, 2014 at 07:26:51PM +0200, Luka Perkov wrote:
> > when trying to build env with "-mfloat-abi=hard" I'm hitting this error:
> > 
> > /opt/openwrt/trunk/staging_dir/toolchain-arm_cortex-a9+neon_gcc-4.8-linaro_uClibc-0.9.33.2_eabi/bin/arm-openwrt-linux-uclibcgnueabi-gcc  -o tools/env/fw_printenv_unstripped tools/env/fw_env.o tools/env/fw_env_main.o tools/env/crc32.o tools/env/ctype.o tools/env/linux_string.o tools/env/env_attr.o tools/env/env_flags.o tools/env/aes.o  
> > /opt/build/owrt_staging_dir/toolchain-arm_cortex-a9+neon_gcc-4.8-linaro_uClibc-0.9.33.2_eabi/bin/../lib/gcc/arm-openwrt-linux-uclibcgnueabi/4.8.3/../../../../arm-openwrt-linux-uclibcgnueabi/bin/ld: error: tools/env/fw_printenv_unstripped uses VFP register arguments, tools/env/fw_env.o does not
> 
> Odd.  I can build 'tools-only' with my hard float toolchain fine.  Can
> you build with V=1 and see what files are perhaps not getting passed in
> a -mfloat option?

The patch below fixes the problem I was having. Is that good enough for
proper patch submission?

With it I am able to use replace default HOSTCFLAGS with what was
defined in TARGET_CFLAGS.

Luka

Comments

Tom Rini June 5, 2014, 6:25 p.m. UTC | #1
On Mon, May 19, 2014 at 02:14:03PM +0200, Luka Perkov wrote:
> Hi Tom,
> 
> On Fri, May 16, 2014 at 01:58:05PM -0400, Tom Rini wrote:
> > On Fri, May 16, 2014 at 07:26:51PM +0200, Luka Perkov wrote:
> > > when trying to build env with "-mfloat-abi=hard" I'm hitting this error:
> > > 
> > > /opt/openwrt/trunk/staging_dir/toolchain-arm_cortex-a9+neon_gcc-4.8-linaro_uClibc-0.9.33.2_eabi/bin/arm-openwrt-linux-uclibcgnueabi-gcc  -o tools/env/fw_printenv_unstripped tools/env/fw_env.o tools/env/fw_env_main.o tools/env/crc32.o tools/env/ctype.o tools/env/linux_string.o tools/env/env_attr.o tools/env/env_flags.o tools/env/aes.o  
> > > /opt/build/owrt_staging_dir/toolchain-arm_cortex-a9+neon_gcc-4.8-linaro_uClibc-0.9.33.2_eabi/bin/../lib/gcc/arm-openwrt-linux-uclibcgnueabi/4.8.3/../../../../arm-openwrt-linux-uclibcgnueabi/bin/ld: error: tools/env/fw_printenv_unstripped uses VFP register arguments, tools/env/fw_env.o does not
> > 
> > Odd.  I can build 'tools-only' with my hard float toolchain fine.  Can
> > you build with V=1 and see what files are perhaps not getting passed in
> > a -mfloat option?
> 
> The patch below fixes the problem I was having. Is that good enough for
> proper patch submission?
> 
> With it I am able to use replace default HOSTCFLAGS with what was
> defined in TARGET_CFLAGS.
> 
> Luka
> 
> diff --git a/tools/env/Makefile b/tools/env/Makefile
> index f5368bc..4de1d51 100644
> --- a/tools/env/Makefile
> +++ b/tools/env/Makefile
> @@ -10,6 +10,10 @@
>  # with "CC" here for the maximum code reuse of scripts/Makefile.host.
>  HOSTCC = $(CC)
>  
> +ifneq ($(TARGET_CFLAGS),)
> +HOSTCFLAGS = $(TARGET_CFLAGS)
> +endif
> +
>  # Compile for a hosted environment on the target
>  HOST_EXTRACFLAGS  = $(patsubst -I%,-idirafter%, $(UBOOTINCLUDE)) \
>  		-idirafter $(srctree)/tools/env \

This still seems odd.  Masahiro?
Jeroen Hofstee June 5, 2014, 6:42 p.m. UTC | #2
Hi,

On do, 2014-06-05 at 14:25 -0400, Tom Rini wrote:
> On Mon, May 19, 2014 at 02:14:03PM +0200, Luka Perkov wrote:
> > Hi Tom,
> > 
> > On Fri, May 16, 2014 at 01:58:05PM -0400, Tom Rini wrote:
> > > On Fri, May 16, 2014 at 07:26:51PM +0200, Luka Perkov wrote:
> > > > when trying to build env with "-mfloat-abi=hard" I'm hitting this error:
> > > > 
> > > > /opt/openwrt/trunk/staging_dir/toolchain-arm_cortex-a9+neon_gcc-4.8-linaro_uClibc-0.9.33.2_eabi/bin/arm-openwrt-linux-uclibcgnueabi-gcc  -o tools/env/fw_printenv_unstripped tools/env/fw_env.o tools/env/fw_env_main.o tools/env/crc32.o tools/env/ctype.o tools/env/linux_string.o tools/env/env_attr.o tools/env/env_flags.o tools/env/aes.o  
> > > > /opt/build/owrt_staging_dir/toolchain-arm_cortex-a9+neon_gcc-4.8-linaro_uClibc-0.9.33.2_eabi/bin/../lib/gcc/arm-openwrt-linux-uclibcgnueabi/4.8.3/../../../../arm-openwrt-linux-uclibcgnueabi/bin/ld: error: tools/env/fw_printenv_unstripped uses VFP register arguments, tools/env/fw_env.o does not
> > > 
> > > Odd.  I can build 'tools-only' with my hard float toolchain fine.  Can
> > > you build with V=1 and see what files are perhaps not getting passed in
> > > a -mfloat option?
> > 
> > The patch below fixes the problem I was having. Is that good enough for
> > proper patch submission?
> > 
> > With it I am able to use replace default HOSTCFLAGS with what was
> > defined in TARGET_CFLAGS.
> > 
> > Luka
> > 
> > diff --git a/tools/env/Makefile b/tools/env/Makefile
> > index f5368bc..4de1d51 100644
> > --- a/tools/env/Makefile
> > +++ b/tools/env/Makefile
> > @@ -10,6 +10,10 @@
> >  # with "CC" here for the maximum code reuse of scripts/Makefile.host.
> >  HOSTCC = $(CC)
> >  
> > +ifneq ($(TARGET_CFLAGS),)
> > +HOSTCFLAGS = $(TARGET_CFLAGS)
> > +endif
> > +
> >  # Compile for a hosted environment on the target
> >  HOST_EXTRACFLAGS  = $(patsubst -I%,-idirafter%, $(UBOOTINCLUDE)) \
> >  		-idirafter $(srctree)/tools/env \
> 
> This still seems odd.  Masahiro?

Yes is seems odd indeed, shouldn't it be unconditionally be part of the
CROSS_BUILD_TOOLS check below? Since it switches compiler, but not
related flags..

Regards,
Jeroen
Masahiro Yamada June 9, 2014, 1:39 p.m. UTC | #3
Hi Luka, Tom,


On Thu, 5 Jun 2014 14:25:47 -0400
Tom Rini <trini@ti.com> wrote:

> On Mon, May 19, 2014 at 02:14:03PM +0200, Luka Perkov wrote:
> > Hi Tom,
> > 
> > On Fri, May 16, 2014 at 01:58:05PM -0400, Tom Rini wrote:
> > > On Fri, May 16, 2014 at 07:26:51PM +0200, Luka Perkov wrote:
> > > > when trying to build env with "-mfloat-abi=hard" I'm hitting this error:
> > > > 
> > > > /opt/openwrt/trunk/staging_dir/toolchain-arm_cortex-a9+neon_gcc-4.8-linaro_uClibc-0.9.33.2_eabi/bin/arm-openwrt-linux-uclibcgnueabi-gcc  -o tools/env/fw_printenv_unstripped tools/env/fw_env.o tools/env/fw_env_main.o tools/env/crc32.o tools/env/ctype.o tools/env/linux_string.o tools/env/env_attr.o tools/env/env_flags.o tools/env/aes.o  
> > > > /opt/build/owrt_staging_dir/toolchain-arm_cortex-a9+neon_gcc-4.8-linaro_uClibc-0.9.33.2_eabi/bin/../lib/gcc/arm-openwrt-linux-uclibcgnueabi/4.8.3/../../../../arm-openwrt-linux-uclibcgnueabi/bin/ld: error: tools/env/fw_printenv_unstripped uses VFP register arguments, tools/env/fw_env.o does not
> > > 
> > > Odd.  I can build 'tools-only' with my hard float toolchain fine.  Can
> > > you build with V=1 and see what files are perhaps not getting passed in
> > > a -mfloat option?
> > 
> > The patch below fixes the problem I was having. Is that good enough for
> > proper patch submission?
> > 
> > With it I am able to use replace default HOSTCFLAGS with what was
> > defined in TARGET_CFLAGS.
> > 
> > Luka
> > 
> > diff --git a/tools/env/Makefile b/tools/env/Makefile
> > index f5368bc..4de1d51 100644
> > --- a/tools/env/Makefile
> > +++ b/tools/env/Makefile
> > @@ -10,6 +10,10 @@
> >  # with "CC" here for the maximum code reuse of scripts/Makefile.host.
> >  HOSTCC = $(CC)
> >  
> > +ifneq ($(TARGET_CFLAGS),)
> > +HOSTCFLAGS = $(TARGET_CFLAGS)
> > +endif
> > +
> >  # Compile for a hosted environment on the target
> >  HOST_EXTRACFLAGS  = $(patsubst -I%,-idirafter%, $(UBOOTINCLUDE)) \
> >  		-idirafter $(srctree)/tools/env \
> 
> This still seems odd.  Masahiro?
> 

Looks odd to me.

According to Luka's build log,
he is trying to compile the C sources with hard float,
but link them against soft float library.

In my understanding,  consistency should be kept between compile and link stage
by the compiler as is .
We don't have to tweak HOSTCFLAGS from the outside.


Best Regards
Masahiro Yamada
Luka Perkov June 12, 2014, 9:50 a.m. UTC | #4
Hi Masahiro,

On Mon, Jun 09, 2014 at 10:39:27PM +0900, Masahiro Yamada wrote:
> On Thu, 5 Jun 2014 14:25:47 -0400 Tom Rini <trini@ti.com> wrote:
> > On Mon, May 19, 2014 at 02:14:03PM +0200, Luka Perkov wrote:
> > > On Fri, May 16, 2014 at 01:58:05PM -0400, Tom Rini wrote:
> > > > On Fri, May 16, 2014 at 07:26:51PM +0200, Luka Perkov wrote:
> > > > > when trying to build env with "-mfloat-abi=hard" I'm hitting this error:
> > > > > 
> > > > > /opt/openwrt/trunk/staging_dir/toolchain-arm_cortex-a9+neon_gcc-4.8-linaro_uClibc-0.9.33.2_eabi/bin/arm-openwrt-linux-uclibcgnueabi-gcc  -o tools/env/fw_printenv_unstripped tools/env/fw_env.o tools/env/fw_env_main.o tools/env/crc32.o tools/env/ctype.o tools/env/linux_string.o tools/env/env_attr.o tools/env/env_flags.o tools/env/aes.o  
> > > > > /opt/build/owrt_staging_dir/toolchain-arm_cortex-a9+neon_gcc-4.8-linaro_uClibc-0.9.33.2_eabi/bin/../lib/gcc/arm-openwrt-linux-uclibcgnueabi/4.8.3/../../../../arm-openwrt-linux-uclibcgnueabi/bin/ld: error: tools/env/fw_printenv_unstripped uses VFP register arguments, tools/env/fw_env.o does not
> > > > 
> > > > Odd.  I can build 'tools-only' with my hard float toolchain fine.  Can
> > > > you build with V=1 and see what files are perhaps not getting passed in
> > > > a -mfloat option?
> > > 
> > > The patch below fixes the problem I was having. Is that good enough for
> > > proper patch submission?
> > > 
> > > With it I am able to use replace default HOSTCFLAGS with what was
> > > defined in TARGET_CFLAGS.
> > > 
> > > Luka
> > > 
> > > diff --git a/tools/env/Makefile b/tools/env/Makefile
> > > index f5368bc..4de1d51 100644
> > > --- a/tools/env/Makefile
> > > +++ b/tools/env/Makefile
> > > @@ -10,6 +10,10 @@
> > >  # with "CC" here for the maximum code reuse of scripts/Makefile.host.
> > >  HOSTCC = $(CC)
> > >  
> > > +ifneq ($(TARGET_CFLAGS),)
> > > +HOSTCFLAGS = $(TARGET_CFLAGS)
> > > +endif
> > > +
> > >  # Compile for a hosted environment on the target
> > >  HOST_EXTRACFLAGS  = $(patsubst -I%,-idirafter%, $(UBOOTINCLUDE)) \
> > >  		-idirafter $(srctree)/tools/env \
> > 
> > This still seems odd.  Masahiro?
> 
> Looks odd to me.
> 
> According to Luka's build log,
> he is trying to compile the C sources with hard float,
> but link them against soft float library.
> 
> In my understanding,  consistency should be kept between compile and link stage
> by the compiler as is .
> We don't have to tweak HOSTCFLAGS from the outside.

Back when I was debugging this I've seen that in main Makefile this line
is defined:

HOSTCFLAGS   = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer

I needed to replace it to whatever I have defined in TARGET_CFLAGS, thus
I've proposed the patch above.

It's not a problem to keep this workaround externally, I thought others
were hitting this problem as well.

Luka
diff mbox

Patch

diff --git a/tools/env/Makefile b/tools/env/Makefile
index f5368bc..4de1d51 100644
--- a/tools/env/Makefile
+++ b/tools/env/Makefile
@@ -10,6 +10,10 @@ 
 # with "CC" here for the maximum code reuse of scripts/Makefile.host.
 HOSTCC = $(CC)
 
+ifneq ($(TARGET_CFLAGS),)
+HOSTCFLAGS = $(TARGET_CFLAGS)
+endif
+
 # Compile for a hosted environment on the target
 HOST_EXTRACFLAGS  = $(patsubst -I%,-idirafter%, $(UBOOTINCLUDE)) \
 		-idirafter $(srctree)/tools/env \