diff mbox series

[v2,2/4] s390: boot, purgatory: pass $(CLANG_FLAGS) where needed

Message ID 20190415083605.2560074-2-arnd@arndb.de
State New
Headers show
Series [v2,1/4] s390: only build for new CPUs with clang | expand

Commit Message

Arnd Bergmann April 15, 2019, 8:35 a.m. UTC
The purgatory and boot Makefiles do not inherit the original cflags,
so clang falls back to the default target architecture when building it,
typically this would be x86 when cross-compiling.

Add $(CLANG_FLAGS) everywhere so we pass the correct --target=s390x-linux
option when cross-compiling.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>

---
 arch/s390/Makefile           | 4 ++--
 arch/s390/purgatory/Makefile | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

-- 
2.20.0

Comments

Nathan Chancellor April 15, 2019, 4:12 p.m. UTC | #1
On Mon, Apr 15, 2019 at 10:35:52AM +0200, Arnd Bergmann wrote:
> The purgatory and boot Makefiles do not inherit the original cflags,

> so clang falls back to the default target architecture when building it,

> typically this would be x86 when cross-compiling.

> 

> Add $(CLANG_FLAGS) everywhere so we pass the correct --target=s390x-linux

> option when cross-compiling.

> 

> Signed-off-by: Arnd Bergmann <arnd@arndb.de>


Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>


> ---

>  arch/s390/Makefile           | 4 ++--

>  arch/s390/purgatory/Makefile | 1 +

>  2 files changed, 3 insertions(+), 2 deletions(-)

> 

> diff --git a/arch/s390/Makefile b/arch/s390/Makefile

> index 9c079a506325..9a228786e34f 100644

> --- a/arch/s390/Makefile

> +++ b/arch/s390/Makefile

> @@ -17,9 +17,9 @@ KBUILD_CFLAGS_MODULE += -fPIC

>  KBUILD_AFLAGS	+= -m64

>  KBUILD_CFLAGS	+= -m64

>  aflags_dwarf	:= -Wa,-gdwarf-2

> -KBUILD_AFLAGS_DECOMPRESSOR := -m64 -D__ASSEMBLY__

> +KBUILD_AFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -D__ASSEMBLY__

>  KBUILD_AFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),$(aflags_dwarf))

> -KBUILD_CFLAGS_DECOMPRESSOR := -m64 -O2

> +KBUILD_CFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -O2

>  KBUILD_CFLAGS_DECOMPRESSOR += -DDISABLE_BRANCH_PROFILING -D__NO_FORTIFY

>  KBUILD_CFLAGS_DECOMPRESSOR += -fno-delete-null-pointer-checks -msoft-float

>  KBUILD_CFLAGS_DECOMPRESSOR += -fno-asynchronous-unwind-tables

> diff --git a/arch/s390/purgatory/Makefile b/arch/s390/purgatory/Makefile

> index ce6a3f75065b..ecd0b3847fef 100644

> --- a/arch/s390/purgatory/Makefile

> +++ b/arch/s390/purgatory/Makefile

> @@ -22,6 +22,7 @@ KBUILD_CFLAGS := -fno-strict-aliasing -Wall -Wstrict-prototypes

>  KBUILD_CFLAGS += -Wno-pointer-sign -Wno-sign-compare

>  KBUILD_CFLAGS += -fno-zero-initialized-in-bss -fno-builtin -ffreestanding

>  KBUILD_CFLAGS += -c -MD -Os -m64 -msoft-float -fno-common

> +KBUILD_CFLAGS += $(CLANG_FLAGS)

>  KBUILD_CFLAGS += $(call cc-option,-fno-PIE)

>  KBUILD_AFLAGS := $(filter-out -DCC_USING_EXPOLINE,$(KBUILD_AFLAGS))

>  

> -- 

> 2.20.0

>
Heiko Carstens May 3, 2019, 2:26 p.m. UTC | #2
On Mon, Apr 15, 2019 at 09:12:06AM -0700, Nathan Chancellor wrote:
> On Mon, Apr 15, 2019 at 10:35:52AM +0200, Arnd Bergmann wrote:

> > The purgatory and boot Makefiles do not inherit the original cflags,

> > so clang falls back to the default target architecture when building it,

> > typically this would be x86 when cross-compiling.

> > 

> > Add $(CLANG_FLAGS) everywhere so we pass the correct --target=s390x-linux

> > option when cross-compiling.

> > 

> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>

> 

> Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>

> 

> > ---

> >  arch/s390/Makefile           | 4 ++--

> >  arch/s390/purgatory/Makefile | 1 +

> >  2 files changed, 3 insertions(+), 2 deletions(-)


Applied, thanks.
diff mbox series

Patch

diff --git a/arch/s390/Makefile b/arch/s390/Makefile
index 9c079a506325..9a228786e34f 100644
--- a/arch/s390/Makefile
+++ b/arch/s390/Makefile
@@ -17,9 +17,9 @@  KBUILD_CFLAGS_MODULE += -fPIC
 KBUILD_AFLAGS	+= -m64
 KBUILD_CFLAGS	+= -m64
 aflags_dwarf	:= -Wa,-gdwarf-2
-KBUILD_AFLAGS_DECOMPRESSOR := -m64 -D__ASSEMBLY__
+KBUILD_AFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -D__ASSEMBLY__
 KBUILD_AFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),$(aflags_dwarf))
-KBUILD_CFLAGS_DECOMPRESSOR := -m64 -O2
+KBUILD_CFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -O2
 KBUILD_CFLAGS_DECOMPRESSOR += -DDISABLE_BRANCH_PROFILING -D__NO_FORTIFY
 KBUILD_CFLAGS_DECOMPRESSOR += -fno-delete-null-pointer-checks -msoft-float
 KBUILD_CFLAGS_DECOMPRESSOR += -fno-asynchronous-unwind-tables
diff --git a/arch/s390/purgatory/Makefile b/arch/s390/purgatory/Makefile
index ce6a3f75065b..ecd0b3847fef 100644
--- a/arch/s390/purgatory/Makefile
+++ b/arch/s390/purgatory/Makefile
@@ -22,6 +22,7 @@  KBUILD_CFLAGS := -fno-strict-aliasing -Wall -Wstrict-prototypes
 KBUILD_CFLAGS += -Wno-pointer-sign -Wno-sign-compare
 KBUILD_CFLAGS += -fno-zero-initialized-in-bss -fno-builtin -ffreestanding
 KBUILD_CFLAGS += -c -MD -Os -m64 -msoft-float -fno-common
+KBUILD_CFLAGS += $(CLANG_FLAGS)
 KBUILD_CFLAGS += $(call cc-option,-fno-PIE)
 KBUILD_AFLAGS := $(filter-out -DCC_USING_EXPOLINE,$(KBUILD_AFLAGS))