linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] powerpc/boot: Fix cross compiling with clang
@ 2018-11-12  4:21 Joel Stanley
  2018-11-12  4:21 ` [PATCH v2 1/2] Makefile: Export clang toolchain variables Joel Stanley
  2018-11-12  4:21 ` [PATCH v2 2/2] powerpc/boot: Set target when cross-compiling for clang Joel Stanley
  0 siblings, 2 replies; 9+ messages in thread
From: Joel Stanley @ 2018-11-12  4:21 UTC (permalink / raw)
  To: Masahiro Yamada, Michael Ellerman
  Cc: Michal Marek, Daniel Axtens, Nick Desaulniers, linux-kbuild,
	linux-kernel, linuxppc-dev

v2: rebase on "kbuild: consolidate Clang compiler flags"

These patches allow clang to cross-compile the powerpc boot wrapper.
The boot wrapper constructs it's own compiler flags as it may not be
built for the same arch as the kernel.

The powerpc64le kernel builds natively with clang and with this patch it
can cross compile too.

Joel Stanley (2):
  Makefile: Export clang toolchain variables
  powerpc/boot: Set target when cross-compiling for clang

 Makefile                   | 1 +
 arch/powerpc/boot/Makefile | 5 +++++
 2 files changed, 6 insertions(+)

-- 
2.19.1


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

* [PATCH v2 1/2] Makefile: Export clang toolchain variables
  2018-11-12  4:21 [PATCH v2 0/2] powerpc/boot: Fix cross compiling with clang Joel Stanley
@ 2018-11-12  4:21 ` Joel Stanley
  2018-11-12 18:55   ` Nick Desaulniers
  2018-11-13 23:34   ` Masahiro Yamada
  2018-11-12  4:21 ` [PATCH v2 2/2] powerpc/boot: Set target when cross-compiling for clang Joel Stanley
  1 sibling, 2 replies; 9+ messages in thread
From: Joel Stanley @ 2018-11-12  4:21 UTC (permalink / raw)
  To: Masahiro Yamada, Michael Ellerman
  Cc: Michal Marek, Daniel Axtens, Nick Desaulniers, linux-kbuild,
	linux-kernel, linuxppc-dev

The powerpc makefile will use these in it's boot wrapper.

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Makefile b/Makefile
index 09278330282d..840efe6eb54c 100644
--- a/Makefile
+++ b/Makefile
@@ -495,6 +495,7 @@ endif
 ifneq ($(GCC_TOOLCHAIN),)
 CLANG_FLAGS	+= --gcc-toolchain=$(GCC_TOOLCHAIN)
 endif
+export CLANG_FLAGS
 CLANG_FLAGS	+= -no-integrated-as
 KBUILD_CFLAGS	+= $(CLANG_FLAGS)
 KBUILD_AFLAGS	+= $(CLANG_FLAGS)
-- 
2.19.1


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

* [PATCH v2 2/2] powerpc/boot: Set target when cross-compiling for clang
  2018-11-12  4:21 [PATCH v2 0/2] powerpc/boot: Fix cross compiling with clang Joel Stanley
  2018-11-12  4:21 ` [PATCH v2 1/2] Makefile: Export clang toolchain variables Joel Stanley
@ 2018-11-12  4:21 ` Joel Stanley
  2018-11-12 11:14   ` Michael Ellerman
  2018-11-12 19:03   ` Nick Desaulniers
  1 sibling, 2 replies; 9+ messages in thread
From: Joel Stanley @ 2018-11-12  4:21 UTC (permalink / raw)
  To: Masahiro Yamada, Michael Ellerman
  Cc: Michal Marek, Daniel Axtens, Nick Desaulniers, linux-kbuild,
	linux-kernel, linuxppc-dev

Clang needs to be told which target it is building for when cross
compiling.

Link: https://github.com/ClangBuiltLinux/linux/issues/259
Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 arch/powerpc/boot/Makefile | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 39354365f54a..111f97b1ccec 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -55,6 +55,11 @@ BOOTAFLAGS	:= -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc
 
 BOOTARFLAGS	:= -cr$(KBUILD_ARFLAGS)
 
+ifdef CONFIG_CC_IS_CLANG
+BOOTCFLAGS += $(CLANG_FLAGS)
+BOOTAFLAGS += $(CLANG_FLAGS)
+endif
+
 ifdef CONFIG_DEBUG_INFO
 BOOTCFLAGS	+= -g
 endif
-- 
2.19.1


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

* Re: [PATCH v2 2/2] powerpc/boot: Set target when cross-compiling for clang
  2018-11-12  4:21 ` [PATCH v2 2/2] powerpc/boot: Set target when cross-compiling for clang Joel Stanley
@ 2018-11-12 11:14   ` Michael Ellerman
  2018-11-12 19:03   ` Nick Desaulniers
  1 sibling, 0 replies; 9+ messages in thread
From: Michael Ellerman @ 2018-11-12 11:14 UTC (permalink / raw)
  To: Joel Stanley, Masahiro Yamada
  Cc: Michal Marek, Daniel Axtens, Nick Desaulniers, linux-kbuild,
	linux-kernel, linuxppc-dev

Joel Stanley <joel@jms.id.au> writes:

> Clang needs to be told which target it is building for when cross
> compiling.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/259
> Signed-off-by: Joel Stanley <joel@jms.id.au>
> ---
>  arch/powerpc/boot/Makefile | 5 +++++
>  1 file changed, 5 insertions(+)

Acked-by: Michael Ellerman <mpe@ellerman.id.au>

cheers

> diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
> index 39354365f54a..111f97b1ccec 100644
> --- a/arch/powerpc/boot/Makefile
> +++ b/arch/powerpc/boot/Makefile
> @@ -55,6 +55,11 @@ BOOTAFLAGS	:= -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc
>  
>  BOOTARFLAGS	:= -cr$(KBUILD_ARFLAGS)
>  
> +ifdef CONFIG_CC_IS_CLANG
> +BOOTCFLAGS += $(CLANG_FLAGS)
> +BOOTAFLAGS += $(CLANG_FLAGS)
> +endif
> +
>  ifdef CONFIG_DEBUG_INFO
>  BOOTCFLAGS	+= -g
>  endif
> -- 
> 2.19.1

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

* Re: [PATCH v2 1/2] Makefile: Export clang toolchain variables
  2018-11-12  4:21 ` [PATCH v2 1/2] Makefile: Export clang toolchain variables Joel Stanley
@ 2018-11-12 18:55   ` Nick Desaulniers
  2018-11-13  5:16     ` Masahiro Yamada
  2018-11-13 23:34   ` Masahiro Yamada
  1 sibling, 1 reply; 9+ messages in thread
From: Nick Desaulniers @ 2018-11-12 18:55 UTC (permalink / raw)
  To: joel
  Cc: Masahiro Yamada, mpe, Michal Marek, dja,
	Linux Kbuild mailing list, LKML, linuxppc-dev

On Sun, Nov 11, 2018 at 8:21 PM Joel Stanley <joel@jms.id.au> wrote:
>
> The powerpc makefile will use these in it's boot wrapper.
>
> Signed-off-by: Joel Stanley <joel@jms.id.au>
> ---
>  Makefile | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/Makefile b/Makefile
> index 09278330282d..840efe6eb54c 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -495,6 +495,7 @@ endif
>  ifneq ($(GCC_TOOLCHAIN),)
>  CLANG_FLAGS    += --gcc-toolchain=$(GCC_TOOLCHAIN)
>  endif
> +export CLANG_FLAGS
>  CLANG_FLAGS    += -no-integrated-as

Does this export CLANG_FLAGS before `-no-integrated-as` is set?
Either way, I think it would be clearer to export this after all the
relevant flags are set.

>  KBUILD_CFLAGS  += $(CLANG_FLAGS)
>  KBUILD_AFLAGS  += $(CLANG_FLAGS)
> --
> 2.19.1
>


-- 
Thanks,
~Nick Desaulniers

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

* Re: [PATCH v2 2/2] powerpc/boot: Set target when cross-compiling for clang
  2018-11-12  4:21 ` [PATCH v2 2/2] powerpc/boot: Set target when cross-compiling for clang Joel Stanley
  2018-11-12 11:14   ` Michael Ellerman
@ 2018-11-12 19:03   ` Nick Desaulniers
  2018-11-13 23:25     ` Masahiro Yamada
  1 sibling, 1 reply; 9+ messages in thread
From: Nick Desaulniers @ 2018-11-12 19:03 UTC (permalink / raw)
  To: joel
  Cc: Masahiro Yamada, mpe, Michal Marek, dja,
	Linux Kbuild mailing list, LKML, linuxppc-dev

On Sun, Nov 11, 2018 at 8:21 PM Joel Stanley <joel@jms.id.au> wrote:
>
> Clang needs to be told which target it is building for when cross
> compiling.

Neat! This will help us for continuous integration.
https://github.com/ClangBuiltLinux/continuous-integration

>
> Link: https://github.com/ClangBuiltLinux/linux/issues/259
> Signed-off-by: Joel Stanley <joel@jms.id.au>

Assuming patch 1/2 gets fixed up (or is fine) and doesn't radically change:
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

> ---
>  arch/powerpc/boot/Makefile | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
> index 39354365f54a..111f97b1ccec 100644
> --- a/arch/powerpc/boot/Makefile
> +++ b/arch/powerpc/boot/Makefile
> @@ -55,6 +55,11 @@ BOOTAFLAGS   := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc
>
>  BOOTARFLAGS    := -cr$(KBUILD_ARFLAGS)
>
> +ifdef CONFIG_CC_IS_CLANG
> +BOOTCFLAGS += $(CLANG_FLAGS)
> +BOOTAFLAGS += $(CLANG_FLAGS)
> +endif
> +
>  ifdef CONFIG_DEBUG_INFO
>  BOOTCFLAGS     += -g
>  endif
> --
> 2.19.1
>


-- 
Thanks,
~Nick Desaulniers

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

* Re: [PATCH v2 1/2] Makefile: Export clang toolchain variables
  2018-11-12 18:55   ` Nick Desaulniers
@ 2018-11-13  5:16     ` Masahiro Yamada
  0 siblings, 0 replies; 9+ messages in thread
From: Masahiro Yamada @ 2018-11-13  5:16 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Joel Stanley, Michael Ellerman, Michal Marek, dja,
	Linux Kbuild mailing list, Linux Kernel Mailing List,
	linuxppc-dev

On Tue, Nov 13, 2018 at 3:56 AM Nick Desaulniers
<ndesaulniers@google.com> wrote:
>
> On Sun, Nov 11, 2018 at 8:21 PM Joel Stanley <joel@jms.id.au> wrote:
> >
> > The powerpc makefile will use these in it's boot wrapper.
> >
> > Signed-off-by: Joel Stanley <joel@jms.id.au>
> > ---
> >  Makefile | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/Makefile b/Makefile
> > index 09278330282d..840efe6eb54c 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -495,6 +495,7 @@ endif
> >  ifneq ($(GCC_TOOLCHAIN),)
> >  CLANG_FLAGS    += --gcc-toolchain=$(GCC_TOOLCHAIN)
> >  endif
> > +export CLANG_FLAGS
> >  CLANG_FLAGS    += -no-integrated-as
>
> Does this export CLANG_FLAGS before `-no-integrated-as` is set?

This does not matter.

For example, KBUILD_CFLAGS accumulates several compiler flags
after it is marked as 'export'.


> Either way, I think it would be clearer to export this after all the
> relevant flags are set.

OK. It is just a matter of preference,
but I will move the export line below
when I pick up this patch set.



> >  KBUILD_CFLAGS  += $(CLANG_FLAGS)
> >  KBUILD_AFLAGS  += $(CLANG_FLAGS)
> > --
> > 2.19.1
> >
>
>
> --
> Thanks,
> ~Nick Desaulniers



-- 
Best Regards
Masahiro Yamada

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

* Re: [PATCH v2 2/2] powerpc/boot: Set target when cross-compiling for clang
  2018-11-12 19:03   ` Nick Desaulniers
@ 2018-11-13 23:25     ` Masahiro Yamada
  0 siblings, 0 replies; 9+ messages in thread
From: Masahiro Yamada @ 2018-11-13 23:25 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Joel Stanley, Michael Ellerman, Michal Marek, dja,
	Linux Kbuild mailing list, Linux Kernel Mailing List,
	linuxppc-dev

On Tue, Nov 13, 2018 at 4:03 AM Nick Desaulniers
<ndesaulniers@google.com> wrote:
>
> On Sun, Nov 11, 2018 at 8:21 PM Joel Stanley <joel@jms.id.au> wrote:
> >
> > Clang needs to be told which target it is building for when cross
> > compiling.
>
> Neat! This will help us for continuous integration.
> https://github.com/ClangBuiltLinux/continuous-integration
>
> >
> > Link: https://github.com/ClangBuiltLinux/linux/issues/259
> > Signed-off-by: Joel Stanley <joel@jms.id.au>
>
> Assuming patch 1/2 gets fixed up (or is fine) and doesn't radically change:
> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
>



Applied to linux-kbuild.
Thanks!



> > ---
> >  arch/powerpc/boot/Makefile | 5 +++++
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
> > index 39354365f54a..111f97b1ccec 100644
> > --- a/arch/powerpc/boot/Makefile
> > +++ b/arch/powerpc/boot/Makefile
> > @@ -55,6 +55,11 @@ BOOTAFLAGS   := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc
> >
> >  BOOTARFLAGS    := -cr$(KBUILD_ARFLAGS)
> >
> > +ifdef CONFIG_CC_IS_CLANG
> > +BOOTCFLAGS += $(CLANG_FLAGS)
> > +BOOTAFLAGS += $(CLANG_FLAGS)
> > +endif
> > +
> >  ifdef CONFIG_DEBUG_INFO
> >  BOOTCFLAGS     += -g
> >  endif
> > --
> > 2.19.1
> >
>
>
> --
> Thanks,
> ~Nick Desaulniers



-- 
Best Regards
Masahiro Yamada

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

* Re: [PATCH v2 1/2] Makefile: Export clang toolchain variables
  2018-11-12  4:21 ` [PATCH v2 1/2] Makefile: Export clang toolchain variables Joel Stanley
  2018-11-12 18:55   ` Nick Desaulniers
@ 2018-11-13 23:34   ` Masahiro Yamada
  1 sibling, 0 replies; 9+ messages in thread
From: Masahiro Yamada @ 2018-11-13 23:34 UTC (permalink / raw)
  To: Joel Stanley
  Cc: Michael Ellerman, Michal Marek, dja, Nick Desaulniers,
	Linux Kbuild mailing list, Linux Kernel Mailing List,
	linuxppc-dev

On Mon, Nov 12, 2018 at 1:21 PM Joel Stanley <joel@jms.id.au> wrote:
>
> The powerpc makefile will use these in it's boot wrapper.
>
> Signed-off-by: Joel Stanley <joel@jms.id.au>
> ---


Applied to linux-kbuild.
Thanks!


>  Makefile | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/Makefile b/Makefile
> index 09278330282d..840efe6eb54c 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -495,6 +495,7 @@ endif
>  ifneq ($(GCC_TOOLCHAIN),)
>  CLANG_FLAGS    += --gcc-toolchain=$(GCC_TOOLCHAIN)
>  endif
> +export CLANG_FLAGS
>  CLANG_FLAGS    += -no-integrated-as
>  KBUILD_CFLAGS  += $(CLANG_FLAGS)
>  KBUILD_AFLAGS  += $(CLANG_FLAGS)
> --
> 2.19.1
>


-- 
Best Regards
Masahiro Yamada

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

end of thread, other threads:[~2018-11-13 23:35 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-12  4:21 [PATCH v2 0/2] powerpc/boot: Fix cross compiling with clang Joel Stanley
2018-11-12  4:21 ` [PATCH v2 1/2] Makefile: Export clang toolchain variables Joel Stanley
2018-11-12 18:55   ` Nick Desaulniers
2018-11-13  5:16     ` Masahiro Yamada
2018-11-13 23:34   ` Masahiro Yamada
2018-11-12  4:21 ` [PATCH v2 2/2] powerpc/boot: Set target when cross-compiling for clang Joel Stanley
2018-11-12 11:14   ` Michael Ellerman
2018-11-12 19:03   ` Nick Desaulniers
2018-11-13 23:25     ` Masahiro Yamada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).