Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1672145 > unrolled thread
| Started by | Matthias Kaehlcke <mka@chromium.org> |
|---|---|
| First post | 2017-06-22 01:30 +0200 |
| Last post | 2017-06-25 06:10 +0200 |
| Articles | 4 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH v5 0/3] x86: stack alignment for boot code and clang Matthias Kaehlcke <mka@chromium.org> - 2017-06-22 01:30 +0200
[PATCH v5 1/3] kbuild: Add __cc-option macro Matthias Kaehlcke <mka@chromium.org> - 2017-06-22 01:30 +0200
Re: [PATCH v5 0/3] x86: stack alignment for boot code and clang Ingo Molnar <mingo@kernel.org> - 2017-06-22 11:00 +0200
Re: [PATCH v5 0/3] x86: stack alignment for boot code and clang Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-06-25 06:10 +0200
| From | Matthias Kaehlcke <mka@chromium.org> |
|---|---|
| Date | 2017-06-22 01:30 +0200 |
| Subject | [PATCH v5 0/3] x86: stack alignment for boot code and clang |
| Message-ID | <tUXep-4FF-3@gated-at.bofh.it> |
This series fixes an issue with the stack of the x86 boot code not being aligned as intended. Further it adapts the Makefile to account for the fact that clang uses a different option to configure the stack alignment than gcc (-mstack-alignment=N vs -mpreferred-stack-boundary=N) Collaterally the series adds the new kbuild macro __cc-option and refactors the macros cc-option and hostcc-option to make use of __cc-option. Matthias Kaehlcke (3): kbuild: Add __cc-option macro x86/build: Use __cc-option for boot code compiler options x86/build: Specify stack alignment for clang Makefile | 2 +- arch/x86/Makefile | 33 +++++++++++++++++++++++++-------- scripts/Kbuild.include | 14 ++++++++++++-- scripts/Makefile.host | 6 ------ 4 files changed, 38 insertions(+), 17 deletions(-) -- 2.13.1.611.g7e3b11ae1-goog
[toc] | [next] | [standalone]
| From | Matthias Kaehlcke <mka@chromium.org> |
|---|---|
| Date | 2017-06-22 01:30 +0200 |
| Subject | [PATCH v5 1/3] kbuild: Add __cc-option macro |
| Message-ID | <tUXeq-4FF-17@gated-at.bofh.it> |
| In reply to | #1672145 |
cc-option uses KBUILD_CFLAGS and KBUILD_CPPFLAGS when it determines whether an option is supported or not. This is fine for options used to build the kernel itself, however some components like the x86 boot code use a different set of flags. Add the new macro __cc-option which is a more generic version of cc-option with additional parameters. One parameter is the compiler with which the check should be performed, the other the compiler options to be used instead KBUILD_C*FLAGS. Refactor cc-option and hostcc-option to use __cc-option and move hostcc-option to scripts/Kbuild.include. Suggested-by: Arnd Bergmann <arnd@arndb.de> Suggested-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Matthias Kaehlcke <mka@chromium.org> Acked-by: Masahiro Yamada <yamada.masahiro@socionext.com> --- Changes in v5: - removed extra whitespace in value returned by cc-option Makefile | 2 +- scripts/Kbuild.include | 14 ++++++++++++-- scripts/Makefile.host | 6 ------ 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 83f6d9972cab..b234bba6d652 100644 --- a/Makefile +++ b/Makefile @@ -303,7 +303,7 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ HOSTCC = gcc HOSTCXX = g++ -HOSTCFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 +HOSTCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 HOSTCXXFLAGS = -O2 ifeq ($(shell $(HOSTCC) -v 2>&1 | grep -c "clang version"), 1) diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 61f87a99bf0a..b2cfa444f855 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -108,6 +108,11 @@ as-option = $(call try-run,\ as-instr = $(call try-run,\ printf "%b\n" "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -x assembler -o "$$TMP" -,$(2),$(3)) +# __cc-option +# Usage: MY_CFLAGS += $(call __cc-option,$(CC),$(MY_CFLAGS),-march=winchip-c6,-march=i586) +__cc-option = $(call try-run,\ + $(1) -Werror $(2) $(3) -c -x c /dev/null -o "$$TMP",$(3),$(4)) + # Do not attempt to build with gcc plugins during cc-option tests. # (And this uses delayed resolution so the flags will be up to date.) CC_OPTION_CFLAGS = $(filter-out $(GCC_PLUGINS_CFLAGS),$(KBUILD_CFLAGS)) @@ -115,8 +120,13 @@ CC_OPTION_CFLAGS = $(filter-out $(GCC_PLUGINS_CFLAGS),$(KBUILD_CFLAGS)) # cc-option # Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586) -cc-option = $(call try-run,\ - $(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",$(1),$(2)) +cc-option = $(call __cc-option, $(CC),\ + $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS),$(1),$(2)) + +# hostcc-option +# Usage: cflags-y += $(call hostcc-option,-march=winchip-c6,-march=i586) +hostcc-option = $(call __cc-option, $(HOSTCC),\ + $(HOSTCFLAGS) $(HOST_EXTRACFLAGS),$(1),$(2)) # cc-option-yn # Usage: flag := $(call cc-option-yn,-march=winchip-c6) diff --git a/scripts/Makefile.host b/scripts/Makefile.host index 45b5b1aaedbd..9cfd5c84d76f 100644 --- a/scripts/Makefile.host +++ b/scripts/Makefile.host @@ -20,12 +20,6 @@ # Will compile qconf as a C++ program, and menu as a C program. # They are linked as C++ code to the executable qconf -# hostcc-option -# Usage: cflags-y += $(call hostcc-option,-march=winchip-c6,-march=i586) - -hostcc-option = $(call try-run,\ - $(HOSTCC) $(HOSTCFLAGS) $(HOST_EXTRACFLAGS) $(1) -c -x c /dev/null -o "$$TMP",$(1),$(2)) - __hostprogs := $(sort $(hostprogs-y) $(hostprogs-m)) host-cshlib := $(sort $(hostlibs-y) $(hostlibs-m)) host-cxxshlib := $(sort $(hostcxxlibs-y) $(hostcxxlibs-m)) -- 2.13.1.611.g7e3b11ae1-goog
[toc] | [prev] | [next] | [standalone]
| From | Ingo Molnar <mingo@kernel.org> |
|---|---|
| Date | 2017-06-22 11:00 +0200 |
| Message-ID | <tV682-2hR-15@gated-at.bofh.it> |
| In reply to | #1672145 |
* Matthias Kaehlcke <mka@chromium.org> wrote: > This series fixes an issue with the stack of the x86 boot code not > being aligned as intended. Further it adapts the Makefile to account > for the fact that clang uses a different option to configure the > stack alignment than gcc (-mstack-alignment=N vs > -mpreferred-stack-boundary=N) > > Collaterally the series adds the new kbuild macro __cc-option and > refactors the macros cc-option and hostcc-option to make use of > __cc-option. > > Matthias Kaehlcke (3): > kbuild: Add __cc-option macro > x86/build: Use __cc-option for boot code compiler options > x86/build: Specify stack alignment for clang > > Makefile | 2 +- > arch/x86/Makefile | 33 +++++++++++++++++++++++++-------- > scripts/Kbuild.include | 14 ++++++++++++-- > scripts/Makefile.host | 6 ------ > 4 files changed, 38 insertions(+), 17 deletions(-) So given that there are non-trivial kbuild changes here, I'd suggest these patches might have a better home in the kbuild tree. For the x86 bits: Acked-by: Ingo Molnar <mingo@kernel.org> Thanks, Ingo
[toc] | [prev] | [next] | [standalone]
| From | Masahiro Yamada <yamada.masahiro@socionext.com> |
|---|---|
| Date | 2017-06-25 06:10 +0200 |
| Message-ID | <tW722-eq-11@gated-at.bofh.it> |
| In reply to | #1672434 |
2017-06-22 17:58 GMT+09:00 Ingo Molnar <mingo@kernel.org>: > > * Matthias Kaehlcke <mka@chromium.org> wrote: > >> This series fixes an issue with the stack of the x86 boot code not >> being aligned as intended. Further it adapts the Makefile to account >> for the fact that clang uses a different option to configure the >> stack alignment than gcc (-mstack-alignment=N vs >> -mpreferred-stack-boundary=N) >> >> Collaterally the series adds the new kbuild macro __cc-option and >> refactors the macros cc-option and hostcc-option to make use of >> __cc-option. >> >> Matthias Kaehlcke (3): >> kbuild: Add __cc-option macro >> x86/build: Use __cc-option for boot code compiler options >> x86/build: Specify stack alignment for clang >> >> Makefile | 2 +- >> arch/x86/Makefile | 33 +++++++++++++++++++++++++-------- >> scripts/Kbuild.include | 14 ++++++++++++-- >> scripts/Makefile.host | 6 ------ >> 4 files changed, 38 insertions(+), 17 deletions(-) > > So given that there are non-trivial kbuild changes here, I'd suggest these patches > might have a better home in the kbuild tree. For the x86 bits: > > Acked-by: Ingo Molnar <mingo@kernel.org> > > Thanks, > > Ingo > -- > To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html Series applied to linux-kbuild/kbuild. -- Best Regards Masahiro Yamada
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web