Merge branch 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 8 Sep 2015 21:12:19 +0000 (14:12 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 8 Sep 2015 21:12:19 +0000 (14:12 -0700)
Pull core kbuild updates from Michal Marek:
 - modpost portability fix
 - linker script fix
 - genksyms segfault fix
 - fixdep cleanup
 - fix for clang detection

* 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
  kbuild: Fix clang detection
  kbuild: fixdep: drop meaningless hash table initialization
  kbuild: fixdep: optimize code slightly
  genksyms: Regenerate parser
  genksyms: Duplicate function pointer type definitions segfault
  kbuild: Fix .text.unlikely placement
  Avoid conflict with host definitions when cross-compiling

1  2 
Makefile
arch/powerpc/Makefile
scripts/Kbuild.include

diff --combined Makefile
+++ b/Makefile
@@@ -1,7 -1,7 +1,7 @@@
  VERSION = 4
  PATCHLEVEL = 2
  SUBLEVEL = 0
 -EXTRAVERSION = -rc1
 +EXTRAVERSION =
  NAME = Hurr durr I'ma sheep
  
  # *DOCUMENTATION*
@@@ -597,11 -597,6 +597,11 @@@ endif # $(dot-config
  # Defaults to vmlinux, but the arch makefile usually adds further targets
  all: vmlinux
  
 +# The arch Makefile can set ARCH_{CPP,A,C}FLAGS to override the default
 +# values of the respective KBUILD_* variables
 +ARCH_CPPFLAGS :=
 +ARCH_AFLAGS :=
 +ARCH_CFLAGS :=
  include arch/$(SRCARCH)/Makefile
  
  KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,)
@@@ -666,14 -661,7 +666,7 @@@ endi
  endif
  KBUILD_CFLAGS += $(stackp-flag)
  
- ifeq ($(shell $(CC) -v 2>&1 | grep -c "clang version"), 1)
- COMPILER := clang
- else
- COMPILER := gcc
- endif
- export COMPILER
- ifeq ($(COMPILER),clang)
+ ifeq ($(cc-name),clang)
  KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,)
  KBUILD_CPPFLAGS += $(call cc-option,-Wno-unknown-warning-option,)
  KBUILD_CFLAGS += $(call cc-disable-warning, unused-variable)
@@@ -785,11 -773,10 +778,11 @@@ endi
  include scripts/Makefile.kasan
  include scripts/Makefile.extrawarn
  
 -# Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments
 -KBUILD_CPPFLAGS += $(KCPPFLAGS)
 -KBUILD_AFLAGS += $(KAFLAGS)
 -KBUILD_CFLAGS += $(KCFLAGS)
 +# Add any arch overrides and user supplied CPPFLAGS, AFLAGS and CFLAGS as the
 +# last assignments
 +KBUILD_CPPFLAGS += $(ARCH_CPPFLAGS) $(KCPPFLAGS)
 +KBUILD_AFLAGS   += $(ARCH_AFLAGS)   $(KAFLAGS)
 +KBUILD_CFLAGS   += $(ARCH_CFLAGS)   $(KCFLAGS)
  
  # Use --build-id when available.
  LDFLAGS_BUILD_ID = $(patsubst -Wl$(comma)%,%,\
@@@ -853,10 -840,10 +846,10 @@@ export mod_strip_cm
  mod_compress_cmd = true
  ifdef CONFIG_MODULE_COMPRESS
    ifdef CONFIG_MODULE_COMPRESS_GZIP
 -    mod_compress_cmd = gzip -n
 +    mod_compress_cmd = gzip -n -f
    endif # CONFIG_MODULE_COMPRESS_GZIP
    ifdef CONFIG_MODULE_COMPRESS_XZ
 -    mod_compress_cmd = xz
 +    mod_compress_cmd = xz -f
    endif # CONFIG_MODULE_COMPRESS_XZ
  endif # CONFIG_MODULE_COMPRESS
  export mod_compress_cmd
@@@ -875,9 -862,10 +868,9 @@@ INITRD_COMPRESS-$(CONFIG_RD_LZ4)   := l
  # export INITRD_COMPRESS := $(INITRD_COMPRESS-y)
  
  ifdef CONFIG_MODULE_SIG_ALL
 -MODSECKEY = ./signing_key.priv
 -MODPUBKEY = ./signing_key.x509
 -export MODPUBKEY
 -mod_sign_cmd = perl $(srctree)/scripts/sign-file $(CONFIG_MODULE_SIG_HASH) $(MODSECKEY) $(MODPUBKEY)
 +$(eval $(call config_filename,MODULE_SIG_KEY))
 +
 +mod_sign_cmd = scripts/sign-file $(CONFIG_MODULE_SIG_HASH) $(MODULE_SIG_KEY_SRCPREFIX)$(CONFIG_MODULE_SIG_KEY) certs/signing_key.x509
  else
  mod_sign_cmd = true
  endif
@@@ -885,7 -873,7 +878,7 @@@ export mod_sign_cm
  
  
  ifeq ($(KBUILD_EXTMOD),)
 -core-y                += kernel/ mm/ fs/ ipc/ security/ crypto/ block/
 +core-y                += kernel/ certs/ mm/ fs/ ipc/ security/ crypto/ block/
  
  vmlinux-dirs  := $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \
                     $(core-y) $(core-m) $(drivers-y) $(drivers-m) \
@@@ -1177,8 -1165,8 +1170,8 @@@ MRPROPER_DIRS  += include/config usr/in
                  arch/*/include/generated .tmp_objdiff
  MRPROPER_FILES += .config .config.old .version .old_version \
                  Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS \
 -                signing_key.priv signing_key.x509 x509.genkey         \
 -                extra_certificates signing_key.x509.keyid             \
 +                signing_key.pem signing_key.priv signing_key.x509     \
 +                x509.genkey extra_certificates signing_key.x509.keyid \
                  signing_key.x509.signer vmlinux-gdb.py
  
  # clean - Delete most, but leave enough to build external modules
diff --combined arch/powerpc/Makefile
@@@ -67,7 -67,7 +67,7 @@@ UTS_MACHINE := $(OLDARCH
  
  ifeq ($(CONFIG_CPU_LITTLE_ENDIAN),y)
  override CC   += -mlittle-endian
- ifneq ($(COMPILER),clang)
+ ifneq ($(cc-name),clang)
  override CC   += -mno-strict-align
  endif
  override AS   += -mlittle-endian
@@@ -288,26 -288,6 +288,26 @@@ PHONY += pseries_le_defconfi
  pseries_le_defconfig:
        $(call merge_into_defconfig,pseries_defconfig,le)
  
 +PHONY += mpc85xx_defconfig
 +mpc85xx_defconfig:
 +      $(call merge_into_defconfig,mpc85xx_basic_defconfig,\
 +              85xx-32bit 85xx-hw fsl-emb-nonhw)
 +
 +PHONY += mpc85xx_smp_defconfig
 +mpc85xx_smp_defconfig:
 +      $(call merge_into_defconfig,mpc85xx_basic_defconfig,\
 +              85xx-32bit 85xx-smp 85xx-hw fsl-emb-nonhw)
 +
 +PHONY += corenet32_smp_defconfig
 +corenet32_smp_defconfig:
 +      $(call merge_into_defconfig,corenet_basic_defconfig,\
 +              85xx-32bit 85xx-smp 85xx-hw fsl-emb-nonhw)
 +
 +PHONY += corenet64_smp_defconfig
 +corenet64_smp_defconfig:
 +      $(call merge_into_defconfig,corenet_basic_defconfig,\
 +              85xx-64bit 85xx-smp altivec 85xx-hw fsl-emb-nonhw)
 +
  define archhelp
    @echo '* zImage          - Build default images selected by kernel config'
    @echo '  zImage.*        - Compressed kernel image (arch/$(ARCH)/boot/zImage.*)'
@@@ -353,7 -333,7 +353,7 @@@ TOUT       := .tmp_gas_chec
  # - Require gcc 4.0 or above on 64-bit
  # - gcc-4.2.0 has issues compiling modules on 64-bit
  checkbin:
-       @if test "${COMPILER}" != "clang" \
+       @if test "$(cc-name)" != "clang" \
            && test "$(cc-version)" = "0304" ; then \
                if ! /bin/echo mftb 5 | $(AS) -v -mppc -many -o $(TOUT) >/dev/null 2>&1 ; then \
                        echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build '; \
                        false; \
                fi ; \
        fi
-       @if test "${COMPILER}" != "clang" \
+       @if test "$(cc-name)" != "clang" \
            && test "$(cc-version)" -lt "0400" \
            && test "x${CONFIG_PPC64}" = "xy" ; then \
                  echo -n "Sorry, GCC v4.0 or above is required to build " ; \
                  echo "the 64-bit powerpc kernel." ; \
                  false ; \
          fi
-       @if test "${COMPILER}" != "clang" \
+       @if test "$(cc-name)" != "clang" \
            && test "$(cc-fullversion)" = "040200" \
            && test "x${CONFIG_MODULES}${CONFIG_PPC64}" = "xyy" ; then \
                echo -n '*** GCC-4.2.0 cannot compile the 64-bit powerpc ' ; \
diff --combined scripts/Kbuild.include
@@@ -128,6 -128,10 +128,10 @@@ cc-option-align = $(subst -functions=0,
  cc-disable-warning = $(call try-run,\
        $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1)))
  
+ # cc-name
+ # Expands to either gcc or clang
+ cc-name = $(shell $(CC) -v 2>&1 | grep -q "clang version" && echo clang || echo gcc)
  # cc-version
  cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh $(CC))
  
@@@ -303,54 -307,3 +307,54 @@@ why 
  
  echo-why = $(call escsq, $(strip $(why)))
  endif
 +
 +###############################################################################
 +#
 +# When a Kconfig string contains a filename, it is suitable for
 +# passing to shell commands. It is surrounded by double-quotes, and
 +# any double-quotes or backslashes within it are escaped by
 +# backslashes.
 +#
 +# This is no use for dependencies or $(wildcard). We need to strip the
 +# surrounding quotes and the escaping from quotes and backslashes, and
 +# we *do* need to escape any spaces in the string. So, for example:
 +#
 +# Usage: $(eval $(call config_filename,FOO))
 +#
 +# Defines FOO_FILENAME based on the contents of the CONFIG_FOO option,
 +# transformed as described above to be suitable for use within the
 +# makefile.
 +#
 +# Also, if the filename is a relative filename and exists in the source
 +# tree but not the build tree, define FOO_SRCPREFIX as $(srctree)/ to
 +# be prefixed to *both* command invocation and dependencies.
 +#
 +# Note: We also print the filenames in the quiet_cmd_foo text, and
 +# perhaps ought to have a version specially escaped for that purpose.
 +# But it's only cosmetic, and $(patsubst "%",%,$(CONFIG_FOO)) is good
 +# enough.  It'll strip the quotes in the common case where there's no
 +# space and it's a simple filename, and it'll retain the quotes when
 +# there's a space. There are some esoteric cases in which it'll print
 +# the wrong thing, but we don't really care. The actual dependencies
 +# and commands *do* get it right, with various combinations of single
 +# and double quotes, backslashes and spaces in the filenames.
 +#
 +###############################################################################
 +#
 +space_escape := %%%SPACE%%%
 +#
 +define config_filename
 +ifneq ($$(CONFIG_$(1)),"")
 +$(1)_FILENAME := $$(subst \\,\,$$(subst \$$(quote),$$(quote),$$(subst $$(space_escape),\$$(space),$$(patsubst "%",%,$$(subst $$(space),$$(space_escape),$$(CONFIG_$(1)))))))
 +ifneq ($$(patsubst /%,%,$$(firstword $$($(1)_FILENAME))),$$(firstword $$($(1)_FILENAME)))
 +else
 +ifeq ($$(wildcard $$($(1)_FILENAME)),)
 +ifneq ($$(wildcard $$(srctree)/$$($(1)_FILENAME)),)
 +$(1)_SRCPREFIX := $(srctree)/
 +endif
 +endif
 +endif
 +endif
 +endef
 +#
 +###############################################################################