Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-fixes

* git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-fixes:
Fix incompatibility with versions of Perl less than 5.6.0
kbuild: do not include arch/<ARCH>/include/asm in find-sources twice.
kbuild: tag with git revision when git describe is missing
kbuild: prevent modpost from looking for a .cmd file for a static library linked into a module
kbuild: fix KBUILD_EXTRA_SYMBOLS
adjust init section definitions
scripts/checksyscalls.sh: fix for non-gnu sed
scripts/package: don't break if %{_smp_mflags} isn't set
kbuild: setlocalversion: dont include svn change count
kbuild: improve check-symlink
kbuild: mkspec - fix build rpm

+48 -22
+7 -1
Makefile
··· 961 961 962 962 # The asm symlink changes when $(ARCH) changes. 963 963 # Detect this and ask user to run make mrproper 964 + # If asm is a stale symlink (point to dir that does not exist) remove it 964 965 define check-symlink 965 966 set -e; \ 966 967 if [ -L include/asm ]; then \ ··· 971 970 echo " set ARCH or save .config and run 'make mrproper' to fix it"; \ 972 971 exit 1; \ 973 972 fi; \ 973 + test -e $$asmlink || rm include/asm; \ 974 + elif [ -d include/asm ]; then \ 975 + echo "ERROR: $@ is a directory but a symlink was expected";\ 976 + exit 1; \ 974 977 fi 975 978 endef 976 979 ··· 1436 1431 define find-sources 1437 1432 ( for arch in $(ALLSOURCE_ARCHS) ; do \ 1438 1433 find $(__srctree)arch/$${arch} $(RCS_FIND_IGNORE) \ 1439 - -name $1 -print; \ 1434 + -wholename $(__srctree)arch/$${arch}/include/asm -type d -prune \ 1435 + -o -name $1 -print; \ 1440 1436 done ; \ 1441 1437 find $(__srctree)security/selinux/include $(RCS_FIND_IGNORE) \ 1442 1438 -name $1 -print; \
+5 -1
include/linux/init.h
··· 112 112 #define __FINIT .previous 113 113 114 114 #define __INITDATA .section ".init.data","aw" 115 + #define __INITRODATA .section ".init.rodata","a" 115 116 #define __FINITDATA .previous 116 117 117 118 #define __DEVINIT .section ".devinit.text", "ax" 118 119 #define __DEVINITDATA .section ".devinit.data", "aw" 120 + #define __DEVINITRODATA .section ".devinit.rodata", "a" 119 121 120 122 #define __CPUINIT .section ".cpuinit.text", "ax" 121 123 #define __CPUINITDATA .section ".cpuinit.data", "aw" 124 + #define __CPUINITRODATA .section ".cpuinit.rodata", "a" 122 125 123 126 #define __MEMINIT .section ".meminit.text", "ax" 124 127 #define __MEMINITDATA .section ".meminit.data", "aw" 128 + #define __MEMINITRODATA .section ".meminit.rodata", "a" 125 129 126 130 /* silence warnings when references are OK */ 127 131 #define __REF .section ".ref.text", "ax" 128 132 #define __REFDATA .section ".ref.data", "aw" 129 - #define __REFCONST .section ".ref.rodata", "aw" 133 + #define __REFCONST .section ".ref.rodata", "a" 130 134 131 135 #ifndef __ASSEMBLY__ 132 136 /*
+1 -1
scripts/Makefile.modpost
··· 82 82 $(if $(CONFIG_MODULE_SRCVERSION_ALL),-a,) \ 83 83 $(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile) \ 84 84 $(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \ 85 - $(if $(KBUILD_EXTRA_SYMBOLS), $(patsubst %, -e %,$(EXTRA_SYMBOLS))) \ 85 + $(if $(KBUILD_EXTRA_SYMBOLS), $(patsubst %, -e %,$(KBUILD_EXTRA_SYMBOLS))) \ 86 86 $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \ 87 87 $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \ 88 88 $(if $(CONFIG_MARKERS),-K $(kernelmarkersfile)) \
+2 -2
scripts/checksyscalls.sh
··· 113 113 } 114 114 115 115 syscall_list() { 116 - sed -n -e '/^\#define/ { s/[^_]*__NR_\([^[:space:]]*\).*/\ 116 + sed -n -e '/^\#define/ s/[^_]*__NR_\([^[:space:]]*\).*/\ 117 117 \#if !defined \(__NR_\1\) \&\& !defined \(__IGNORE_\1\)\ 118 118 \#warning syscall \1 not implemented\ 119 - \#endif/p }' $1 119 + \#endif/p' $1 120 120 } 121 121 122 122 (ignore_list && syscall_list ${srctree}/arch/x86/include/asm/unistd_32.h) | \
+5 -5
scripts/headers_check.pl
··· 1 - #!/usr/bin/perl 1 + #!/usr/bin/perl -w 2 2 # 3 3 # headers_check.pl execute a number of trivial consistency checks 4 4 # ··· 17 17 # 2) TODO: check for leaked CONFIG_ symbols 18 18 19 19 use strict; 20 - use warnings; 21 20 22 21 my ($dir, $arch, @files) = @ARGV; 23 22 ··· 26 27 my $filename; 27 28 28 29 foreach my $file (@files) { 30 + local *FH; 29 31 $filename = $file; 30 - open(my $fh, '<', "$filename") or die "$filename: $!\n"; 32 + open(FH, "<$filename") or die "$filename: $!\n"; 31 33 $lineno = 0; 32 - while ($line = <$fh>) { 34 + while ($line = <FH>) { 33 35 $lineno++; 34 36 check_include(); 35 37 } 36 - close $fh; 38 + close FH; 37 39 } 38 40 exit $ret; 39 41
+9 -8
scripts/headers_install.pl
··· 1 - #!/usr/bin/perl 1 + #!/usr/bin/perl -w 2 2 # 3 3 # headers_install prepare the listed header files for use in 4 4 # user space and copy the files to their destination. ··· 17 17 # 3) Drop all sections defined out by __KERNEL__ (using unifdef) 18 18 19 19 use strict; 20 - use warnings; 21 20 22 21 my ($readdir, $installdir, $arch, @files) = @ARGV; 23 22 24 23 my $unifdef = "scripts/unifdef -U__KERNEL__"; 25 24 26 25 foreach my $file (@files) { 26 + local *INFILE; 27 + local *OUTFILE; 27 28 my $tmpfile = "$installdir/$file.tmp"; 28 - open(my $infile, '<', "$readdir/$file") 29 + open(INFILE, "<$readdir/$file") 29 30 or die "$readdir/$file: $!\n"; 30 - open(my $outfile, '>', "$tmpfile") or die "$tmpfile: $!\n"; 31 - while (my $line = <$infile>) { 31 + open(OUTFILE, ">$tmpfile") or die "$tmpfile: $!\n"; 32 + while (my $line = <INFILE>) { 32 33 $line =~ s/([\s(])__user\s/$1/g; 33 34 $line =~ s/([\s(])__force\s/$1/g; 34 35 $line =~ s/([\s(])__iomem\s/$1/g; 35 36 $line =~ s/\s__attribute_const__\s/ /g; 36 37 $line =~ s/\s__attribute_const__$//g; 37 38 $line =~ s/^#include <linux\/compiler.h>//; 38 - printf $outfile "%s", $line; 39 + printf OUTFILE "%s", $line; 39 40 } 40 - close $outfile; 41 - close $infile; 41 + close OUTFILE; 42 + close INFILE; 42 43 system $unifdef . " $tmpfile > $installdir/$file"; 43 44 unlink $tmpfile; 44 45 }
+11 -1
scripts/mod/sumversion.c
··· 290 290 release_file(file, len); 291 291 return 1; 292 292 } 293 + /* Check whether the file is a static library or not */ 294 + static int is_static_library(const char *objfile) 295 + { 296 + int len = strlen(objfile); 297 + if (objfile[len - 2] == '.' && objfile[len - 1] == 'a') 298 + return 1; 299 + else 300 + return 0; 301 + } 293 302 294 303 /* We have dir/file.o. Open dir/.file.o.cmd, look for deps_ line to 295 304 * figure out source file. */ ··· 429 420 while ((fname = strsep(&sources, " ")) != NULL) { 430 421 if (!*fname) 431 422 continue; 432 - if (!parse_source_files(fname, &md)) 423 + if (!(is_static_library(fname)) && 424 + !parse_source_files(fname, &md)) 433 425 goto release; 434 426 } 435 427
+4 -1
scripts/package/mkspec
··· 57 57 echo "%build" 58 58 59 59 if ! $PREBUILT; then 60 - echo "make clean && make %{_smp_mflags}" 60 + echo "make clean && make %{?_smp_mflags}" 61 61 echo "" 62 62 fi 63 63 64 64 echo "%install" 65 65 echo "%ifarch ia64" 66 66 echo 'mkdir -p $RPM_BUILD_ROOT/boot/efi $RPM_BUILD_ROOT/lib/modules' 67 + echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware' 67 68 echo "%else" 68 69 echo 'mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib/modules' 70 + echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware' 69 71 echo "%endif" 70 72 71 73 echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{_smp_mflags} modules_install' ··· 94 92 echo '%defattr (-, root, root)' 95 93 echo "%dir /lib/modules" 96 94 echo "/lib/modules/$KERNELRELEASE" 95 + echo "/lib/firmware" 97 96 echo "/boot/*" 98 97 echo ""
+4 -2
scripts/setlocalversion
··· 9 9 cd "${1:-.}" || usage 10 10 11 11 # Check for git and a git repo. 12 - if head=`git rev-parse --verify HEAD 2>/dev/null`; then 12 + if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then 13 13 # Do we have an untagged version? 14 14 if git name-rev --tags HEAD | grep -E '^HEAD[[:space:]]+(.*~[0-9]*|undefined)$' > /dev/null; then 15 15 if tag=`git describe 2>/dev/null`; then 16 16 echo $tag | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}' 17 + else 18 + printf '%s%s' -g $head 17 19 fi 18 20 fi 19 21 ··· 57 55 58 56 # Are there uncommitted changes? 59 57 if [ $changes != 0 ]; then 60 - printf -- '-svn%s%s%s' "$rev" -dirty "$changes" 58 + printf -- '-svn%s%s' "$rev" -dirty 61 59 else 62 60 printf -- '-svn%s' "$rev" 63 61 fi