Merge branch 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 15 Nov 2013 22:06:38 +0000 (14:06 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 15 Nov 2013 22:06:38 +0000 (14:06 -0800)
Pull kbuild changes from Michal Marek:
 - LTO fixes, but the kallsyms part had to be reverted
 - Pass -Werror=implicit-int and -Werror=strict-prototypes to the
   compiler by default
 - snprintf fix in modpost
 - remove GREP_OPTIONS from the environment to be immune against exotic
   grep option settings

* 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
  kallsyms: Revert back to 128 max symbol length
  Kbuild: Ignore GREP_OPTIONS env variable
  scripts: kallsyms: Use %zu to print 'size_t'
  scripts/bloat-o-meter: use .startswith rather than fragile slicing
  scripts/bloat-o-meter: ignore changes in the size of linux_banner
  kbuild: replace unbounded sprintf call in modpost
  kbuild, bloat-o-meter: fix static detection
  Kbuild: Handle longer symbols in kallsyms.c
  kbuild: Increase kallsyms max symbol length
  Makefile: enable -Werror=implicit-int and -Werror=strict-prototypes by default

1  2 
Makefile
scripts/kallsyms.c

diff --combined Makefile
+++ b/Makefile
@@@ -1,7 -1,7 +1,7 @@@
  VERSION = 3
  PATCHLEVEL = 12
  SUBLEVEL = 0
 -EXTRAVERSION = -rc1
 +EXTRAVERSION =
  NAME = One Giant Leap for Frogkind
  
  # *DOCUMENTATION*
@@@ -22,6 -22,9 +22,9 @@@ LC_COLLATE=
  LC_NUMERIC=C
  export LC_COLLATE LC_NUMERIC
  
+ # Avoid interference with shell env settings
+ unexport GREP_OPTIONS
  # We are using a recursive build, so we need to do a little thinking
  # to get the ordering right.
  #
@@@ -659,6 -662,12 +662,12 @@@ KBUILD_CFLAGS    += $(call cc-option,-fno-
  # conserve stack if available
  KBUILD_CFLAGS   += $(call cc-option,-fconserve-stack)
  
+ # disallow errors like 'EXPORT_GPL(foo);' with missing header
+ KBUILD_CFLAGS   += $(call cc-option,-Werror=implicit-int)
+ # require functions to have arguments in prototypes, not empty 'int foo()'
+ KBUILD_CFLAGS   += $(call cc-option,-Werror=strict-prototypes)
  # use the deterministic mode of AR if available
  KBUILD_ARFLAGS := $(call ar-option,D)
  
@@@ -720,22 -729,6 +729,22 @@@ mod_strip_cmd = tru
  endif # INSTALL_MOD_STRIP
  export mod_strip_cmd
  
 +# Select initial ramdisk compression format, default is gzip(1).
 +# This shall be used by the dracut(8) tool while creating an initramfs image.
 +#
 +INITRD_COMPRESS=gzip
 +ifeq ($(CONFIG_RD_BZIP2), y)
 +        INITRD_COMPRESS=bzip2
 +else ifeq ($(CONFIG_RD_LZMA), y)
 +        INITRD_COMPRESS=lzma
 +else ifeq ($(CONFIG_RD_XZ), y)
 +        INITRD_COMPRESS=xz
 +else ifeq ($(CONFIG_RD_LZO), y)
 +        INITRD_COMPRESS=lzo
 +else ifeq ($(CONFIG_RD_LZ4), y)
 +        INITRD_COMPRESS=lz4
 +endif
 +export INITRD_COMPRESS
  
  ifdef CONFIG_MODULE_SIG_ALL
  MODSECKEY = ./signing_key.priv
diff --combined scripts/kallsyms.c
@@@ -55,7 -55,6 +55,7 @@@ static struct sym_entry *table
  static unsigned int table_size, table_cnt;
  static int all_symbols = 0;
  static char symbol_prefix_char = '\0';
 +static unsigned long long kernel_start_addr = 0;
  
  int token_profit[0x10000];
  
@@@ -66,10 -65,7 +66,10 @@@ unsigned char best_table_len[256]
  
  static void usage(void)
  {
 -      fprintf(stderr, "Usage: kallsyms [--all-symbols] [--symbol-prefix=<prefix char>] < in.map > out.S\n");
 +      fprintf(stderr, "Usage: kallsyms [--all-symbols] "
 +                      "[--symbol-prefix=<prefix char>] "
 +                      "[--page-offset=<CONFIG_PAGE_OFFSET>] "
 +                      "< in.map > out.S\n");
        exit(1);
  }
  
@@@ -115,6 -111,12 +115,12 @@@ static int read_symbol(FILE *in, struc
                        fprintf(stderr, "Read error or end of file.\n");
                return -1;
        }
+       if (strlen(str) > KSYM_NAME_LEN) {
+               fprintf(stderr, "Symbol %s too long for kallsyms (%zu vs %d).\n"
+                                 "Please increase KSYM_NAME_LEN both in kernel and kallsyms.c\n",
+                       str, strlen(str), KSYM_NAME_LEN);
+               return -1;
+       }
  
        sym = str;
        /* skip prefix char */
@@@ -198,9 -200,6 +204,9 @@@ static int symbol_valid(struct sym_entr
        int i;
        int offset = 1;
  
 +      if (s->addr < kernel_start_addr)
 +              return 0;
 +
        /* skip prefix char */
        if (symbol_prefix_char && *(s->sym + 1) == symbol_prefix_char)
                offset++;
@@@ -653,9 -652,6 +659,9 @@@ int main(int argc, char **argv
                                if ((*p == '"' && *(p+2) == '"') || (*p == '\'' && *(p+2) == '\''))
                                        p++;
                                symbol_prefix_char = *p;
 +                      } else if (strncmp(argv[i], "--page-offset=", 14) == 0) {
 +                              const char *p = &argv[i][14];
 +                              kernel_start_addr = strtoull(p, NULL, 16);
                        } else
                                usage();
                }