tree:   https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git 
rcu/next
head:   19223c8730d289cd4c65b46250b3e02a6752803c
commit: 19223c8730d289cd4c65b46250b3e02a6752803c [97/97] module: Fix pr_fmt() 
bug for header use of printk
config: blackfin-allmodconfig (attached as .config)
compiler: bfin-uclinux-gcc (GCC) 6.2.0
reproduce:
        wget 
https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
        chmod +x ~/bin/make.cross
        git checkout 19223c8730d289cd4c65b46250b3e02a6752803c
        # save the attached .config to linux build tree
        make.cross ARCH=blackfin 

All error/warnings (new ones prefixed by >>):

   In file included from include/linux/printk.h:329:0,
                    from include/linux/kernel.h:13,
                    from include/linux/list.h:8,
                    from include/linux/module.h:9,
                    from include/linux/moduleloader.h:5,
                    from arch/blackfin/kernel/module.c:7:
   arch/blackfin/kernel/module.c: In function 'apply_relocate_add':
>> arch/blackfin/kernel/module.c:20:25: error: expected ')' before 'fmt'
     pr_debug("module %s: " fmt, (mod)->name, ##__VA_ARGS__)
                            ^
   include/linux/dynamic_debug.h:79:14: note: in definition of macro 
'DEFINE_DYNAMIC_DEBUG_METADATA_KEY'
      .format = (fmt),    \
                 ^~~
   include/linux/dynamic_debug.h:124:2: note: in expansion of macro 
'DEFINE_DYNAMIC_DEBUG_METADATA'
     DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt);  \
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/printk.h:333:2: note: in expansion of macro 'dynamic_pr_debug'
     dynamic_pr_debug(fmt, ##__VA_ARGS__)
     ^~~~~~~~~~~~~~~~
>> arch/blackfin/kernel/module.c:20:2: note: in expansion of macro 'pr_debug'
     pr_debug("module %s: " fmt, (mod)->name, ##__VA_ARGS__)
     ^~~~~~~~
>> arch/blackfin/kernel/module.c:163:2: note: in expansion of macro 'mod_debug'
     mod_debug(mod, "applying relocate section %u to %u\n",
     ^~~~~~~~~
   In file included from include/linux/kernel.h:13:0,
                    from include/linux/list.h:8,
                    from include/linux/module.h:9,
                    from include/linux/moduleloader.h:5,
                    from arch/blackfin/kernel/module.c:7:
>> arch/blackfin/kernel/module.c:20:25: error: expected ')' before 'fmt'
     pr_debug("module %s: " fmt, (mod)->name, ##__VA_ARGS__)
                            ^
   include/linux/printk.h:285:21: note: in definition of macro 'pr_fmt'
    #define pr_fmt(fmt) fmt
                        ^~~
   include/linux/printk.h:333:2: note: in expansion of macro 'dynamic_pr_debug'
     dynamic_pr_debug(fmt, ##__VA_ARGS__)
     ^~~~~~~~~~~~~~~~
>> arch/blackfin/kernel/module.c:20:2: note: in expansion of macro 'pr_debug'
     pr_debug("module %s: " fmt, (mod)->name, ##__VA_ARGS__)
     ^~~~~~~~
>> arch/blackfin/kernel/module.c:163:2: note: in expansion of macro 'mod_debug'
     mod_debug(mod, "applying relocate section %u to %u\n",
     ^~~~~~~~~
>> arch/blackfin/kernel/module.c:20:11: warning: format '%s' expects a matching 
>> 'char *' argument [-Wformat=]
     pr_debug("module %s: " fmt, (mod)->name, ##__VA_ARGS__)
              ^
   include/linux/printk.h:285:21: note: in definition of macro 'pr_fmt'
    #define pr_fmt(fmt) fmt
                        ^~~
   include/linux/printk.h:333:2: note: in expansion of macro 'dynamic_pr_debug'
     dynamic_pr_debug(fmt, ##__VA_ARGS__)
     ^~~~~~~~~~~~~~~~
>> arch/blackfin/kernel/module.c:20:2: note: in expansion of macro 'pr_debug'
     pr_debug("module %s: " fmt, (mod)->name, ##__VA_ARGS__)
     ^~~~~~~~
>> arch/blackfin/kernel/module.c:163:2: note: in expansion of macro 'mod_debug'
     mod_debug(mod, "applying relocate section %u to %u\n",
     ^~~~~~~~~
   In file included from include/linux/printk.h:329:0,
                    from include/linux/kernel.h:13,
                    from include/linux/list.h:8,
                    from include/linux/module.h:9,
                    from include/linux/moduleloader.h:5,
                    from arch/blackfin/kernel/module.c:7:
>> arch/blackfin/kernel/module.c:20:25: error: expected ')' before 'fmt'
     pr_debug("module %s: " fmt, (mod)->name, ##__VA_ARGS__)
                            ^
   include/linux/dynamic_debug.h:79:14: note: in definition of macro 
'DEFINE_DYNAMIC_DEBUG_METADATA_KEY'
      .format = (fmt),    \
                 ^~~
   include/linux/dynamic_debug.h:124:2: note: in expansion of macro 
'DEFINE_DYNAMIC_DEBUG_METADATA'
     DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt);  \
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/printk.h:333:2: note: in expansion of macro 'dynamic_pr_debug'
     dynamic_pr_debug(fmt, ##__VA_ARGS__)
     ^~~~~~~~~~~~~~~~
>> arch/blackfin/kernel/module.c:20:2: note: in expansion of macro 'pr_debug'
     pr_debug("module %s: " fmt, (mod)->name, ##__VA_ARGS__)
     ^~~~~~~~
   arch/blackfin/kernel/module.c:186:3: note: in expansion of macro 'mod_debug'
      mod_debug(mod, "location is %lx, value is %lx type is %d\n",
      ^~~~~~~~~
   In file included from include/linux/kernel.h:13:0,
                    from include/linux/list.h:8,
                    from include/linux/module.h:9,
                    from include/linux/moduleloader.h:5,
                    from arch/blackfin/kernel/module.c:7:
>> arch/blackfin/kernel/module.c:20:25: error: expected ')' before 'fmt'
     pr_debug("module %s: " fmt, (mod)->name, ##__VA_ARGS__)
                            ^
   include/linux/printk.h:285:21: note: in definition of macro 'pr_fmt'
    #define pr_fmt(fmt) fmt
                        ^~~
   include/linux/printk.h:333:2: note: in expansion of macro 'dynamic_pr_debug'
     dynamic_pr_debug(fmt, ##__VA_ARGS__)
     ^~~~~~~~~~~~~~~~
>> arch/blackfin/kernel/module.c:20:2: note: in expansion of macro 'pr_debug'
     pr_debug("module %s: " fmt, (mod)->name, ##__VA_ARGS__)
     ^~~~~~~~
   arch/blackfin/kernel/module.c:186:3: note: in expansion of macro 'mod_debug'
      mod_debug(mod, "location is %lx, value is %lx type is %d\n",
      ^~~~~~~~~
>> arch/blackfin/kernel/module.c:20:11: warning: format '%s' expects a matching 
>> 'char *' argument [-Wformat=]
     pr_debug("module %s: " fmt, (mod)->name, ##__VA_ARGS__)
              ^
   include/linux/printk.h:285:21: note: in definition of macro 'pr_fmt'
    #define pr_fmt(fmt) fmt
                        ^~~
   include/linux/printk.h:333:2: note: in expansion of macro 'dynamic_pr_debug'
     dynamic_pr_debug(fmt, ##__VA_ARGS__)
     ^~~~~~~~~~~~~~~~
>> arch/blackfin/kernel/module.c:20:2: note: in expansion of macro 'pr_debug'
     pr_debug("module %s: " fmt, (mod)->name, ##__VA_ARGS__)
     ^~~~~~~~
   arch/blackfin/kernel/module.c:186:3: note: in expansion of macro 'mod_debug'
      mod_debug(mod, "location is %lx, value is %lx type is %d\n",
      ^~~~~~~~~

vim +20 arch/blackfin/kernel/module.c

     1  /*
     2   * Copyright 2004-2009 Analog Devices Inc.
     3   *
     4   * Licensed under the GPL-2 or later
     5   */
     6  
   > 7  #include <linux/moduleloader.h>
     8  #include <linux/elf.h>
     9  #include <linux/vmalloc.h>
    10  #include <linux/fs.h>
    11  #include <linux/string.h>
    12  #include <linux/kernel.h>
    13  #include <asm/dma.h>
    14  #include <asm/cacheflush.h>
    15  #include <linux/uaccess.h>
    16  
    17  #define mod_err(mod, fmt, ...)                                          
\
    18          pr_err("module %s: " fmt, (mod)->name, ##__VA_ARGS__)
    19  #define mod_debug(mod, ...)                                             
\
  > 20          pr_debug("module %s: " fmt, (mod)->name, ##__VA_ARGS__)
    21  
    22  /* Transfer the section to the L1 memory */
    23  int
    24  module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
    25                            char *secstrings, struct module *mod)
    26  {
    27          /*
    28           * XXX: sechdrs are vmalloced in kernel/module.c
    29           * and would be vfreed just after module is loaded,
    30           * so we hack to keep the only information we needed
    31           * in mod->arch to correctly free L1 I/D sram later.
    32           * NOTE: this breaks the semantic of mod->arch structure.
    33           */
    34          Elf_Shdr *s, *sechdrs_end = sechdrs + hdr->e_shnum;
    35          void *dest;
    36  
    37          for (s = sechdrs; s < sechdrs_end; ++s) {
    38                  const char *shname = secstrings + s->sh_name;
    39  
    40                  if (s->sh_size == 0)
    41                          continue;
    42  
    43                  if (!strcmp(".l1.text", shname) ||
    44                      (!strcmp(".text", shname) &&
    45                       (hdr->e_flags & EF_BFIN_CODE_IN_L1))) {
    46  
    47                          dest = l1_inst_sram_alloc(s->sh_size);
    48                          mod->arch.text_l1 = dest;
    49                          if (dest == NULL) {
    50                                  mod_err(mod, "L1 inst memory allocation 
failed\n");
    51                                  return -1;
    52                          }
    53                          dma_memcpy(dest, (void *)s->sh_addr, 
s->sh_size);
    54  
    55                  } else if (!strcmp(".l1.data", shname) ||
    56                             (!strcmp(".data", shname) &&
    57                              (hdr->e_flags & EF_BFIN_DATA_IN_L1))) {
    58  
    59                          dest = l1_data_sram_alloc(s->sh_size);
    60                          mod->arch.data_a_l1 = dest;
    61                          if (dest == NULL) {
    62                                  mod_err(mod, "L1 data memory allocation 
failed\n");
    63                                  return -1;
    64                          }
    65                          memcpy(dest, (void *)s->sh_addr, s->sh_size);
    66  
    67                  } else if (!strcmp(".l1.bss", shname) ||
    68                             (!strcmp(".bss", shname) &&
    69                              (hdr->e_flags & EF_BFIN_DATA_IN_L1))) {
    70  
    71                          dest = l1_data_sram_zalloc(s->sh_size);
    72                          mod->arch.bss_a_l1 = dest;
    73                          if (dest == NULL) {
    74                                  mod_err(mod, "L1 data memory allocation 
failed\n");
    75                                  return -1;
    76                          }
    77  
    78                  } else if (!strcmp(".l1.data.B", shname)) {
    79  
    80                          dest = l1_data_B_sram_alloc(s->sh_size);
    81                          mod->arch.data_b_l1 = dest;
    82                          if (dest == NULL) {
    83                                  mod_err(mod, "L1 data memory allocation 
failed\n");
    84                                  return -1;
    85                          }
    86                          memcpy(dest, (void *)s->sh_addr, s->sh_size);
    87  
    88                  } else if (!strcmp(".l1.bss.B", shname)) {
    89  
    90                          dest = l1_data_B_sram_alloc(s->sh_size);
    91                          mod->arch.bss_b_l1 = dest;
    92                          if (dest == NULL) {
    93                                  mod_err(mod, "L1 data memory allocation 
failed\n");
    94                                  return -1;
    95                          }
    96                          memset(dest, 0, s->sh_size);
    97  
    98                  } else if (!strcmp(".l2.text", shname) ||
    99                             (!strcmp(".text", shname) &&
   100                              (hdr->e_flags & EF_BFIN_CODE_IN_L2))) {
   101  
   102                          dest = l2_sram_alloc(s->sh_size);
   103                          mod->arch.text_l2 = dest;
   104                          if (dest == NULL) {
   105                                  mod_err(mod, "L2 SRAM allocation 
failed\n");
   106                                  return -1;
   107                          }
   108                          memcpy(dest, (void *)s->sh_addr, s->sh_size);
   109  
   110                  } else if (!strcmp(".l2.data", shname) ||
   111                             (!strcmp(".data", shname) &&
   112                              (hdr->e_flags & EF_BFIN_DATA_IN_L2))) {
   113  
   114                          dest = l2_sram_alloc(s->sh_size);
   115                          mod->arch.data_l2 = dest;
   116                          if (dest == NULL) {
   117                                  mod_err(mod, "L2 SRAM allocation 
failed\n");
   118                                  return -1;
   119                          }
   120                          memcpy(dest, (void *)s->sh_addr, s->sh_size);
   121  
   122                  } else if (!strcmp(".l2.bss", shname) ||
   123                             (!strcmp(".bss", shname) &&
   124                              (hdr->e_flags & EF_BFIN_DATA_IN_L2))) {
   125  
   126                          dest = l2_sram_zalloc(s->sh_size);
   127                          mod->arch.bss_l2 = dest;
   128                          if (dest == NULL) {
   129                                  mod_err(mod, "L2 SRAM allocation 
failed\n");
   130                                  return -1;
   131                          }
   132  
   133                  } else
   134                          continue;
   135  
   136                  s->sh_flags &= ~SHF_ALLOC;
   137                  s->sh_addr = (unsigned long)dest;
   138          }
   139  
   140          return 0;
   141  }
   142  
   143  
/*************************************************************************/
   144  /* FUNCTION : apply_relocate_add                                        
 */
   145  /* ABSTRACT : Blackfin specific relocation handling for the loadable    
 */
   146  /*            modules. Modules are expected to be .o files.             
 */
   147  /*            Arithmetic relocations are handled.                       
 */
   148  /*            We do not expect LSETUP to be split and hence is not      
 */
   149  /*            handled.                                                  
 */
   150  /*            R_BFIN_BYTE and R_BFIN_BYTE2 are also not handled as the  
 */
   151  /*            gas does not generate it.                                 
 */
   152  
/*************************************************************************/
   153  int
   154  apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab,
   155                     unsigned int symindex, unsigned int relsec,
   156                     struct module *mod)
   157  {
   158          unsigned int i;
   159          Elf32_Rela *rel = (void *)sechdrs[relsec].sh_addr;
   160          Elf32_Sym *sym;
   161          unsigned long location, value, size;
   162  
 > 163          mod_debug(mod, "applying relocate section %u to %u\n",
   164                    relsec, sechdrs[relsec].sh_info);
   165  
   166          for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) {

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip

Reply via email to