From 9d5db8949f1ecf4019785b04d8986835d3c0e99e Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Fri, 6 Jun 2014 10:43:55 +0900 Subject: scripts/Makefile.clean: clean also $(extra-m) and $(extra-) Signed-off-by: Masahiro Yamada Signed-off-by: Michal Marek --- scripts/Makefile.clean | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/Makefile.clean b/scripts/Makefile.clean index 686cb0d31c7c..a651cee84f2a 100644 --- a/scripts/Makefile.clean +++ b/scripts/Makefile.clean @@ -40,8 +40,8 @@ subdir-ymn := $(addprefix $(obj)/,$(subdir-ymn)) # build a list of files to remove, usually relative to the current # directory -__clean-files := $(extra-y) $(always) \ - $(targets) $(clean-files) \ +__clean-files := $(extra-y) $(extra-m) $(extra-) \ + $(always) $(targets) $(clean-files) \ $(host-progs) \ $(hostprogs-y) $(hostprogs-m) $(hostprogs-) -- cgit v1.2.3-59-g8ed1b From d8d9efe22709b62eb29fa9f4eb61fd882fc2b2c4 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Wed, 16 Jul 2014 16:12:19 +0900 Subject: kbuild: fix a typo in scripts/Makefile.host Signed-off-by: Masahiro Yamada Signed-off-by: Michal Marek --- scripts/Makefile.host | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/Makefile.host b/scripts/Makefile.host index 66893643fd7d..395a2403593f 100644 --- a/scripts/Makefile.host +++ b/scripts/Makefile.host @@ -44,7 +44,7 @@ host-cmulti := $(foreach m,$(__hostprogs),\ host-cobjs := $(sort $(foreach m,$(__hostprogs),$($(m)-objs))) # C++ code -# C++ executables compiled from at least on .cc file +# C++ executables compiled from at least one .cc file # and zero or more .c files host-cxxmulti := $(foreach m,$(__hostprogs),$(if $($(m)-cxxobjs),$(m))) -- cgit v1.2.3-59-g8ed1b From edb950c17de09ed04be1ed2c451ba207e3b0a29b Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Wed, 16 Jul 2014 16:12:20 +0900 Subject: kbuild: fix a bug of C++ host program handling The comment claims: C++ executables compiled from at least one .cc file and zero or more .c files But C++ executables with zero .c file fail in build. For example, assume we have a Makefile like this: hostprogs-y := foo foo-cxxobjs := bar.o In this case, foo is treated as host-csingle and Kbuild tries to search non-existing foo.c source. Signed-off-by: Masahiro Yamada Signed-off-by: Michal Marek --- scripts/Makefile.host | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/Makefile.host b/scripts/Makefile.host index 395a2403593f..bf44e7988bf4 100644 --- a/scripts/Makefile.host +++ b/scripts/Makefile.host @@ -34,7 +34,8 @@ __hostprogs := $(sort $(hostprogs-y) $(hostprogs-m)) # C code # Executables compiled from a single .c file -host-csingle := $(foreach m,$(__hostprogs),$(if $($(m)-objs),,$(m))) +host-csingle := $(foreach m,$(__hostprogs), \ + $(if $($(m)-objs)$($(m)-cxxobjs),,$(m))) # C executables linked based on several .o files host-cmulti := $(foreach m,$(__hostprogs),\ -- cgit v1.2.3-59-g8ed1b From 62e2210798ed38928ab24841e8b4878a2c170af8 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Wed, 16 Jul 2014 16:12:21 +0900 Subject: kbuild: drop shared library support from Makefile.host The shared library feature in Makefile.host is no longer used. Rip it off to keep the build infrastucture simple. Update Documentation/kbuild/makefiles.txt too. The section "4.3 Definition shared libraries" should be removed and the following sections should be re-numbered. Signed-off-by: Masahiro Yamada Suggested-by: Sam Ravnborg Signed-off-by: Michal Marek --- Documentation/kbuild/makefiles.txt | 39 +++++++--------------------------- scripts/Makefile.host | 43 +++----------------------------------- 2 files changed, 11 insertions(+), 71 deletions(-) diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt index d567a7cc552b..3ceadbd99f79 100644 --- a/Documentation/kbuild/makefiles.txt +++ b/Documentation/kbuild/makefiles.txt @@ -23,11 +23,10 @@ This document describes the Linux kernel Makefiles. === 4 Host Program support --- 4.1 Simple Host Program --- 4.2 Composite Host Programs - --- 4.3 Defining shared libraries - --- 4.4 Using C++ for host programs - --- 4.5 Controlling compiler options for host programs - --- 4.6 When host programs are actually built - --- 4.7 Using hostprogs-$(CONFIG_FOO) + --- 4.3 Using C++ for host programs + --- 4.4 Controlling compiler options for host programs + --- 4.5 When host programs are actually built + --- 4.6 Using hostprogs-$(CONFIG_FOO) === 5 Kbuild clean infrastructure @@ -643,29 +642,7 @@ Both possibilities are described in the following. Finally, the two .o files are linked to the executable, lxdialog. Note: The syntax -y is not permitted for host-programs. ---- 4.3 Defining shared libraries - - Objects with extension .so are considered shared libraries, and - will be compiled as position independent objects. - Kbuild provides support for shared libraries, but the usage - shall be restricted. - In the following example the libkconfig.so shared library is used - to link the executable conf. - - Example: - #scripts/kconfig/Makefile - hostprogs-y := conf - conf-objs := conf.o libkconfig.so - libkconfig-objs := expr.o type.o - - Shared libraries always require a corresponding -objs line, and - in the example above the shared library libkconfig is composed by - the two objects expr.o and type.o. - expr.o and type.o will be built as position independent code and - linked as a shared library libkconfig.so. C++ is not supported for - shared libraries. - ---- 4.4 Using C++ for host programs +--- 4.3 Using C++ for host programs kbuild offers support for host programs written in C++. This was introduced solely to support kconfig, and is not recommended @@ -688,7 +665,7 @@ Both possibilities are described in the following. qconf-cxxobjs := qconf.o qconf-objs := check.o ---- 4.5 Controlling compiler options for host programs +--- 4.4 Controlling compiler options for host programs When compiling host programs, it is possible to set specific flags. The programs will always be compiled utilising $(HOSTCC) passed @@ -716,7 +693,7 @@ Both possibilities are described in the following. When linking qconf, it will be passed the extra option "-L$(QTDIR)/lib". ---- 4.6 When host programs are actually built +--- 4.5 When host programs are actually built Kbuild will only build host-programs when they are referenced as a prerequisite. @@ -747,7 +724,7 @@ Both possibilities are described in the following. This will tell kbuild to build lxdialog even if not referenced in any rule. ---- 4.7 Using hostprogs-$(CONFIG_FOO) +--- 4.6 Using hostprogs-$(CONFIG_FOO) A typical pattern in a Kbuild file looks like this: diff --git a/scripts/Makefile.host b/scripts/Makefile.host index bf44e7988bf4..1c2e57000f5a 100644 --- a/scripts/Makefile.host +++ b/scripts/Makefile.host @@ -20,16 +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 -# hostprogs-y := conf -# conf-objs := conf.o libkconfig.so -# libkconfig-objs := expr.o type.o -# Will create a shared library named libkconfig.so that consists of -# expr.o and type.o (they are both compiled as C code and the object files -# are made as position independent code). -# conf.c is compiled as a C program, and conf.o is linked together with -# libkconfig.so as the executable conf. -# Note: Shared libraries consisting of C++ files are not supported - __hostprogs := $(sort $(hostprogs-y) $(hostprogs-m)) # C code @@ -52,15 +42,6 @@ host-cxxmulti := $(foreach m,$(__hostprogs),$(if $($(m)-cxxobjs),$(m))) # C++ Object (.o) files compiled from .cc files host-cxxobjs := $(sort $(foreach m,$(host-cxxmulti),$($(m)-cxxobjs))) -# Shared libaries (only .c supported) -# Shared libraries (.so) - all .so files referenced in "xxx-objs" -host-cshlib := $(sort $(filter %.so, $(host-cobjs))) -# Remove .so files from "xxx-objs" -host-cobjs := $(filter-out %.so,$(host-cobjs)) - -#Object (.o) files used by the shared libaries -host-cshobjs := $(sort $(foreach m,$(host-cshlib),$($(m:.so=-objs)))) - # output directory for programs/.o files # hostprogs-y := tools/build may have been specified. Retrieve directory host-objdirs := $(foreach f,$(__hostprogs), $(if $(dir $(f)),$(dir $(f)))) @@ -82,8 +63,6 @@ host-cmulti := $(addprefix $(obj)/,$(host-cmulti)) host-cobjs := $(addprefix $(obj)/,$(host-cobjs)) host-cxxmulti := $(addprefix $(obj)/,$(host-cxxmulti)) host-cxxobjs := $(addprefix $(obj)/,$(host-cxxobjs)) -host-cshlib := $(addprefix $(obj)/,$(host-cshlib)) -host-cshobjs := $(addprefix $(obj)/,$(host-cshobjs)) host-objdirs := $(addprefix $(obj)/,$(host-objdirs)) obj-dirs += $(host-objdirs) @@ -124,7 +103,7 @@ quiet_cmd_host-cmulti = HOSTLD $@ cmd_host-cmulti = $(HOSTCC) $(HOSTLDFLAGS) -o $@ \ $(addprefix $(obj)/,$($(@F)-objs)) \ $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) -$(host-cmulti): $(obj)/%: $(host-cobjs) $(host-cshlib) FORCE +$(host-cmulti): $(obj)/%: $(host-cobjs) FORCE $(call if_changed,host-cmulti) # Create .o file from a single .c file @@ -141,7 +120,7 @@ quiet_cmd_host-cxxmulti = HOSTLD $@ $(foreach o,objs cxxobjs,\ $(addprefix $(obj)/,$($(@F)-$(o)))) \ $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) -$(host-cxxmulti): $(obj)/%: $(host-cobjs) $(host-cxxobjs) $(host-cshlib) FORCE +$(host-cxxmulti): $(obj)/%: $(host-cobjs) $(host-cxxobjs) FORCE $(call if_changed,host-cxxmulti) # Create .o file from a single .cc (C++) file @@ -150,21 +129,5 @@ quiet_cmd_host-cxxobjs = HOSTCXX $@ $(host-cxxobjs): $(obj)/%.o: $(src)/%.cc FORCE $(call if_changed_dep,host-cxxobjs) -# Compile .c file, create position independent .o file -# host-cshobjs -> .o -quiet_cmd_host-cshobjs = HOSTCC -fPIC $@ - cmd_host-cshobjs = $(HOSTCC) $(hostc_flags) -fPIC -c -o $@ $< -$(host-cshobjs): $(obj)/%.o: $(src)/%.c FORCE - $(call if_changed_dep,host-cshobjs) - -# Link a shared library, based on position independent .o files -# *.o -> .so shared library (host-cshlib) -quiet_cmd_host-cshlib = HOSTLLD -shared $@ - cmd_host-cshlib = $(HOSTCC) $(HOSTLDFLAGS) -shared -o $@ \ - $(addprefix $(obj)/,$($(@F:.so=-objs))) \ - $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) -$(host-cshlib): $(obj)/%: $(host-cshobjs) FORCE - $(call if_changed,host-cshlib) - targets += $(host-csingle) $(host-cmulti) $(host-cobjs)\ - $(host-cxxmulti) $(host-cxxobjs) $(host-cshlib) $(host-cshobjs) + $(host-cxxmulti) $(host-cxxobjs) -- cgit v1.2.3-59-g8ed1b From 663935593915ad8dc43d10f58ef5eeefc77ef8c4 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Wed, 16 Jul 2014 16:12:22 +0900 Subject: kbuild: clean up scripts/Makefile.host The directory creation can be more simplified by two levels. [1] Drop $(dir ...) $(dir $(f)) always returns non-empty string. So, $(if $(dir $(f)),$(dir $(f)) is equivalent to $(dir $(f)). [2] Unroll $(foreach ...) loop $(dir ...) can take one or more arguments and returns a list of directories of them. $(foreach f, $(progs), $(dir $(f))) can be unrolled as $(dir $(progs)). Signed-off-by: Masahiro Yamada Signed-off-by: Michal Marek --- scripts/Makefile.host | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/scripts/Makefile.host b/scripts/Makefile.host index 1c2e57000f5a..bb6a11f4f193 100644 --- a/scripts/Makefile.host +++ b/scripts/Makefile.host @@ -44,15 +44,11 @@ host-cxxobjs := $(sort $(foreach m,$(host-cxxmulti),$($(m)-cxxobjs))) # output directory for programs/.o files # hostprogs-y := tools/build may have been specified. Retrieve directory -host-objdirs := $(foreach f,$(__hostprogs), $(if $(dir $(f)),$(dir $(f)))) +host-objdirs := $(dir $(__hostprogs)) # directory of .o files from prog-objs notation -host-objdirs += $(foreach f,$(host-cmulti), \ - $(foreach m,$($(f)-objs), \ - $(if $(dir $(m)),$(dir $(m))))) +host-objdirs += $(dir $(foreach f,$(host-cmulti), $($(f)-objs))) # directory of .o files from prog-cxxobjs notation -host-objdirs += $(foreach f,$(host-cxxmulti), \ - $(foreach m,$($(f)-cxxobjs), \ - $(if $(dir $(m)),$(dir $(m))))) +host-objdirs += $(dir $(foreach f,$(host-cxxmulti), $($(f)-cxxobjs))) host-objdirs := $(strip $(sort $(filter-out ./,$(host-objdirs)))) -- cgit v1.2.3-59-g8ed1b From 1791ff7179f689cb54182a1215686f8138850412 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Wed, 16 Jul 2014 16:12:23 +0900 Subject: kbuild: clean-up and bug fix of scripts/Makefile.host Assume we have a Makefile like this: hostprogs-y := foo foo-cxxobjs := bar/baz.o foo-objs := qux/quux.o In this case, Kbuild creates bar/ directory, but fails to create qux/ directory. This commit re-writes directory creation more simply, fixing that bug. Signed-off-by: Masahiro Yamada Signed-off-by: Michal Marek --- scripts/Makefile.host | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/scripts/Makefile.host b/scripts/Makefile.host index bb6a11f4f193..ab5980f91714 100644 --- a/scripts/Makefile.host +++ b/scripts/Makefile.host @@ -43,12 +43,9 @@ host-cxxmulti := $(foreach m,$(__hostprogs),$(if $($(m)-cxxobjs),$(m))) host-cxxobjs := $(sort $(foreach m,$(host-cxxmulti),$($(m)-cxxobjs))) # output directory for programs/.o files -# hostprogs-y := tools/build may have been specified. Retrieve directory -host-objdirs := $(dir $(__hostprogs)) -# directory of .o files from prog-objs notation -host-objdirs += $(dir $(foreach f,$(host-cmulti), $($(f)-objs))) -# directory of .o files from prog-cxxobjs notation -host-objdirs += $(dir $(foreach f,$(host-cxxmulti), $($(f)-cxxobjs))) +# hostprogs-y := tools/build may have been specified. +# Retrieve also directory of .o files from prog-objs or prog-cxxobjs notation +host-objdirs := $(dir $(__hostprogs) $(host-cobjs) $(host-cxxobjs)) host-objdirs := $(strip $(sort $(filter-out ./,$(host-objdirs)))) -- cgit v1.2.3-59-g8ed1b From 011bf1254772b20083b1bab53f3aa58b1ec95eb1 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Fri, 18 Jul 2014 13:40:11 +0900 Subject: kbuild: allow to override Python command name The specification of Python 3 is largely different from that of Python 2. For example, arch/ia64/scripts/unwcheck.py seems to be written in Python 2, not compatible with Python 3. It is not a good idea to invoke python scripts with the hard-coded command name 'python'. The command 'python' could possibly be Python 3 on some systems. For that case, it is reasonable to allow to override the command name by giving 'PYTHON=python2' from the command line. The 'python' in arch/ia64/Makefile should be replaced with '$(PYTHON)'. Signed-off-by: Masahiro Yamada Cc: linux-ia64@vger.kernel.org Signed-off-by: Michal Marek --- Makefile | 3 ++- arch/ia64/Makefile | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 97b286128c1e..89fe23a0825c 100644 --- a/Makefile +++ b/Makefile @@ -366,6 +366,7 @@ GENKSYMS = scripts/genksyms/genksyms INSTALLKERNEL := installkernel DEPMOD = /sbin/depmod PERL = perl +PYTHON = python CHECK = sparse CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \ @@ -416,7 +417,7 @@ KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(S 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 MAKE AWK GENKSYMS INSTALLKERNEL PERL PYTHON UTS_MACHINE export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS diff --git a/arch/ia64/Makefile b/arch/ia64/Makefile index f37238f45bcd..5441b14994fc 100644 --- a/arch/ia64/Makefile +++ b/arch/ia64/Makefile @@ -76,7 +76,7 @@ vmlinux.gz: vmlinux $(Q)$(MAKE) $(build)=$(boot) $@ unwcheck: vmlinux - -$(Q)READELF=$(READELF) python $(srctree)/arch/ia64/scripts/unwcheck.py $< + -$(Q)READELF=$(READELF) $(PYTHON) $(srctree)/arch/ia64/scripts/unwcheck.py $< archclean: $(Q)$(MAKE) $(clean)=$(boot) -- cgit v1.2.3-59-g8ed1b From 866ced950bcd54820c3e571229356adc2b2dd72e Mon Sep 17 00:00:00 2001 From: Andi Kleen Date: Wed, 30 Jul 2014 20:50:18 +0200 Subject: kbuild: Support split debug info v4 This is an alternative approach to lower the overhead of debug info (as we discussed a few days ago) gcc 4.7+ and newer binutils have a new "split debug info" debug info model where the debug info is only written once into central ".dwo" files. This avoids having to copy it around multiple times, from the object files to the final executable. It lowers the disk space requirements. In addition it defaults to compressed debug data. More details here: http://gcc.gnu.org/wiki/DebugFission This patch adds a new option to enable it. It has to be an option, because it'll undoubtedly break everyone's debuginfo packaging scheme. gdb/objdump/etc. all still work, if you have new enough versions. I don't see big compile wins (maybe a second or two faster or so), but the object dirs with debuginfo get significantly smaller. My standard kernel config (slightly bigger than defconfig) shrinks from 2.9G disk space to 1.1G objdir (with non reduced debuginfo). I presume if you are IO limited the compile time difference will be larger. Only problem I've seen so far is that it doesn't play well with older versions of ccache (apparently fixed, see https://bugzilla.samba.org/show_bug.cgi?id=10005) v2: various fixes from Dirk Gouders. Improve commit message slightly. v3: Fix clean rules and improve Kconfig slightly v4: Fix merge error in last version (Sam Ravnborg) Clarify description that it mainly helps disk size. Cc: Dirk Gouders Signed-off-by: Andi Kleen Acked-by: Sam Ravnborg Signed-off-by: Michal Marek --- .gitignore | 1 + Makefile | 5 +++++ lib/Kconfig.debug | 15 +++++++++++++++ 3 files changed, 21 insertions(+) diff --git a/.gitignore b/.gitignore index f4c0b091dcf4..e213b27f3921 100644 --- a/.gitignore +++ b/.gitignore @@ -34,6 +34,7 @@ *.gcno modules.builtin Module.symvers +*.dwo # # Top-level generic files diff --git a/Makefile b/Makefile index 89fe23a0825c..e5a269465f99 100644 --- a/Makefile +++ b/Makefile @@ -684,7 +684,11 @@ endif endif ifdef CONFIG_DEBUG_INFO +ifdef CONFIG_DEBUG_INFO_SPLIT +KBUILD_CFLAGS += $(call cc-option, -gsplit-dwarf, -g) +else KBUILD_CFLAGS += -g +endif KBUILD_AFLAGS += -Wa,-gdwarf-2 endif @@ -1372,6 +1376,7 @@ clean: $(clean-dirs) @find $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \ \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ -o -name '*.ko.*' \ + -o -name '*.dwo' \ -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ -o -name '*.symtypes' -o -name 'modules.order' \ -o -name modules.builtin -o -name '.tmp_*.o.*' \ diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 7cfcc1b8e101..910355da9d14 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -143,6 +143,21 @@ config DEBUG_INFO_REDUCED DEBUG_INFO build and compile times are reduced too. Only works with newer gcc versions. +config DEBUG_INFO_SPLIT + bool "Produce split debuginfo in .dwo files" + depends on DEBUG_INFO + help + Generate debug info into separate .dwo files. This significantly + reduces the build directory size for builds with DEBUG_INFO, + because it stores the information only once on disk in .dwo + files instead of multiple times in object files and executables. + In addition the debug information is also compressed. + + Requires recent gcc (4.7+) and recent gdb/binutils. + Any tool that packages or reads debug information would need + to know about the .dwo files and include them. + Incompatible with older versions of ccache. + config ENABLE_WARN_DEPRECATED bool "Enable __deprecated logic" default y -- cgit v1.2.3-59-g8ed1b From bfaf2dd3509bc73bf4a4cea0e72472755ed860e2 Mon Sep 17 00:00:00 2001 From: Andi Kleen Date: Wed, 30 Jul 2014 20:50:19 +0200 Subject: Kbuild: Add a option to enable dwarf4 v2 I found that a lot of unresolvable variables when using gdb on the kernel become resolvable when dwarf4 is enabled. So add a Kconfig flag to enable it. It definitely increases the debug information size, but on the other hand this isn't so bad when debug fusion is used. v2: Use cc-option Signed-off-by: Andi Kleen Acked-by: Sam Ravnborg Signed-off-by: Michal Marek --- Makefile | 3 +++ lib/Kconfig.debug | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/Makefile b/Makefile index e5a269465f99..2fd21a58f5cf 100644 --- a/Makefile +++ b/Makefile @@ -691,6 +691,9 @@ KBUILD_CFLAGS += -g endif KBUILD_AFLAGS += -Wa,-gdwarf-2 endif +ifdef CONFIG_DEBUG_INFO_DWARF4 +KBUILD_CFLAGS += $(call cc-option, -gdwarf-4,) +endif ifdef CONFIG_DEBUG_INFO_REDUCED KBUILD_CFLAGS += $(call cc-option, -femit-struct-debug-baseonly) \ diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 910355da9d14..d70f203ce710 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -158,6 +158,15 @@ config DEBUG_INFO_SPLIT to know about the .dwo files and include them. Incompatible with older versions of ccache. +config DEBUG_INFO_DWARF4 + bool "Generate dwarf4 debuginfo" + depends on DEBUG_INFO + help + Generate dwarf4 debug info. This requires recent versions + of gcc and gdb. It makes the debug information larger. + But it significantly improves the success of resolving + variables in gdb on optimized code. + config ENABLE_WARN_DEPRECATED bool "Enable __deprecated logic" default y -- cgit v1.2.3-59-g8ed1b From 26ea6bb1fef06c686be771903ecab0518af5c2de Mon Sep 17 00:00:00 2001 From: Behan Webster Date: Thu, 31 Jul 2014 21:08:25 -0700 Subject: kbuild, LLVMLinux: Supress warnings unless W=1-3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit clang has more warnings enabled by default. Turn them off unless W is set. This patch fixes a logic bug where warnings in clang were disabled when W was set. Signed-off-by: Behan Webster Signed-off-by: Jan-Simon Möller Signed-off-by: Mark Charlebois Cc: bp@alien8.de Signed-off-by: Michal Marek --- Makefile | 1 + scripts/Makefile.extrawarn | 21 +++++++++++---------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 2fd21a58f5cf..4aef4f861238 100644 --- a/Makefile +++ b/Makefile @@ -663,6 +663,7 @@ KBUILD_CFLAGS += $(call cc-disable-warning, tautological-compare) # source of a reference will be _MergedGlobals and not on of the whitelisted names. # See modpost pattern 2 KBUILD_CFLAGS += $(call cc-option, -mno-global-merge,) +KBUILD_CFLAGS += $(call cc-option, -fcatch-undefined-behavior) else # This warning generated too much noise in a regular build. diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn index 65643506c71c..f734033af219 100644 --- a/scripts/Makefile.extrawarn +++ b/scripts/Makefile.extrawarn @@ -26,16 +26,6 @@ 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) -# Clang -warning-1 += $(call cc-disable-warning, initializer-overrides) -warning-1 += $(call cc-disable-warning, unused-value) -warning-1 += $(call cc-disable-warning, format) -warning-1 += $(call cc-disable-warning, unknown-warning-option) -warning-1 += $(call cc-disable-warning, sign-compare) -warning-1 += $(call cc-disable-warning, format-zero-length) -warning-1 += $(call cc-disable-warning, uninitialized) -warning-1 += $(call cc-option, -fcatch-undefined-behavior) - warning-2 := -Waggregate-return warning-2 += -Wcast-align warning-2 += -Wdisabled-optimization @@ -64,4 +54,15 @@ ifeq ("$(strip $(warning))","") endif KBUILD_CFLAGS += $(warning) +else + +ifeq ($(COMPILER),clang) +KBUILD_CFLAGS += $(call cc-disable-warning, initializer-overrides) +KBUILD_CFLAGS += $(call cc-disable-warning, unused-value) +KBUILD_CFLAGS += $(call cc-disable-warning, format) +KBUILD_CFLAGS += $(call cc-disable-warning, unknown-warning-option) +KBUILD_CFLAGS += $(call cc-disable-warning, sign-compare) +KBUILD_CFLAGS += $(call cc-disable-warning, format-zero-length) +KBUILD_CFLAGS += $(call cc-disable-warning, uninitialized) +endif endif -- cgit v1.2.3-59-g8ed1b From 164f0d2efaaef835473e74b162eae750341d6a8c Mon Sep 17 00:00:00 2001 From: Michal Marek Date: Thu, 7 Aug 2014 21:39:57 +0200 Subject: kbuild: Fix handling of backslashes in *.cmd files Commit c353acba ("kbuild: make: fix if_changed when command contains backslashes") attempted to handle backslashes in *.cmd files, but it only handled double backslashes for some reason. Changing make-cmd to also handle single backslashes fixes rebuilds with dash, but it breaks bash again. The reason is that the two shells disagree about the interpretation of backslash sequences in the echo builtin. The way out of this is to print the command with printf '%s\n'. While at it, document what the individual parts of make-cmd do and why. Reported-and-tested-by: Konstantin Khlebnikov Reviewed-by: Sam Ravnborg Signed-off-by: Michal Marek --- scripts/Kbuild.include | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 122f95c95869..8a9a4e1c7eab 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -215,11 +215,13 @@ else arg-check = $(if $(strip $(cmd_$@)),,1) endif -# >'< substitution is for echo to work, -# >$< substitution to preserve $ when reloading .cmd file -# note: when using inline perl scripts [perl -e '...$$t=1;...'] -# in $(cmd_xxx) double $$ your perl vars -make-cmd = $(subst \\,\\\\,$(subst \#,\\\#,$(subst $$,$$$$,$(call escsq,$(cmd_$(1)))))) +# Replace >$< with >$$< to preserve $ when reloading the .cmd file +# (needed for make) +# Replace >#< with >\#< to avoid starting a comment in the .cmd file +# (needed for make) +# Replace >'< with >'\''< to be able to enclose the whole string in '...' +# (needed for the shell) +make-cmd = $(call escsq,$(subst \#,\\\#,$(subst $$,$$$$,$(cmd_$(1))))) # Find any prerequisites that is newer than target or that does not exist. # PHONY targets skipped in both cases. @@ -230,7 +232,7 @@ any-prereq = $(filter-out $(PHONY),$?) $(filter-out $(PHONY) $(wildcard $^),$^) if_changed = $(if $(strip $(any-prereq) $(arg-check)), \ @set -e; \ $(echo-cmd) $(cmd_$(1)); \ - echo 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd) + printf '%s\n' 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd) # Execute the command and also postprocess generated .d dependencies file. if_changed_dep = $(if $(strip $(any-prereq) $(arg-check) ), \ -- cgit v1.2.3-59-g8ed1b