2012-05-05 08:06:48

by Sam Ravnborg

[permalink] [raw]
Subject: [PATCH 0/8] kbuild: use script for final link, move definitions out of top-level Makefile

Hi Michal, all.

o Move the link of vmlinux from top-level Makefile to a script.
This increased the readability a lot.
They have had a few rounds of reviews and are ready.

o Move a lot of definitions from top-level Makefile to
two new files located in scripts/

o Fix so we do not call CC too often when using W=...

o Fix so KCFLAGS (and friends) are added last to the
command lines.

Patches 1-4 are ready to be applied.
Patches 5-8 are new and may raise a few comments.

All patches are on top of 3.4-rc5.

Sam

Documentation/kbuild/kbuild.txt | 19 ++
Makefile | 389 ++------------------------------------
arch/sparc/Makefile | 11 -
arch/sparc/boot/Makefile | 14 +-
arch/um/Makefile | 11 +-
scripts/Kbuild.arch | 148 +++++++++++++++
scripts/Kbuild.config | 68 +++++++
scripts/Makefile.build | 51 -----
scripts/link-vmlinux.sh | 211 +++++++++++++++++++++
9 files changed, 478 insertions(+), 444 deletions(-)

Artem Bityutskiy (1):
kbuild: remove useless warning

Sam Ravnborg (7):
kbuild: drop unused KBUILD_VMLINUX_OBJS from top-level Makefile
kbuild: refactor final link of sparc32
kbuild: link of vmlinux moved to a script
kbuild: document KBUILD_LDS, KBUILD_VMLINUX_{INIT,MAIN} and LDFLAGS_vmlinux
kbuild: move definitions from top-level Makefile to scripts/Kbuild.config
kbuild: move arch definitions from top-level Makefile to scripts/Kbuild.arch
kbuild: move W=... stuff to Kbuild.arch


2012-05-05 08:18:51

by Sam Ravnborg

[permalink] [raw]
Subject: [PATCH 1/8] kbuild: drop unused KBUILD_VMLINUX_OBJS from top-level Makefile

Signed-off-by: Sam Ravnborg <[email protected]>
---
Makefile | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index a06ee9f..1af1b7a 100644
--- a/Makefile
+++ b/Makefile
@@ -758,7 +758,6 @@ vmlinux-init := $(head-y) $(init-y)
vmlinux-main := $(core-y) $(libs-y) $(drivers-y) $(net-y)
vmlinux-all := $(vmlinux-init) $(vmlinux-main)
vmlinux-lds := arch/$(SRCARCH)/kernel/vmlinux.lds
-export KBUILD_VMLINUX_OBJS := $(vmlinux-all)

# Rule to link vmlinux - also used during CONFIG_KALLSYMS
# May be overridden by arch/$(ARCH)/Makefile
--
1.6.0.6

2012-05-05 08:20:04

by Sam Ravnborg

[permalink] [raw]
Subject: [PATCH 3/8] kbuild: link of vmlinux moved to a script

Move the final link of vmlinux to a script to improve
readability and maintainability of the code.

The Makefile fragments used to link vmlinux has over the
years seen far too many changes and the logic had become
hard to follow.

As the process by nature is serialized there was
nothing gained including this in the Makefile.

"um" has special link requirments - and the
only way to handle this was to hard-code the linking
of "um" in the script.
This was better than trying to modularize it only for the
benefit of "um" anyway.

The shell script has been improved after input from:
Arnaud Lacombe <[email protected]>
Nick Bowler <[email protected]>

Signed-off-by: Sam Ravnborg <[email protected]>
Cc: Arnaud Lacombe <[email protected]>
Cc: Nick Bowler <[email protected]>
Cc: Richard Weinberger <[email protected]>
---
Makefile | 215 +++--------------------------------------------
arch/um/Makefile | 11 +--
scripts/link-vmlinux.sh | 211 ++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 225 insertions(+), 212 deletions(-)
create mode 100644 scripts/link-vmlinux.sh

diff --git a/Makefile b/Makefile
index 20b0232..41bc36e 100644
--- a/Makefile
+++ b/Makefile
@@ -341,7 +341,6 @@ AWK = awk
GENKSYMS = scripts/genksyms/genksyms
INSTALLKERNEL := installkernel
DEPMOD = /sbin/depmod
-KALLSYMS = scripts/kallsyms
PERL = perl
CHECK = sparse

@@ -727,191 +726,21 @@ libs-y1 := $(patsubst %/, %/lib.a, $(libs-y))
libs-y2 := $(patsubst %/, %/built-in.o, $(libs-y))
libs-y := $(libs-y1) $(libs-y2)

-# externally visible symbols
+# Externally visible symbols (used by link-vmlinux.sh)
export KBUILD_VMLINUX_INIT := $(head-y) $(init-y)
export KBUILD_VMLINUX_MAIN := $(core-y) $(libs-y) $(drivers-y) $(net-y)
export KBUILD_LDS := arch/$(SRCARCH)/kernel/vmlinux.lds
+export LDFLAGS_vmlinux

-# Build vmlinux
-# ---------------------------------------------------------------------------
-# vmlinux is built from the objects selected by $(vmlinux-init) and
-# $(vmlinux-main). Most are built-in.o files from top-level directories
-# in the kernel tree, others are specified in arch/$(ARCH)/Makefile.
-# Ordering when linking is important, and $(vmlinux-init) must be first.
-#
-# vmlinux
-# ^
-# |
-# +-< $(vmlinux-init)
-# | +--< init/version.o + more
-# |
-# +--< $(vmlinux-main)
-# | +--< driver/built-in.o mm/built-in.o + more
-# |
-# +-< kallsyms.o (see description in CONFIG_KALLSYMS section)
-#
-# vmlinux version (uname -v) cannot be updated during normal
-# descending-into-subdirs phase since we do not yet know if we need to
-# update vmlinux.
-# Therefore this step is delayed until just before final link of vmlinux -
-# except in the kallsyms case where it is done just before adding the
-# symbols to the kernel.
-#
-# System.map is generated to document addresses of all kernel symbols
-
-vmlinux-init := $(head-y) $(init-y)
-vmlinux-main := $(core-y) $(libs-y) $(drivers-y) $(net-y)
-vmlinux-all := $(vmlinux-init) $(vmlinux-main)
-vmlinux-lds := arch/$(SRCARCH)/kernel/vmlinux.lds
-
-# Rule to link vmlinux - also used during CONFIG_KALLSYMS
-# May be overridden by arch/$(ARCH)/Makefile
-quiet_cmd_vmlinux__ ?= LD $@
- cmd_vmlinux__ ?= $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) -o $@ \
- -T $(vmlinux-lds) $(vmlinux-init) \
- --start-group $(vmlinux-main) --end-group \
- $(filter-out $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) vmlinux.o FORCE ,$^)
-
-# Generate new vmlinux version
-quiet_cmd_vmlinux_version = GEN .version
- cmd_vmlinux_version = set -e; \
- if [ ! -r .version ]; then \
- rm -f .version; \
- echo 1 >.version; \
- else \
- mv .version .old_version; \
- expr 0$$(cat .old_version) + 1 >.version; \
- fi; \
- $(MAKE) $(build)=init
-
-# Generate System.map
-quiet_cmd_sysmap = SYSMAP
- cmd_sysmap = $(CONFIG_SHELL) $(srctree)/scripts/mksysmap
-
-# Link of vmlinux
-# If CONFIG_KALLSYMS is set .version is already updated
-# Generate System.map and verify that the content is consistent
-# Use + in front of the vmlinux_version rule to silent warning with make -j2
-# First command is ':' to allow us to use + in front of the rule
-define rule_vmlinux__
- :
- $(if $(CONFIG_KALLSYMS),,+$(call cmd,vmlinux_version))
-
- $(call cmd,vmlinux__)
- $(Q)echo 'cmd_$@ := $(cmd_vmlinux__)' > $(@D)/.$(@F).cmd
-
- $(Q)$(if $($(quiet)cmd_sysmap), \
- echo ' $($(quiet)cmd_sysmap) System.map' &&) \
- $(cmd_sysmap) $@ System.map; \
- if [ $$? -ne 0 ]; then \
- rm -f $@; \
- /bin/false; \
- fi;
- $(verify_kallsyms)
-endef
-
-
-ifdef CONFIG_KALLSYMS
-# Generate section listing all symbols and add it into vmlinux $(kallsyms.o)
-# It's a three stage process:
-# o .tmp_vmlinux1 has all symbols and sections, but __kallsyms is
-# empty
-# Running kallsyms on that gives us .tmp_kallsyms1.o with
-# the right size - vmlinux version (uname -v) is updated during this step
-# o .tmp_vmlinux2 now has a __kallsyms section of the right size,
-# but due to the added section, some addresses have shifted.
-# From here, we generate a correct .tmp_kallsyms2.o
-# o The correct .tmp_kallsyms2.o is linked into the final vmlinux.
-# o Verify that the System.map from vmlinux matches the map from
-# .tmp_vmlinux2, just in case we did not generate kallsyms correctly.
-# o If 'make KALLSYMS_EXTRA_PASS=1" was used, do an extra pass using
-# .tmp_vmlinux3 and .tmp_kallsyms3.o. This is only meant as a
-# temporary bypass to allow the kernel to be built while the
-# maintainers work out what went wrong with kallsyms.
-
-last_kallsyms := 2
-
-ifdef KALLSYMS_EXTRA_PASS
-ifneq ($(KALLSYMS_EXTRA_PASS),0)
-last_kallsyms := 3
-endif
-endif
-
-kallsyms.o := .tmp_kallsyms$(last_kallsyms).o
-
-define verify_kallsyms
- $(Q)$(if $($(quiet)cmd_sysmap), \
- echo ' $($(quiet)cmd_sysmap) .tmp_System.map' &&) \
- $(cmd_sysmap) .tmp_vmlinux$(last_kallsyms) .tmp_System.map
- $(Q)cmp -s System.map .tmp_System.map || \
- (echo Inconsistent kallsyms data; \
- echo This is a bug - please report about it; \
- echo Try "make KALLSYMS_EXTRA_PASS=1" as a workaround; \
- rm .tmp_kallsyms* ; /bin/false )
-endef
-
-# Update vmlinux version before link
-# Use + in front of this rule to silent warning about make -j1
-# First command is ':' to allow us to use + in front of this rule
-cmd_ksym_ld = $(cmd_vmlinux__)
-define rule_ksym_ld
- :
- +$(call cmd,vmlinux_version)
- $(call cmd,vmlinux__)
- $(Q)echo 'cmd_$@ := $(cmd_vmlinux__)' > $(@D)/.$(@F).cmd
-endef
-
-# Generate .S file with all kernel symbols
-quiet_cmd_kallsyms = KSYM $@
- cmd_kallsyms = $(NM) -n $< | $(KALLSYMS) \
- $(if $(CONFIG_KALLSYMS_ALL),--all-symbols) > $@
-
-.tmp_kallsyms1.o .tmp_kallsyms2.o .tmp_kallsyms3.o: %.o: %.S scripts FORCE
- $(call if_changed_dep,as_o_S)
+vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_INIT) $(KBUILD_VMLINUX_MAIN)

-.tmp_kallsyms%.S: .tmp_vmlinux% $(KALLSYMS)
- $(call cmd,kallsyms)
+# Final link of vmlinux
+ cmd_link-vmlinux = $(CONFIG_SHELL) $< $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux)
+quiet_cmd_link-vmlinux = LINK $@

-# .tmp_vmlinux1 must be complete except kallsyms, so update vmlinux version
-.tmp_vmlinux1: $(vmlinux-lds) $(vmlinux-all) FORCE
- $(call if_changed_rule,ksym_ld)
-
-.tmp_vmlinux2: $(vmlinux-lds) $(vmlinux-all) .tmp_kallsyms1.o FORCE
- $(call if_changed,vmlinux__)
-
-.tmp_vmlinux3: $(vmlinux-lds) $(vmlinux-all) .tmp_kallsyms2.o FORCE
- $(call if_changed,vmlinux__)
-
-# Needs to visit scripts/ before $(KALLSYMS) can be used.
-$(KALLSYMS): scripts ;
-
-# Generate some data for debugging strange kallsyms problems
-debug_kallsyms: .tmp_map$(last_kallsyms)
-
-.tmp_map%: .tmp_vmlinux% FORCE
- ($(OBJDUMP) -h $< | $(AWK) '/^ +[0-9]/{print $$4 " 0 " $$2}'; $(NM) $<) | sort > $@
-
-.tmp_map3: .tmp_map2
-
-.tmp_map2: .tmp_map1
-
-endif # ifdef CONFIG_KALLSYMS
-
-# Do modpost on a prelinked vmlinux. The finally linked vmlinux has
-# relevant sections renamed as per the linker script.
-quiet_cmd_vmlinux-modpost = LD $@
- cmd_vmlinux-modpost = $(LD) $(LDFLAGS) -r -o $@ \
- $(vmlinux-init) --start-group $(vmlinux-main) --end-group \
- $(filter-out $(vmlinux-init) $(vmlinux-main) FORCE ,$^)
-define rule_vmlinux-modpost
- :
- +$(call cmd,vmlinux-modpost)
- $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost $@
- $(Q)echo 'cmd_$@ := $(cmd_vmlinux-modpost)' > $(dot-target).cmd
-endef
-
-# vmlinux image - including updated kernel symbols
-vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) vmlinux.o $(kallsyms.o) FORCE
+# Include targets which we want to
+# execute if the rest of the kernel build went well.
+vmlinux: scripts/link-vmlinux.sh $(vmlinux-deps) FORCE
ifdef CONFIG_HEADERS_CHECK
$(Q)$(MAKE) -f $(srctree)/Makefile headers_check
endif
@@ -921,22 +750,11 @@ endif
ifdef CONFIG_BUILD_DOCSRC
$(Q)$(MAKE) $(build)=Documentation
endif
- $(call vmlinux-modpost)
- $(call if_changed_rule,vmlinux__)
- $(Q)rm -f .old_version
-
-# build vmlinux.o first to catch section mismatch errors early
-ifdef CONFIG_KALLSYMS
-.tmp_vmlinux1: vmlinux.o
-endif
-
-modpost-init := $(filter-out init/built-in.o, $(vmlinux-init))
-vmlinux.o: $(modpost-init) $(vmlinux-main) FORCE
- $(call if_changed_rule,vmlinux-modpost)
+ +$(call if_changed,link-vmlinux)

# The actual objects are generated when descending,
# make sure no implicit rule kicks in
-$(sort $(vmlinux-init) $(vmlinux-main)) $(vmlinux-lds): $(vmlinux-dirs) ;
+$(sort $(vmlinux-deps)): $(vmlinux-dirs) ;

# Handle descending into subdirectories listed in $(vmlinux-dirs)
# Preset locale variables to speed up the build process. Limit locale
@@ -1160,8 +978,6 @@ endif # CONFIG_MODULES

# Directories & files removed with 'make clean'
CLEAN_DIRS += $(MODVERDIR)
-CLEAN_FILES += vmlinux System.map \
- .tmp_kallsyms* .tmp_version .tmp_vmlinux* .tmp_System.map

# Directories & files removed with 'make mrproper'
MRPROPER_DIRS += include/config usr/include include/generated \
@@ -1407,6 +1223,7 @@ scripts: ;
endif # KBUILD_EXTMOD

clean: $(clean-dirs)
+ $(Q)$(CONFIG_SHELL) $(srctree)/scripts/link-vmlinux.sh clean
$(call cmd,rmdirs)
$(call cmd,rmfiles)
@find $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \
@@ -1540,14 +1357,6 @@ quiet_cmd_depmod = DEPMOD $(KERNELRELEASE)
cmd_crmodverdir = $(Q)mkdir -p $(MODVERDIR) \
$(if $(KBUILD_MODULES),; rm -f $(MODVERDIR)/*)

-a_flags = -Wp,-MD,$(depfile) $(KBUILD_AFLAGS) $(AFLAGS_KERNEL) \
- $(KBUILD_AFLAGS_KERNEL) \
- $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(KBUILD_CPPFLAGS) \
- $(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(basetarget).o)
-
-quiet_cmd_as_o_S = AS $@
-cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $<
-
# read all saved command lines

targets := $(wildcard $(sort $(targets)))
diff --git a/arch/um/Makefile b/arch/um/Makefile
index 55c0661..0970910 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -121,15 +121,8 @@ LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc

LD_FLAGS_CMDLINE = $(foreach opt,$(LDFLAGS),-Wl,$(opt))

-CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS) $(LD_FLAGS_CMDLINE)
-define cmd_vmlinux__
- $(CC) $(CFLAGS_vmlinux) -o $@ \
- -Wl,-T,$(vmlinux-lds) $(vmlinux-init) \
- -Wl,--start-group $(vmlinux-main) -Wl,--end-group \
- -lutil \
- $(filter-out $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) vmlinux.o \
- FORCE ,$^) ; rm -f linux
-endef
+# Used by link-vmlinux.sh which has special support for um link
+export CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS) $(LD_FLAGS_CMDLINE)

# When cleaning we don't include .config, so we don't include
# TT or skas makefiles and don't clean skas_ptregs.h.
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
new file mode 100644
index 0000000..26c5b65
--- /dev/null
+++ b/scripts/link-vmlinux.sh
@@ -0,0 +1,211 @@
+#!/bin/sh
+#
+# link vmlinux
+#
+# vmlinux is linked from the objects selected by $(KBUILD_VMLINUX_INIT) and
+# $(KBUILD_VMLINUX_MAIN). Most are built-in.o files from top-level directories
+# in the kernel tree, others are specified in arch/$(ARCH)/Makefile.
+# Ordering when linking is important, and $(KBUILD_VMLINUX_INIT) must be first.
+#
+# vmlinux
+# ^
+# |
+# +-< $(KBUILD_VMLINUX_INIT)
+# | +--< init/version.o + more
+# |
+# +--< $(KBUILD_VMLINUX_MAIN)
+# | +--< drivers/built-in.o mm/built-in.o + more
+# |
+# +-< ${kallsymso} (see description in KALLSYMS section)
+#
+# vmlinux version (uname -v) cannot be updated during normal
+# descending-into-subdirs phase since we do not yet know if we need to
+# update vmlinux.
+# Therefore this step is delayed until just before final link of vmlinux.
+#
+# System.map is generated to document addresses of all kernel symbols
+
+# Error out on error
+set -e
+
+# Nice output in kbuild format
+# Will be supressed by "make -s"
+info()
+{
+ if [ "${quiet}" != "silent_" ]; then
+ printf " %-7s %s\n" ${1} ${2}
+ fi
+}
+
+# Link of vmlinux.o used for section mismatch analysis
+# ${1} output file
+modpost_link()
+{
+ ${LD} ${LDFLAGS} -r -o ${1} ${KBUILD_VMLINUX_INIT} \
+ --start-group ${KBUILD_VMLINUX_MAIN} --end-group
+}
+
+# Link of vmlinux
+# ${1} - optional extra .o files
+# ${2} - output file
+vmlinux_link()
+{
+ local lds="${objtree}/${KBUILD_LDS}"
+
+ if [ "${SRCARCH}" != "um" ]; then
+ ${LD} ${LDFLAGS} ${LDFLAGS_vmlinux} -o ${2} \
+ -T ${lds} ${KBUILD_VMLINUX_INIT} \
+ --start-group ${KBUILD_VMLINUX_MAIN} --end-group ${1}
+ else
+ ${CC} ${CFLAGS_vmlinux} -o ${2} \
+ -Wl,-T,${lds} ${KBUILD_VMLINUX_INIT} \
+ -Wl,--start-group \
+ ${KBUILD_VMLINUX_MAIN} \
+ -Wl,--end-group \
+ -lutil ${1}
+ rm -f linux
+ fi
+}
+
+
+# Create ${2} .o file with all symbols from the ${1} object file
+kallsyms()
+{
+ info KSYM ${2}
+ local kallsymopt;
+
+ if [ -n "${CONFIG_KALLSYMS_ALL}" ]; then
+ kallsymopt=--all-symbols
+ fi
+
+ local aflags="${KBUILD_AFLAGS} ${NOSTDINC_FLAGS} \
+ ${LINUXINCLUDE} ${KBUILD_CPPFLAGS}"
+
+ ${NM} -n ${1} | \
+ scripts/kallsyms ${kallsymopt} | \
+ ${CC} ${aflags} -c -o ${2} -x assembler-with-cpp -
+}
+
+# Create map file with all symbols from ${1}
+# See mksymap for additional details
+mksysmap()
+{
+ ${CONFIG_SHELL} "${srctree}/scripts/mksysmap" ${1} ${2}
+}
+
+# Delete output files in case of error
+trap cleanup SIGHUP SIGINT SIGQUIT SIGTERM ERR
+cleanup()
+{
+ rm -f .old_version
+ rm -f .tmp_System.map
+ rm -f .tmp_kallsyms*
+ rm -f .tmp_version
+ rm -f .tmp_vmlinux*
+ rm -f System.map
+ rm -f vmlinux
+ rm -f vmlinux.o
+}
+
+#
+#
+# Use "make V=1" to debug this script
+case "${KBUILD_VERBOSE}" in
+*1*)
+ set -x
+ ;;
+esac
+
+if [ "$1" = "clean" ]; then
+ cleanup
+ exit 0
+fi
+
+# We need access to CONFIG_ symbols
+. ./.config
+
+#link vmlinux.o
+info LD vmlinux.o
+modpost_link vmlinux.o
+
+# modpost vmlinux.o to check for section mismatches
+${MAKE} -f "${srctree}/scripts/Makefile.modpost" vmlinux.o
+
+# Update version
+info GEN .version
+if [ ! -r .version ]; then
+ rm -f .version;
+ echo 1 >.version;
+else
+ mv .version .old_version;
+ expr 0$(cat .old_version) + 1 >.version;
+fi;
+
+# final build of init/
+${MAKE} -f "${srctree}/scripts/Makefile.build" obj=init
+
+kallsymso=""
+kallsyms_vmlinux=""
+if [ -n "${CONFIG_KALLSYMS}" ]; then
+
+ # kallsyms support
+ # Generate section listing all symbols and add it into vmlinux
+ # It's a three step process:
+ # 1) Link .tmp_vmlinux1 so it has all symbols and sections,
+ # but __kallsyms is empty.
+ # Running kallsyms on that gives us .tmp_kallsyms1.o with
+ # the right size
+ # 2) Link .tmp_vmlinux2 so it now has a __kallsyms section of
+ # the right size, but due to the added section, some
+ # addresses have shifted.
+ # From here, we generate a correct .tmp_kallsyms2.o
+ # 2a) We may use an extra pass as this has been necessary to
+ # woraround some alignment related bugs.
+ # KALLSYMS_EXTRA_PASS=1 is used to trigger this.
+ # 3) The correct ${kallsymso} is linked into the final vmlinux.
+ #
+ # a) Verify that the System.map from vmlinux matches the map from
+ # ${kallsymso}.
+
+ kallsymso=.tmp_kallsyms2.o
+ kallsyms_vmlinux=.tmp_vmlinux2
+
+ # step 1
+ vmlinux_link "" .tmp_vmlinux1
+ kallsyms .tmp_vmlinux1 .tmp_kallsyms1.o
+
+ # step 2
+ vmlinux_link .tmp_kallsyms1.o .tmp_vmlinux2
+ kallsyms .tmp_vmlinux2 .tmp_kallsyms2.o
+
+ # step 2a
+ if [ -n "${KALLSYMS_EXTRA_PASS}" ]; then
+ kallsymso=.tmp_kallsyms3.o
+ kallsyms_vmlinux=.tmp_vmlinux3
+
+ vmlinux_link .tmp_kallsyms2.o .tmp_vmlinux3
+
+ kallsyms .tmp_vmlinux3 .tmp_kallsyms3.o
+ fi
+fi
+
+info LD vmlinux
+vmlinux_link "${kallsymso}" vmlinux
+
+info SYSMAP System.map
+mksysmap vmlinux System.map
+
+# step a (see comment above)
+if [ -n "${CONFIG_KALLSYMS}" ]; then
+ mksysmap ${kallsyms_vmlinux} .tmp_System.map
+
+ if ! cmp -s System.map .tmp_System.map; then
+ echo Inconsistent kallsyms data
+ echo echo Try "make KALLSYMS_EXTRA_PASS=1" as a workaround
+ cleanup
+ exit 1
+ fi
+fi
+
+# We made a new kernel - delete old version file
+rm -f .old_version
--
1.6.0.6

2012-05-05 08:20:05

by Sam Ravnborg

[permalink] [raw]
Subject: [PATCH 5/8] kbuild: move definitions from top-level Makefile to scripts/Kbuild.config

Move some of the trivial definitions to a dedicated Kbuild.config file.
This brings down the noise level in the top-level Makefile.

Signed-off-by: Sam Ravnborg <[email protected]>
---
Makefile | 68 ++----------------------------------------------
scripts/Kbuild.config | 68 +++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 71 insertions(+), 65 deletions(-)
create mode 100644 scripts/Kbuild.config

diff --git a/Makefile b/Makefile
index 41bc36e..aee40e2 100644
--- a/Makefile
+++ b/Makefile
@@ -243,11 +243,6 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
else if [ -x /bin/bash ]; then echo /bin/bash; \
else echo sh; fi ; fi)

-HOSTCC = gcc
-HOSTCXX = g++
-HOSTCFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer
-HOSTCXXFLAGS = -O2
-
# Decide whether to build built-in, modular, or both.
# Normally, just do built-in.

@@ -323,74 +318,17 @@ export quiet Q KBUILD_VERBOSE
MAKEFLAGS += --include-dir=$(srctree)

# We need some generic definitions (do not try to remake the file).
+$(srctree)/scripts/Kbuild.config: ;
$(srctree)/scripts/Kbuild.include: ;
+include $(srctree)/scripts/Kbuild.config
include $(srctree)/scripts/Kbuild.include

-# Make variables (CC, etc...)
-
-AS = $(CROSS_COMPILE)as
-LD = $(CROSS_COMPILE)ld
-CC = $(CROSS_COMPILE)gcc
-CPP = $(CC) -E
-AR = $(CROSS_COMPILE)ar
-NM = $(CROSS_COMPILE)nm
-STRIP = $(CROSS_COMPILE)strip
-OBJCOPY = $(CROSS_COMPILE)objcopy
-OBJDUMP = $(CROSS_COMPILE)objdump
-AWK = awk
-GENKSYMS = scripts/genksyms/genksyms
-INSTALLKERNEL := installkernel
-DEPMOD = /sbin/depmod
-PERL = perl
-CHECK = sparse
-
-CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
- -Wbitwise -Wno-return-void $(CF)
-CFLAGS_MODULE =
-AFLAGS_MODULE =
-LDFLAGS_MODULE =
-CFLAGS_KERNEL =
-AFLAGS_KERNEL =
-CFLAGS_GCOV = -fprofile-arcs -ftest-coverage
-
-
-# Use LINUXINCLUDE when you must reference the include/ directory.
-# Needed to be compatible with the O= option
-LINUXINCLUDE := -I$(srctree)/arch/$(hdr-arch)/include \
- -Iarch/$(hdr-arch)/include/generated -Iinclude \
- $(if $(KBUILD_SRC), -I$(srctree)/include) \
- -include $(srctree)/include/linux/kconfig.h
-
-KBUILD_CPPFLAGS := -D__KERNEL__
-
-KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
- -fno-strict-aliasing -fno-common \
- -Werror-implicit-function-declaration \
- -Wno-format-security \
- -fno-delete-null-pointer-checks
-KBUILD_AFLAGS_KERNEL :=
-KBUILD_CFLAGS_KERNEL :=
-KBUILD_AFLAGS := -D__ASSEMBLY__
-KBUILD_AFLAGS_MODULE := -DMODULE
-KBUILD_CFLAGS_MODULE := -DMODULE
-KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds
-
# Read KERNELRELEASE from include/config/kernel.release (if it exists)
KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null)
KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION)

export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION
-export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC
-export CPP AR NM STRIP OBJCOPY OBJDUMP
-export MAKE AWK GENKSYMS INSTALLKERNEL PERL UTS_MACHINE
-export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
-
-export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS
-export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE CFLAGS_GCOV
-export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
-export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE
-export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL
-export KBUILD_ARFLAGS
+export CROSS_COMPILE ARCH SRCARCH CONFIG_SHELL UTS_MACHINE

# When compiling out-of-tree modules, put MODVERDIR in the module
# tree rather than in the kernel tree. The kernel tree might
diff --git a/scripts/Kbuild.config b/scripts/Kbuild.config
new file mode 100644
index 0000000..15d5b1e
--- /dev/null
+++ b/scripts/Kbuild.config
@@ -0,0 +1,68 @@
+# Build on the host
+export HOSTCC := gcc
+export HOSTCXX := g++
+export HOSTCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes
+ HOSTCFLAGS += -O2 -fomit-frame-pointer
+export HOSTCXXFLAGS := -O2
+
+# Tools to build for the target
+export AS := $(CROSS_COMPILE)as
+export LD := $(CROSS_COMPILE)ld
+export CC := $(CROSS_COMPILE)gcc
+export CPP := $(CC) -E
+export AR := $(CROSS_COMPILE)ar
+export NM := $(CROSS_COMPILE)nm
+export STRIP := $(CROSS_COMPILE)strip
+export OBJCOPY := $(CROSS_COMPILE)objcopy
+export OBJDUMP := $(CROSS_COMPILE)objdump
+
+# Diverse tools
+export AWK := awk
+export CHECK := sparse
+export DEPMOD := /sbin/depmod
+export GENKSYMS := scripts/genksyms/genksyms
+export KALLSYMS := scripts/kallsyms
+export MAKE
+export PERL := perl
+
+# Tools for kernel installation
+export INSTALLKERNEL := installkernel
+
+# Options for various tools
+export CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__
+ CHECKFLAGS += -Dunix -D__unix__
+ CHECKFLAGS += -Wbitwise -Wno-return-void $(CF)
+export CFLAGS_MODULE :=
+export AFLAGS_MODULE :=
+export LDFLAGS_MODULE :=
+export CFLAGS_KERNEL :=
+export AFLAGS_KERNEL :=
+export CFLAGS_GCOV := -fprofile-arcs -ftest-coverage
+
+# Use LINUXINCLUDE when you must reference the include/ directory.
+# Needed to be compatible with the O= option
+export LINUXINCLUDE := -I$(srctree)/arch/$(hdr-arch)/include
+ LINUXINCLUDE += -Iarch/$(hdr-arch)/include/generated -Iinclude
+ LINUXINCLUDE += $(if $(KBUILD_SRC), -I$(srctree)/include)
+ LINUXINCLUDE += -include $(srctree)/include/linux/kconfig.h
+
+export KBUILD_CPPFLAGS := -D__KERNEL__
+export KBUILD_AFLAGS := -D__ASSEMBLY__
+export KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs
+ KBUILD_CFLAGS += -fno-strict-aliasing -fno-common
+ KBUILD_CFLAGS += -Werror-implicit-function-declaration
+ KBUILD_CFLAGS += -Wno-format-security
+ KBUILD_CFLAGS += -fno-delete-null-pointer-checks
+
+export KBUILD_AFLAGS_KERNEL :=
+export KBUILD_CFLAGS_KERNEL :=
+
+export KBUILD_AFLAGS_MODULE := -DMODULE
+export KBUILD_CFLAGS_MODULE := -DMODULE
+export KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds
+
+ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
+KBUILD_CFLAGS += -Os
+else
+KBUILD_CFLAGS += -O2
+endif
--
1.6.0.6

2012-05-05 08:20:00

by Sam Ravnborg

[permalink] [raw]
Subject: [PATCH 4/8] kbuild: document KBUILD_LDS, KBUILD_VMLINUX_{INIT,MAIN} and LDFLAGS_vmlinux

Newly exported variables - used by link-vmlinux.sh

Signed-off-by: Sam Ravnborg <[email protected]>
---
Documentation/kbuild/kbuild.txt | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/Documentation/kbuild/kbuild.txt b/Documentation/kbuild/kbuild.txt
index 68e32bb..1053642 100644
--- a/Documentation/kbuild/kbuild.txt
+++ b/Documentation/kbuild/kbuild.txt
@@ -50,6 +50,10 @@ LDFLAGS_MODULE
--------------------------------------------------
Additional options used for $(LD) when linking modules.

+LDFLAGS_vmlinux
+--------------------------------------------------
+Additional options passed to final link of vmlinux.
+
KBUILD_VERBOSE
--------------------------------------------------
Set the kbuild verbosity. Can be assigned same values as "V=...".
@@ -214,3 +218,18 @@ KBUILD_BUILD_USER, KBUILD_BUILD_HOST
These two variables allow to override the user@host string displayed during
boot and in /proc/version. The default value is the output of the commands
whoami and host, respectively.
+
+KBUILD_LDS
+--------------------------------------------------
+The linker script with full path. Assigned by the top-level Makefile.
+
+KBUILD_VMLINUX_INIT
+--------------------------------------------------
+All objects files for the init (first) part of vmlinux.
+Files specified with KBUILD_VMLINUX_INIT are linked first.
+
+KBUILD_VMLINUX_MAIN
+--------------------------------------------------
+All objects files for the main part of vmlinux.
+KBUILD_VMLINUX_INIT and KBUILD_VMLINUX_MAIN together specify
+all the object files used to link vmlinux.
--
1.6.0.6

2012-05-05 08:19:58

by Sam Ravnborg

[permalink] [raw]
Subject: [PATCH 8/8] kbuild: remove useless warning

From: Artem Bityutskiy <[email protected]>

This patch removes annoying warning:

Makefile:708: "WARNING: Appending $KCFLAGS (-Wno-sign-compare) from command line to kernel $CFLAGS"

which is printed every time I use KCFLAFS. The commit which introduced the
warning:

69ee0b3 kbuild: do not pick up CFLAGS from the environment

tells about the problems when people have CFLAGS in their environment,
then switches to KCFLAFS which should be enough to solve the issue, but
it anyway introduces a warning. I think it is too much and I find this
warning very annoying - why should we warn users when they use the
build system properly?

Signed-off-by: Artem Bityutskiy <[email protected]>
Signed-off-by: Sam Ravnborg <[email protected]>
---
scripts/Kbuild.arch | 7 -------
1 files changed, 0 insertions(+), 7 deletions(-)

diff --git a/scripts/Kbuild.arch b/scripts/Kbuild.arch
index 6ff27c6..7841825 100644
--- a/scripts/Kbuild.arch
+++ b/scripts/Kbuild.arch
@@ -127,20 +127,13 @@ KBUILD_CFLAGS += $(warning)
endif

# Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments
-# But warn user when we do so
-warn-assign = \
-$(warning "WARNING: Appending $$K$(1) ($(K$(1))) from $(origin K$(1)) to kernel $$$(1)")
-
ifneq ($(KCPPFLAGS),)
- $(call warn-assign,CPPFLAGS)
KBUILD_CPPFLAGS += $(KCPPFLAGS)
endif
ifneq ($(KAFLAGS),)
- $(call warn-assign,AFLAGS)
KBUILD_AFLAGS += $(KAFLAGS)
endif
ifneq ($(KCFLAGS),)
- $(call warn-assign,CFLAGS)
KBUILD_CFLAGS += $(KCFLAGS)
endif

--
1.6.0.6

2012-05-05 08:19:55

by Sam Ravnborg

[permalink] [raw]
Subject: [PATCH 6/8] kbuild: move arch definitions from top-level Makefile to scripts/Kbuild.arch

Simplify top-level Makefile by moving a bunch of definitions
to a separate file.
Use a consistent style in Kbuild.arch (indents are always 8 spaces).

Signed-off-by: Sam Ravnborg <[email protected]>
---
Makefile | 104 +------------------------------------------------
scripts/Kbuild.arch | 106 +++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 109 insertions(+), 101 deletions(-)
create mode 100644 scripts/Kbuild.arch

diff --git a/Makefile b/Makefile
index aee40e2..c2864b9 100644
--- a/Makefile
+++ b/Makefile
@@ -503,107 +503,9 @@ endif

include $(srctree)/arch/$(SRCARCH)/Makefile

-ifneq ($(CONFIG_FRAME_WARN),0)
-KBUILD_CFLAGS += $(call cc-option,-Wframe-larger-than=${CONFIG_FRAME_WARN})
-endif
-
-# Force gcc to behave correct even for buggy distributions
-ifndef CONFIG_CC_STACKPROTECTOR
-KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector)
-endif
-
-# This warning generated too much noise in a regular build.
-# Use make W=1 to enable this warning (see scripts/Makefile.build)
-KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)
-
-ifdef CONFIG_FRAME_POINTER
-KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls
-else
-# Some targets (ARM with Thumb2, for example), can't be built with frame
-# pointers. For those, we don't have FUNCTION_TRACER automatically
-# select FRAME_POINTER. However, FUNCTION_TRACER adds -pg, and this is
-# incompatible with -fomit-frame-pointer with current GCC, so we don't use
-# -fomit-frame-pointer with FUNCTION_TRACER.
-ifndef CONFIG_FUNCTION_TRACER
-KBUILD_CFLAGS += -fomit-frame-pointer
-endif
-endif
-
-ifdef CONFIG_DEBUG_INFO
-KBUILD_CFLAGS += -g
-KBUILD_AFLAGS += -gdwarf-2
-endif
-
-ifdef CONFIG_DEBUG_INFO_REDUCED
-KBUILD_CFLAGS += $(call cc-option, -femit-struct-debug-baseonly)
-endif
-
-ifdef CONFIG_FUNCTION_TRACER
-KBUILD_CFLAGS += -pg
-ifdef CONFIG_DYNAMIC_FTRACE
- ifdef CONFIG_HAVE_C_RECORDMCOUNT
- BUILD_C_RECORDMCOUNT := y
- export BUILD_C_RECORDMCOUNT
- endif
-endif
-endif
-
-# We trigger additional mismatches with less inlining
-ifdef CONFIG_DEBUG_SECTION_MISMATCH
-KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once)
-endif
-
-# arch Makefile may override CC so keep this after arch Makefile is included
-NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
-CHECKFLAGS += $(NOSTDINC_FLAGS)
-
-# warn about C99 declaration after statement
-KBUILD_CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)
-
-# disable pointer signed / unsigned warnings in gcc 4.0
-KBUILD_CFLAGS += $(call cc-disable-warning, pointer-sign)
-
-# disable invalid "can't wrap" optimizations for signed / pointers
-KBUILD_CFLAGS += $(call cc-option,-fno-strict-overflow)
-
-# conserve stack if available
-KBUILD_CFLAGS += $(call cc-option,-fconserve-stack)
-
-# use the deterministic mode of AR if available
-KBUILD_ARFLAGS := $(call ar-option,D)
-
-# check for 'asm goto'
-ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC)), y)
- KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO
-endif
-
-# Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments
-# But warn user when we do so
-warn-assign = \
-$(warning "WARNING: Appending $$K$(1) ($(K$(1))) from $(origin K$(1)) to kernel $$$(1)")
-
-ifneq ($(KCPPFLAGS),)
- $(call warn-assign,CPPFLAGS)
- KBUILD_CPPFLAGS += $(KCPPFLAGS)
-endif
-ifneq ($(KAFLAGS),)
- $(call warn-assign,AFLAGS)
- KBUILD_AFLAGS += $(KAFLAGS)
-endif
-ifneq ($(KCFLAGS),)
- $(call warn-assign,CFLAGS)
- KBUILD_CFLAGS += $(KCFLAGS)
-endif
-
-# Use --build-id when available.
-LDFLAGS_BUILD_ID = $(patsubst -Wl$(comma)%,%,\
- $(call cc-ldoption, -Wl$(comma)--build-id,))
-KBUILD_LDFLAGS_MODULE += $(LDFLAGS_BUILD_ID)
-LDFLAGS_vmlinux += $(LDFLAGS_BUILD_ID)
-
-ifeq ($(CONFIG_STRIP_ASM_SYMS),y)
-LDFLAGS_vmlinux += $(call ld-option, -X,)
-endif
+# Definitions which require arch makefile
+$(srctree)/scripts/Kbuild.arch: ;
+include $(srctree)/scripts/Kbuild.arch

# Default kernel image to build when no specific target is given.
# KBUILD_IMAGE may be overruled on the command line or
diff --git a/scripts/Kbuild.arch b/scripts/Kbuild.arch
new file mode 100644
index 0000000..230050f
--- /dev/null
+++ b/scripts/Kbuild.arch
@@ -0,0 +1,106 @@
+#
+# CC options etc. that requires arch/$(ARCH)/Makefile to be included
+# before they can be defined
+
+ifneq ($(CONFIG_FRAME_WARN),0)
+ KBUILD_CFLAGS += $(call cc-option,-Wframe-larger-than=${CONFIG_FRAME_WARN})
+endif
+
+# Force gcc to behave correct even for buggy distributions
+ifndef CONFIG_CC_STACKPROTECTOR
+ KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector)
+endif
+
+# This warning generated too much noise in a regular build.
+# Use make W=1 to enable this warning (see scripts/Makefile.build)
+KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)
+
+ifdef CONFIG_FRAME_POINTER
+ KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls
+else
+ # Some targets (ARM with Thumb2, for example), can't be built with
+ # frame pointers. For those, we don't have FUNCTION_TRACER
+ # automatically select FRAME_POINTER.
+ # However, FUNCTION_TRACER adds -pg, and this is incompatible with
+ # -fomit-frame-pointer with current GCC, so we don't use
+ # -fomit-frame-pointer with FUNCTION_TRACER.
+ ifndef CONFIG_FUNCTION_TRACER
+ KBUILD_CFLAGS += -fomit-frame-pointer
+ endif
+endif
+
+ifdef CONFIG_DEBUG_INFO
+ KBUILD_CFLAGS += -g
+ KBUILD_AFLAGS += -gdwarf-2
+endif
+
+ifdef CONFIG_DEBUG_INFO_REDUCED
+ KBUILD_CFLAGS += $(call cc-option, -femit-struct-debug-baseonly)
+endif
+
+ifdef CONFIG_FUNCTION_TRACER
+ KBUILD_CFLAGS += -pg
+ ifdef CONFIG_DYNAMIC_FTRACE
+ ifdef CONFIG_HAVE_C_RECORDMCOUNT
+ export BUILD_C_RECORDMCOUNT := y
+ endif
+ endif
+endif
+
+# We trigger additional mismatches with less inlining
+ifdef CONFIG_DEBUG_SECTION_MISMATCH
+ KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once)
+endif
+
+# arch Makefile may override CC so keep this after arch Makefile is included
+NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
+CHECKFLAGS += $(NOSTDINC_FLAGS)
+
+# warn about C99 declaration after statement
+KBUILD_CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)
+
+# disable pointer signed / unsigned warnings in gcc 4.0
+KBUILD_CFLAGS += $(call cc-disable-warning, pointer-sign)
+
+# disable invalid "can't wrap" optimizations for signed / pointers
+KBUILD_CFLAGS += $(call cc-option,-fno-strict-overflow)
+
+# conserve stack if available
+KBUILD_CFLAGS += $(call cc-option,-fconserve-stack)
+
+# use the deterministic mode of AR if available
+KBUILD_ARFLAGS := $(call ar-option,D)
+
+# check for 'asm goto'
+ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC)), y)
+ KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO
+endif
+
+# Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments
+# But warn user when we do so
+warn-assign = \
+$(warning "WARNING: Appending $$K$(1) ($(K$(1))) from $(origin K$(1)) to kernel $$$(1)")
+
+ifneq ($(KCPPFLAGS),)
+ $(call warn-assign,CPPFLAGS)
+ KBUILD_CPPFLAGS += $(KCPPFLAGS)
+endif
+ifneq ($(KAFLAGS),)
+ $(call warn-assign,AFLAGS)
+ KBUILD_AFLAGS += $(KAFLAGS)
+endif
+ifneq ($(KCFLAGS),)
+ $(call warn-assign,CFLAGS)
+ KBUILD_CFLAGS += $(KCFLAGS)
+endif
+
+# Use --build-id when available.
+LDFLAGS_BUILD_ID = $(patsubst -Wl$(comma)%,%,\
+ $(call cc-ldoption, -Wl$(comma)--build-id,))
+KBUILD_LDFLAGS_MODULE += $(LDFLAGS_BUILD_ID)
+LDFLAGS_vmlinux += $(LDFLAGS_BUILD_ID)
+
+ifeq ($(CONFIG_STRIP_ASM_SYMS),y)
+ LDFLAGS_vmlinux += $(call ld-option, -X,)
+endif
+
--
1.6.0.6

2012-05-05 08:19:54

by Sam Ravnborg

[permalink] [raw]
Subject: [PATCH 7/8] kbuild: move W=... stuff to Kbuild.arch

Prevent that we eveluate cc-option multiple times for the same
option by moving the definitions to Kbuild.arch.
The file is included once only, thus gcc is not invoked once per directory.

Another side-effect of this patch is that KCFLAGS are appended last
to the list of options. This allows us to better control the options.
Artem Bityutskiy <[email protected]> noticed this.

Signed-off-by: Sam Ravnborg <[email protected]>
Cc: Artem Bityutskiy <[email protected]>
---
scripts/Kbuild.arch | 51 +++++++++++++++++++++++++++++++++++++++++++++++-
scripts/Makefile.build | 51 ------------------------------------------------
2 files changed, 50 insertions(+), 52 deletions(-)

diff --git a/scripts/Kbuild.arch b/scripts/Kbuild.arch
index 230050f..6ff27c6 100644
--- a/scripts/Kbuild.arch
+++ b/scripts/Kbuild.arch
@@ -76,6 +76,56 @@ ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC)), y)
KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO
endif

+# make W=... settings
+#
+# W=1 - warnings that may be relevant and does not occur too often
+# W=2 - warnings that occur quite often but may still be relevant
+# W=3 - the more obscure warnings, can most likely be ignored
+#
+# $(call cc-option, -W...) handles gcc -W.. options which
+# are not supported by all versions of the compiler
+ifdef KBUILD_ENABLE_EXTRA_GCC_CHECKS
+warning- := $(empty)
+
+warning-1 := -Wextra -Wunused -Wno-unused-parameter
+warning-1 += -Wmissing-declarations
+warning-1 += -Wmissing-format-attribute
+warning-1 += -Wmissing-prototypes
+warning-1 += -Wold-style-definition
+warning-1 += $(call cc-option, -Wmissing-include-dirs)
+warning-1 += $(call cc-option, -Wunused-but-set-variable)
+warning-1 += $(call cc-disable-warning, missing-field-initializers)
+
+warning-2 := -Waggregate-return
+warning-2 += -Wcast-align
+warning-2 += -Wdisabled-optimization
+warning-2 += -Wnested-externs
+warning-2 += -Wshadow
+warning-2 += $(call cc-option, -Wlogical-op)
+warning-2 += $(call cc-option, -Wmissing-field-initializers)
+
+warning-3 := -Wbad-function-cast
+warning-3 += -Wcast-qual
+warning-3 += -Wconversion
+warning-3 += -Wpacked
+warning-3 += -Wpadded
+warning-3 += -Wpointer-arith
+warning-3 += -Wredundant-decls
+warning-3 += -Wswitch-default
+warning-3 += $(call cc-option, -Wpacked-bitfield-compat)
+warning-3 += $(call cc-option, -Wvla)
+
+warning := $(warning-$(findstring 1, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)))
+warning += $(warning-$(findstring 2, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)))
+warning += $(warning-$(findstring 3, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)))
+
+ifeq ("$(strip $(warning))","")
+ $(error W=$(KBUILD_ENABLE_EXTRA_GCC_CHECKS) is unknown)
+endif
+
+KBUILD_CFLAGS += $(warning)
+endif
+
# Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments
# But warn user when we do so
warn-assign = \
@@ -103,4 +153,3 @@ LDFLAGS_vmlinux += $(LDFLAGS_BUILD_ID)
ifeq ($(CONFIG_STRIP_ASM_SYMS),y)
LDFLAGS_vmlinux += $(call ld-option, -X,)
endif
-
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index ff1720d..f8681cc 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -50,57 +50,6 @@ ifeq ($(KBUILD_NOPEDANTIC),)
endif
endif

-#
-# make W=... settings
-#
-# W=1 - warnings that may be relevant and does not occur too often
-# W=2 - warnings that occur quite often but may still be relevant
-# W=3 - the more obscure warnings, can most likely be ignored
-#
-# $(call cc-option, -W...) handles gcc -W.. options which
-# are not supported by all versions of the compiler
-ifdef KBUILD_ENABLE_EXTRA_GCC_CHECKS
-warning- := $(empty)
-
-warning-1 := -Wextra -Wunused -Wno-unused-parameter
-warning-1 += -Wmissing-declarations
-warning-1 += -Wmissing-format-attribute
-warning-1 += -Wmissing-prototypes
-warning-1 += -Wold-style-definition
-warning-1 += $(call cc-option, -Wmissing-include-dirs)
-warning-1 += $(call cc-option, -Wunused-but-set-variable)
-warning-1 += $(call cc-disable-warning, missing-field-initializers)
-
-warning-2 := -Waggregate-return
-warning-2 += -Wcast-align
-warning-2 += -Wdisabled-optimization
-warning-2 += -Wnested-externs
-warning-2 += -Wshadow
-warning-2 += $(call cc-option, -Wlogical-op)
-warning-2 += $(call cc-option, -Wmissing-field-initializers)
-
-warning-3 := -Wbad-function-cast
-warning-3 += -Wcast-qual
-warning-3 += -Wconversion
-warning-3 += -Wpacked
-warning-3 += -Wpadded
-warning-3 += -Wpointer-arith
-warning-3 += -Wredundant-decls
-warning-3 += -Wswitch-default
-warning-3 += $(call cc-option, -Wpacked-bitfield-compat)
-warning-3 += $(call cc-option, -Wvla)
-
-warning := $(warning-$(findstring 1, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)))
-warning += $(warning-$(findstring 2, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)))
-warning += $(warning-$(findstring 3, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)))
-
-ifeq ("$(strip $(warning))","")
- $(error W=$(KBUILD_ENABLE_EXTRA_GCC_CHECKS) is unknown)
-endif
-
-KBUILD_CFLAGS += $(warning)
-endif
-
include scripts/Makefile.lib

ifdef host-progs
--
1.6.0.6

2012-05-05 08:19:52

by Sam Ravnborg

[permalink] [raw]
Subject: [PATCH 2/8] kbuild: refactor final link of sparc32

sparc32 uses an additional final link to support btfix.
Introduce a new set of exported variables in the top-level Makefile
to make the extra linking step simpler.

sparc32 has hardcoded knowledge of kallsyms support. This fix
include support for EXTRA_KALLSYM_PASS=1.
The ugly part is that it is hardcoded in the arch/sparc/boot
Makefile.

Signed-off-by: Sam Ravnborg <[email protected]>
Cc: "David S. Miller" <[email protected]>
---
Makefile | 5 +++++
arch/sparc/Makefile | 11 -----------
arch/sparc/boot/Makefile | 14 +++++++++-----
3 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/Makefile b/Makefile
index 1af1b7a..20b0232 100644
--- a/Makefile
+++ b/Makefile
@@ -727,6 +727,11 @@ libs-y1 := $(patsubst %/, %/lib.a, $(libs-y))
libs-y2 := $(patsubst %/, %/built-in.o, $(libs-y))
libs-y := $(libs-y1) $(libs-y2)

+# externally visible symbols
+export KBUILD_VMLINUX_INIT := $(head-y) $(init-y)
+export KBUILD_VMLINUX_MAIN := $(core-y) $(libs-y) $(drivers-y) $(net-y)
+export KBUILD_LDS := arch/$(SRCARCH)/kernel/vmlinux.lds
+
# Build vmlinux
# ---------------------------------------------------------------------------
# vmlinux is built from the objects selected by $(vmlinux-init) and
diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile
index eddcfb3..3195f77 100644
--- a/arch/sparc/Makefile
+++ b/arch/sparc/Makefile
@@ -72,17 +72,6 @@ libs-y += arch/sparc/lib/

drivers-$(CONFIG_OPROFILE) += arch/sparc/oprofile/

-# Export what is needed by arch/sparc/boot/Makefile
-export VMLINUX_INIT VMLINUX_MAIN
-VMLINUX_INIT := $(head-y) $(init-y)
-VMLINUX_MAIN := $(core-y) kernel/ mm/ fs/ ipc/ security/ crypto/ block/
-VMLINUX_MAIN += $(patsubst %/, %/lib.a, $(libs-y)) $(libs-y)
-VMLINUX_MAIN += $(drivers-y) $(net-y)
-
-ifdef CONFIG_KALLSYMS
-export kallsyms.o := .tmp_kallsyms2.o
-endif
-
boot := arch/sparc/boot

# Default target
diff --git a/arch/sparc/boot/Makefile b/arch/sparc/boot/Makefile
index d56d199..78f1994 100644
--- a/arch/sparc/boot/Makefile
+++ b/arch/sparc/boot/Makefile
@@ -39,11 +39,15 @@ define rule_image
echo 'cmd_$@ := $(cmd_image)' > $(@D)/.$(@F).cmd
endef

-BTOBJS := $(patsubst %/, %/built-in.o, $(VMLINUX_INIT))
-BTLIBS := $(patsubst %/, %/built-in.o, $(VMLINUX_MAIN))
-LDFLAGS_image := -T arch/sparc/kernel/vmlinux.lds $(BTOBJS) \
- --start-group $(BTLIBS) --end-group \
- $(kallsyms.o) $(obj)/btfix.o
+# Support for kallsyms
+kallsyms-$(CONFIG_KALLSYMS) := .tmp_kallsyms2.o
+ifdef KALLSYMS_EXTRA_PASS
+ kallsyms-$(CONFIG_KALLSYMS) := .tmp_kallsyms3.o
+endif
+
+LDFLAGS_image := -T $(KBUILD_LDS) $(KBUILD_VMLINUX_INIT) \
+ --start-group $(KBUILD_VMLINUX_MAIN) --end-group \
+ $(kallsyms-y) $(obj)/btfix.o

# Link the final image including btfixup'ed symbols.
# This is a replacement for the link done in the top-level Makefile.
--
1.6.0.6

2012-05-05 09:51:41

by Artem Bityutskiy

[permalink] [raw]
Subject: Re: [PATCH 7/8] kbuild: move W=... stuff to Kbuild.arch

On Sat, 2012-05-05 at 10:18 +0200, Sam Ravnborg wrote:
> Prevent that we eveluate cc-option multiple times for the same
> option by moving the definitions to Kbuild.arch.
> The file is included once only, thus gcc is not invoked once per directory.
>
> Another side-effect of this patch is that KCFLAGS are appended last
> to the list of options. This allows us to better control the options.
> Artem Bityutskiy <[email protected]> noticed this.
>
> Signed-off-by: Sam Ravnborg <[email protected]>
> Cc: Artem Bityutskiy <[email protected]>

Looks OK, thanks!

Acked-by: Artem Bityutskiy <[email protected]>

--
Best Regards,
Artem Bityutskiy


Attachments:
signature.asc (836.00 B)
This is a digitally signed message part

2012-05-05 19:23:20

by Michal Marek

[permalink] [raw]
Subject: Re: [PATCH 0/8] kbuild: use script for final link, move definitions out of top-level Makefile

Dne 5.5.2012 10:06, Sam Ravnborg napsal(a):
> Hi Michal, all.
>
> o Move the link of vmlinux from top-level Makefile to a script.
> This increased the readability a lot.
> They have had a few rounds of reviews and are ready.
>
> o Move a lot of definitions from top-level Makefile to
> two new files located in scripts/
>
> o Fix so we do not call CC too often when using W=...
>
> o Fix so KCFLAGS (and friends) are added last to the
> command lines.
>
> Patches 1-4 are ready to be applied.
> Patches 5-8 are new and may raise a few comments.

I merged 1-4 now, I'll look at the rest later.

Michal

2012-05-05 21:03:43

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [PATCH 0/8] kbuild: use script for final link, move definitions out of top-level Makefile

On Sat, May 05, 2012 at 09:28:18PM +0200, Michal Marek wrote:
> Dne 5.5.2012 10:06, Sam Ravnborg napsal(a):
> > Hi Michal, all.
> >
> > o Move the link of vmlinux from top-level Makefile to a script.
> > This increased the readability a lot.
> > They have had a few rounds of reviews and are ready.
> >
> > o Move a lot of definitions from top-level Makefile to
> > two new files located in scripts/
> >
> > o Fix so we do not call CC too often when using W=...
> >
> > o Fix so KCFLAGS (and friends) are added last to the
> > command lines.
> >
> > Patches 1-4 are ready to be applied.
> > Patches 5-8 are new and may raise a few comments.
>
> I merged 1-4 now, I'll look at the rest later.

Perfect - thanks Michal. Looking forward for any feedback
on the remaining patches.

Sam

2012-05-07 06:56:08

by Artem Bityutskiy

[permalink] [raw]
Subject: Re: [PATCH 8/8] kbuild: remove useless warning

On Sat, 2012-05-05 at 10:18 +0200, Sam Ravnborg wrote:
> From: Artem Bityutskiy <[email protected]>
>
> This patch removes annoying warning:
>
> Makefile:708: "WARNING: Appending $KCFLAGS (-Wno-sign-compare) from command line to kernel $CFLAGS"
>
> which is printed every time I use KCFLAFS. The commit which introduced the
> warning:
>
> 69ee0b3 kbuild: do not pick up CFLAGS from the environment
>
> tells about the problems when people have CFLAGS in their environment,
> then switches to KCFLAFS which should be enough to solve the issue, but
> it anyway introduces a warning. I think it is too much and I find this
> warning very annoying - why should we warn users when they use the
> build system properly?
>
> Signed-off-by: Artem Bityutskiy <[email protected]>
> Signed-off-by: Sam Ravnborg <[email protected]>

Sam, thanks for taking care of this.

--
Best Regards,
Artem Bityutskiy


Attachments:
signature.asc (836.00 B)
This is a digitally signed message part

2012-05-16 04:52:12

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [PATCH 0/8] kbuild: use script for final link, move definitions out of top-level Makefile

On Sat, May 05, 2012 at 09:28:18PM +0200, Michal Marek wrote:
> Dne 5.5.2012 10:06, Sam Ravnborg napsal(a):
> > Hi Michal, all.
> >
> > o Move the link of vmlinux from top-level Makefile to a script.
> > This increased the readability a lot.
> > They have had a few rounds of reviews and are ready.
> >
> > o Move a lot of definitions from top-level Makefile to
> > two new files located in scripts/
> >
> > o Fix so we do not call CC too often when using W=...
> >
> > o Fix so KCFLAGS (and friends) are added last to the
> > command lines.
> >
> > Patches 1-4 are ready to be applied.
> > Patches 5-8 are new and may raise a few comments.
>
> I merged 1-4 now, I'll look at the rest later.

Hi Michal.

We are too close to the merge window to
apply patch 5-8.

I plan to resubmit them around -rc2 time,
then we should have time for review
and test.

Any comments until then are of course welcome,
but I expect you to wait until next submission.

Sam

2012-06-06 10:15:03

by Artem Bityutskiy

[permalink] [raw]
Subject: Re: [PATCH 7/8] kbuild: move W=... stuff to Kbuild.arch

On Sat, 2012-05-05 at 10:18 +0200, Sam Ravnborg wrote:
> Prevent that we eveluate cc-option multiple times for the same
> option by moving the definitions to Kbuild.arch.
> The file is included once only, thus gcc is not invoked once per directory.
>
> Another side-effect of this patch is that KCFLAGS are appended last
> to the list of options. This allows us to better control the options.
> Artem Bityutskiy <[email protected]> noticed this.
>
> Signed-off-by: Sam Ravnborg <[email protected]>
> Cc: Artem Bityutskiy <[email protected]>

Hi,

what happened to this patch? I was fixing the real issue I am
encountering and I thought it'd be taken instead of my original patch.

--
Best Regards,
Artem Bityutskiy


Attachments:
signature.asc (836.00 B)
This is a digitally signed message part

2012-06-06 15:35:27

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [PATCH 7/8] kbuild: move W=... stuff to Kbuild.arch

On Wed, Jun 06, 2012 at 01:18:47PM +0300, Artem Bityutskiy wrote:
> On Sat, 2012-05-05 at 10:18 +0200, Sam Ravnborg wrote:
> > Prevent that we eveluate cc-option multiple times for the same
> > option by moving the definitions to Kbuild.arch.
> > The file is included once only, thus gcc is not invoked once per directory.
> >
> > Another side-effect of this patch is that KCFLAGS are appended last
> > to the list of options. This allows us to better control the options.
> > Artem Bityutskiy <[email protected]> noticed this.
> >
> > Signed-off-by: Sam Ravnborg <[email protected]>
> > Cc: Artem Bityutskiy <[email protected]>
>
> Hi,
>
> what happened to this patch? I was fixing the real issue I am
> encountering and I thought it'd be taken instead of my original patch.
We decided to move this to next merge release because is was not added
to kbuild thus not enough exposure in -next.

I am planning to resend the serie at around -rc2 time.

Sam

2012-06-06 15:43:12

by Artem Bityutskiy

[permalink] [raw]
Subject: Re: [PATCH 7/8] kbuild: move W=... stuff to Kbuild.arch

On Wed, 2012-06-06 at 17:35 +0200, Sam Ravnborg wrote:
> On Wed, Jun 06, 2012 at 01:18:47PM +0300, Artem Bityutskiy wrote:
> > On Sat, 2012-05-05 at 10:18 +0200, Sam Ravnborg wrote:
> > > Prevent that we eveluate cc-option multiple times for the same
> > > option by moving the definitions to Kbuild.arch.
> > > The file is included once only, thus gcc is not invoked once per directory.
> > >
> > > Another side-effect of this patch is that KCFLAGS are appended last
> > > to the list of options. This allows us to better control the options.
> > > Artem Bityutskiy <[email protected]> noticed this.
> > >
> > > Signed-off-by: Sam Ravnborg <[email protected]>
> > > Cc: Artem Bityutskiy <[email protected]>
> >
> > Hi,
> >
> > what happened to this patch? I was fixing the real issue I am
> > encountering and I thought it'd be taken instead of my original patch.
> We decided to move this to next merge release because is was not added
> to kbuild thus not enough exposure in -next.
>
> I am planning to resend the serie at around -rc2 time.

OK, thanks for the update!

--
Best Regards,
Artem Bityutskiy


Attachments:
signature.asc (836.00 B)
This is a digitally signed message part

2012-06-26 09:37:16

by Michal Marek

[permalink] [raw]
Subject: Re: [PATCH 5/8] kbuild: move definitions from top-level Makefile to scripts/Kbuild.config

Hi Sam,

Sorry for the delay. I hope you still remember what you submitted ;)

On 5.5.2012 10:18, Sam Ravnborg wrote:
> +# Tools to build for the target
> +export AS := $(CROSS_COMPILE)as
> +export LD := $(CROSS_COMPILE)ld
> +export CC := $(CROSS_COMPILE)gcc
> +export CPP := $(CC) -E
> +export AR := $(CROSS_COMPILE)ar
> +export NM := $(CROSS_COMPILE)nm
> +export STRIP := $(CROSS_COMPILE)strip
> +export OBJCOPY := $(CROSS_COMPILE)objcopy
> +export OBJDUMP := $(CROSS_COMPILE)objdump

The := assignments do not work if CROSS_COMPILE is set in .config or in
the arch Makefile. You have to use the deferred from here.

Michal

2012-06-26 10:18:42

by Michal Marek

[permalink] [raw]
Subject: Re: [PATCH 5/8] kbuild: move definitions from top-level Makefile to scripts/Kbuild.config

On 5.5.2012 10:18, Sam Ravnborg wrote:
> diff --git a/scripts/Kbuild.config b/scripts/Kbuild.config
> new file mode 100644
> index 0000000..15d5b1e
> --- /dev/null
> +++ b/scripts/Kbuild.config
> @@ -0,0 +1,68 @@
[...]
> +ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
> +KBUILD_CFLAGS += -Os
> +else
> +KBUILD_CFLAGS += -O2
> +endif

This duplicates the statement in the top-level Makefile and does not
work in this context, because auto.conf is not included yet.

Michal

2012-06-26 10:33:37

by Michal Marek

[permalink] [raw]
Subject: Re: [PATCH 6/8] kbuild: move arch definitions from top-level Makefile to scripts/Kbuild.arch

On 5.5.2012 10:18, Sam Ravnborg wrote:
> diff --git a/scripts/Kbuild.arch b/scripts/Kbuild.arch
> new file mode 100644
> index 0000000..230050f
> --- /dev/null
> +++ b/scripts/Kbuild.arch
> @@ -0,0 +1,106 @@
> +#
> +# CC options etc. that requires arch/$(ARCH)/Makefile to be included
> +# before they can be defined
> +
[...]
> +# arch Makefile may override CC so keep this after arch Makefile is included

Just a nitpick, this comment is superfluous now, as the whole file is
included after the arch Makefile.


> +NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
> +CHECKFLAGS += $(NOSTDINC_FLAGS)

Michal

2012-06-26 10:37:51

by Michal Marek

[permalink] [raw]
Subject: Re: [PATCH 7/8] kbuild: move W=... stuff to Kbuild.arch

On 5.5.2012 10:18, Sam Ravnborg wrote:
> Prevent that we eveluate cc-option multiple times for the same
> option by moving the definitions to Kbuild.arch.
> The file is included once only, thus gcc is not invoked once per directory.

Nice.


> Another side-effect of this patch is that KCFLAGS are appended last
> to the list of options. This allows us to better control the options.
> Artem Bityutskiy <[email protected]> noticed this.
>
> Signed-off-by: Sam Ravnborg <[email protected]>
> Cc: Artem Bityutskiy <[email protected]>
> ---
> scripts/Kbuild.arch | 51 +++++++++++++++++++++++++++++++++++++++++++++++-
> scripts/Makefile.build | 51 ------------------------------------------------
> 2 files changed, 50 insertions(+), 52 deletions(-)
>
> diff --git a/scripts/Kbuild.arch b/scripts/Kbuild.arch
> index 230050f..6ff27c6 100644
> --- a/scripts/Kbuild.arch
> +++ b/scripts/Kbuild.arch
> @@ -76,6 +76,56 @@ ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC)), y)
> KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO
> endif
>
> +# make W=... settings

Again a nitpick only, in the comment earlier in this file

# This warning generated too much noise in a regular build.
# Use make W=1 to enable this warning (see scripts/Makefile.build)

the scripts/Makefile.build reference lost its meaning now.

Michal

2012-06-26 10:41:03

by Michal Marek

[permalink] [raw]
Subject: Re: [PATCH 8/8] kbuild: remove useless warning

On 5.5.2012 10:18, Sam Ravnborg wrote:
> ifneq ($(KCPPFLAGS),)
> - $(call warn-assign,CPPFLAGS)
> KBUILD_CPPFLAGS += $(KCPPFLAGS)
> endif
> ifneq ($(KAFLAGS),)
> - $(call warn-assign,AFLAGS)
> KBUILD_AFLAGS += $(KAFLAGS)
> endif
> ifneq ($(KCFLAGS),)
> - $(call warn-assign,CFLAGS)
> KBUILD_CFLAGS += $(KCFLAGS)
> endif

The tests for non-empty can be dropped now.

Michal

2012-08-15 09:36:43

by Artem Bityutskiy

[permalink] [raw]
Subject: Re: [PATCH 7/8] kbuild: move W=... stuff to Kbuild.arch

On Wed, 2012-06-06 at 17:35 +0200, Sam Ravnborg wrote:
> On Wed, Jun 06, 2012 at 01:18:47PM +0300, Artem Bityutskiy wrote:
> > On Sat, 2012-05-05 at 10:18 +0200, Sam Ravnborg wrote:
> > > Prevent that we eveluate cc-option multiple times for the same
> > > option by moving the definitions to Kbuild.arch.
> > > The file is included once only, thus gcc is not invoked once per directory.
> > >
> > > Another side-effect of this patch is that KCFLAGS are appended last
> > > to the list of options. This allows us to better control the options.
> > > Artem Bityutskiy <[email protected]> noticed this.
> > >
> > > Signed-off-by: Sam Ravnborg <[email protected]>
> > > Cc: Artem Bityutskiy <[email protected]>
> >
> > Hi,
> >
> > what happened to this patch? I was fixing the real issue I am
> > encountering and I thought it'd be taken instead of my original patch.
> We decided to move this to next merge release because is was not added
> to kbuild thus not enough exposure in -next.
>
> I am planning to resend the serie at around -rc2 time.

Hi Sam, what happened to this patch-set? At least KCFLAGS patches I am
waiting for are still not merged.

--
Best Regards,
Artem Bityutskiy


Attachments:
signature.asc (836.00 B)
This is a digitally signed message part

2012-08-15 10:17:40

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [PATCH 7/8] kbuild: move W=... stuff to Kbuild.arch

On Wed, Aug 15, 2012 at 12:41:23PM +0300, Artem Bityutskiy wrote:
> On Wed, 2012-06-06 at 17:35 +0200, Sam Ravnborg wrote:
> > On Wed, Jun 06, 2012 at 01:18:47PM +0300, Artem Bityutskiy wrote:
> > > On Sat, 2012-05-05 at 10:18 +0200, Sam Ravnborg wrote:
> > > > Prevent that we eveluate cc-option multiple times for the same
> > > > option by moving the definitions to Kbuild.arch.
> > > > The file is included once only, thus gcc is not invoked once per directory.
> > > >
> > > > Another side-effect of this patch is that KCFLAGS are appended last
> > > > to the list of options. This allows us to better control the options.
> > > > Artem Bityutskiy <[email protected]> noticed this.
> > > >
> > > > Signed-off-by: Sam Ravnborg <[email protected]>
> > > > Cc: Artem Bityutskiy <[email protected]>
> > >
> > > Hi,
> > >
> > > what happened to this patch? I was fixing the real issue I am
> > > encountering and I thought it'd be taken instead of my original patch.
> > We decided to move this to next merge release because is was not added
> > to kbuild thus not enough exposure in -next.
> >
> > I am planning to resend the serie at around -rc2 time.
>
> Hi Sam, what happened to this patch-set? At least KCFLAGS patches I am
> waiting for are still not merged.
Vacation and then I have not yet gotten back to them.
Will do soon - thanks for the reminder!

Sam