All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] Keep HOSTCFLAG and HOSTLDFLAGS consistent when Making Linux Kernel
@ 2017-07-28 23:56 Jianming.qiao
  2017-07-29 13:04 ` Thomas Petazzoni
  0 siblings, 1 reply; 3+ messages in thread
From: Jianming.qiao @ 2017-07-28 23:56 UTC (permalink / raw)
  To: buildroot

From: "Jianming.qiao" <kiki-good@hotmail.com>

A build error is spotted when adding -m32 in Linux kernel Makefile for 
both host compiler flag and Host linker flag for compiling linux kernel in 64bit Host.
When building with buildroot, an error shows the host linker can't link the .o file
generated by host compiler because -m32 host Linker flag doesn't append to the host linker, 
thereby trying to link 32 bit object files in 64bit mode(without adding -m32 in host linker flag).

Therefore,both host compiler flag and host linker flag should both appear in the LINUX_MAKE_FLAGS.

Signed-off-by: Jianming.qiao <kiki-good@hotmail.com>
---
 linux/linux.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/linux/linux.mk b/linux/linux.mk
index 032d64f..a97886d 100644
--- a/linux/linux.mk
+++ b/linux/linux.mk
@@ -97,6 +97,7 @@ endif
 LINUX_MAKE_FLAGS = \
 	HOSTCC="$(HOSTCC)" \
 	HOSTCFLAGS="$(HOSTCFLAGS)" \
+	HOSTLDFLAGS="$(HOST_LDFLAGS)" \
 	ARCH=$(KERNEL_ARCH) \
 	INSTALL_MOD_PATH=$(TARGET_DIR) \
 	CROSS_COMPILE="$(TARGET_CROSS)" \
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Buildroot] [PATCH 1/1] Keep HOSTCFLAG and HOSTLDFLAGS consistent when Making Linux Kernel
  2017-07-28 23:56 [Buildroot] [PATCH 1/1] Keep HOSTCFLAG and HOSTLDFLAGS consistent when Making Linux Kernel Jianming.qiao
@ 2017-07-29 13:04 ` Thomas Petazzoni
  2017-08-16 22:51   ` Arnout Vandecappelle
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Petazzoni @ 2017-07-29 13:04 UTC (permalink / raw)
  To: buildroot

Hello,

On Sat, 29 Jul 2017 00:56:40 +0100, Jianming.qiao wrote:
> From: "Jianming.qiao" <kiki-good@hotmail.com>
> 
> A build error is spotted when adding -m32 in Linux kernel Makefile for 
> both host compiler flag and Host linker flag for compiling linux kernel in 64bit Host.

Where are you adding this -m32 option ?

> When building with buildroot, an error shows the host linker can't link the .o file
> generated by host compiler because -m32 host Linker flag doesn't append to the host linker, 
> thereby trying to link 32 bit object files in 64bit mode(without adding -m32 in host linker flag).

Could you give more details on how to reproduce the issue you're
seeing ?

> Therefore,both host compiler flag and host linker flag should both appear in the LINUX_MAKE_FLAGS.
> 
> Signed-off-by: Jianming.qiao <kiki-good@hotmail.com>
> ---
>  linux/linux.mk | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/linux/linux.mk b/linux/linux.mk
> index 032d64f..a97886d 100644
> --- a/linux/linux.mk
> +++ b/linux/linux.mk
> @@ -97,6 +97,7 @@ endif
>  LINUX_MAKE_FLAGS = \
>  	HOSTCC="$(HOSTCC)" \
>  	HOSTCFLAGS="$(HOSTCFLAGS)" \

Unrelated to your patch, but this $(HOSTCFLAGS) thing is messy. We
actually have:

 - HOSTCFLAGS, defined in the main Makefile to the value of
   $(CFLAGS_FOR_BUILD), which is empty. HOSTCFLAGS is then exported. It
   was done this way a long time ago in commit
   c0d7d4e0355b49b489d7235e945481cf5d32087f (from 2007) for kconfig.
   I'm not sure we still need this.

 - HOST_CFLAGS, defined in package/Makefile.in, which actually contains
   some useful flags. It is most likely the one we should pass as
   HOSTCFLAGS in LINUX_MAKE_FLAGS.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Buildroot] [PATCH 1/1] Keep HOSTCFLAG and HOSTLDFLAGS consistent when Making Linux Kernel
  2017-07-29 13:04 ` Thomas Petazzoni
@ 2017-08-16 22:51   ` Arnout Vandecappelle
  0 siblings, 0 replies; 3+ messages in thread
From: Arnout Vandecappelle @ 2017-08-16 22:51 UTC (permalink / raw)
  To: buildroot



On 29-07-17 15:04, Thomas Petazzoni wrote:
> Unrelated to your patch, but this $(HOSTCFLAGS) thing is messy. We
> actually have:
> 
>  - HOSTCFLAGS, defined in the main Makefile to the value of
>    $(CFLAGS_FOR_BUILD), which is empty. HOSTCFLAGS is then exported. It
>    was done this way a long time ago in commit
>    c0d7d4e0355b49b489d7235e945481cf5d32087f (from 2007) for kconfig.
>    I'm not sure we still need this.
> 
>  - HOST_CFLAGS, defined in package/Makefile.in, which actually contains
>    some useful flags. It is most likely the one we should pass as
>    HOSTCFLAGS in LINUX_MAKE_FLAGS.

 In addition, I see no reason why we would *override* the kernel's HOSTCFLAGS.
So I think the proper fix is to do HOST_EXTRACFLAGS=$(HOST_CFLAGS) instead.

 Regards,
 Arnout

-- 
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:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-08-16 22:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-28 23:56 [Buildroot] [PATCH 1/1] Keep HOSTCFLAG and HOSTLDFLAGS consistent when Making Linux Kernel Jianming.qiao
2017-07-29 13:04 ` Thomas Petazzoni
2017-08-16 22:51   ` Arnout Vandecappelle

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.