]> Git Repo - linux.git/commitdiff
Merge tag 'parisc-for-6.6-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/delle...
authorLinus Torvalds <[email protected]>
Wed, 13 Sep 2023 18:35:53 +0000 (11:35 -0700)
committerLinus Torvalds <[email protected]>
Wed, 13 Sep 2023 18:35:53 +0000 (11:35 -0700)
Pull parisc architecture fixes from Helge Deller:

 - fix reference to exported symbols for parisc64 [Masahiro Yamada]

 - Block-TLB (BTLB) support on 32-bit CPUs

 - sparse and build-warning fixes

* tag 'parisc-for-6.6-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
  linux/export: fix reference to exported functions for parisc64
  parisc: BTLB: Initialize BTLB tables at CPU startup
  parisc: firmware: Simplify calling non-PA20 functions
  parisc: BTLB: _edata symbol has to be page aligned for BTLB support
  parisc: BTLB: Add BTLB insert and purge firmware function wrappers
  parisc: BTLB: Clear possibly existing BTLB entries
  parisc: Prepare for Block-TLB support on 32-bit kernel
  parisc: shmparam.h: Document aliasing requirements of PA-RISC
  parisc: irq: Make irq_stack_union static to avoid sparse warning
  parisc: drivers: Fix sparse warning
  parisc: iosapic.c: Fix sparse warnings
  parisc: ccio-dma: Fix sparse warnings
  parisc: sba-iommu: Fix sparse warnigs
  parisc: sba: Fix compile warning wrt list of SBA devices
  parisc: sba_iommu: Fix build warning if procfs if disabled

1  2 
scripts/mod/modpost.c

diff --combined scripts/mod/modpost.c
index 34a5386d444a6f2943ed52f88088a464185d2c46,ba981f22908adaf96be9a852a49ccb7accc5fdc2..de499dce52652798e8ed731a4544aecc07f15be5
@@@ -24,7 -24,6 +24,7 @@@
  #include "../../include/linux/license.h"
  #include "../../include/linux/module_symbol.h"
  
 +static bool module_enabled;
  /* Are we using CONFIG_MODVERSIONS? */
  static bool modversions;
  /* Is CONFIG_MODULE_SRCVERSION_ALL set? */
@@@ -762,7 -761,6 +762,7 @@@ static const char *const section_white_
        ".fmt_slot*",                   /* EZchip */
        ".gnu.lto*",
        ".discard.*",
 +      ".llvm.call-graph-profile",     /* call graph */
        NULL
  };
  
@@@ -1228,6 -1226,15 +1228,15 @@@ static void check_export_symbol(struct 
         */
        s->is_func = (ELF_ST_TYPE(sym->st_info) == STT_FUNC);
  
+       /*
+        * For parisc64, symbols prefixed $$ from the library have the symbol type
+        * STT_LOPROC. They should be handled as functions too.
+        */
+       if (elf->hdr->e_ident[EI_CLASS] == ELFCLASS64 &&
+           elf->hdr->e_machine == EM_PARISC &&
+           ELF_ST_TYPE(sym->st_info) == STT_LOPROC)
+               s->is_func = true;
        if (match(secname, PATTERNS(INIT_SECTIONS)))
                warn("%s: %s: EXPORT_SYMBOL used for init symbol. Remove __init or EXPORT_SYMBOL.\n",
                     mod->name, name);
@@@ -1244,7 -1251,7 +1253,7 @@@ static void check_section_mismatch(stru
        const char *tosec = sec_name(elf, get_secindex(elf, sym));
        const struct sectioncheck *mismatch;
  
 -      if (elf->export_symbol_secndx == fsecndx) {
 +      if (module_enabled && elf->export_symbol_secndx == fsecndx) {
                check_export_symbol(mod, elf, faddr, tosec, sym);
                return;
        }
                                 tosec, taddr);
  }
  
 -static int addend_386_rel(uint32_t *location, Elf_Rela *r)
 +static Elf_Addr addend_386_rel(uint32_t *location, unsigned int r_type)
  {
 -      unsigned int r_typ = ELF_R_TYPE(r->r_info);
 -
 -      switch (r_typ) {
 +      switch (r_type) {
        case R_386_32:
 -              r->r_addend = TO_NATIVE(*location);
 -              break;
 +              return TO_NATIVE(*location);
        case R_386_PC32:
 -              r->r_addend = TO_NATIVE(*location) + 4;
 -              break;
 -      default:
 -              r->r_addend = (Elf_Addr)(-1);
 +              return TO_NATIVE(*location) + 4;
        }
 -      return 0;
 +
 +      return (Elf_Addr)(-1);
  }
  
  #ifndef R_ARM_CALL
@@@ -1311,28 -1323,32 +1320,28 @@@ static int32_t sign_extend32(int32_t va
        return (int32_t)(value << shift) >> shift;
  }
  
 -static int addend_arm_rel(void *loc, Elf_Sym *sym, Elf_Rela *r)
 +static Elf_Addr addend_arm_rel(void *loc, Elf_Sym *sym, unsigned int r_type)
  {
 -      unsigned int r_typ = ELF_R_TYPE(r->r_info);
        uint32_t inst, upper, lower, sign, j1, j2;
        int32_t offset;
  
 -      switch (r_typ) {
 +      switch (r_type) {
        case R_ARM_ABS32:
        case R_ARM_REL32:
                inst = TO_NATIVE(*(uint32_t *)loc);
 -              r->r_addend = inst + sym->st_value;
 -              break;
 +              return inst + sym->st_value;
        case R_ARM_MOVW_ABS_NC:
        case R_ARM_MOVT_ABS:
                inst = TO_NATIVE(*(uint32_t *)loc);
                offset = sign_extend32(((inst & 0xf0000) >> 4) | (inst & 0xfff),
                                       15);
 -              r->r_addend = offset + sym->st_value;
 -              break;
 +              return offset + sym->st_value;
        case R_ARM_PC24:
        case R_ARM_CALL:
        case R_ARM_JUMP24:
                inst = TO_NATIVE(*(uint32_t *)loc);
                offset = sign_extend32((inst & 0x00ffffff) << 2, 25);
 -              r->r_addend = offset + sym->st_value + 8;
 -              break;
 +              return offset + sym->st_value + 8;
        case R_ARM_THM_MOVW_ABS_NC:
        case R_ARM_THM_MOVT_ABS:
                upper = TO_NATIVE(*(uint16_t *)loc);
                                       ((lower & 0x7000) >> 4) |
                                       (lower & 0x00ff),
                                       15);
 -              r->r_addend = offset + sym->st_value;
 -              break;
 +              return offset + sym->st_value;
        case R_ARM_THM_JUMP19:
                /*
                 * Encoding T3:
                                       ((upper & 0x03f) << 12) |
                                       ((lower & 0x07ff) << 1),
                                       20);
 -              r->r_addend = offset + sym->st_value + 4;
 -              break;
 +              return offset + sym->st_value + 4;
        case R_ARM_THM_CALL:
        case R_ARM_THM_JUMP24:
                /*
                                       ((upper & 0x03ff) << 12) |
                                       ((lower & 0x07ff) << 1),
                                       24);
 -              r->r_addend = offset + sym->st_value + 4;
 -              break;
 -      default:
 -              r->r_addend = (Elf_Addr)(-1);
 +              return offset + sym->st_value + 4;
        }
 -      return 0;
 +
 +      return (Elf_Addr)(-1);
  }
  
 -static int addend_mips_rel(uint32_t *location, Elf_Rela *r)
 +static Elf_Addr addend_mips_rel(uint32_t *location, unsigned int r_type)
  {
 -      unsigned int r_typ = ELF_R_TYPE(r->r_info);
        uint32_t inst;
  
        inst = TO_NATIVE(*location);
 -      switch (r_typ) {
 +      switch (r_type) {
        case R_MIPS_LO16:
 -              r->r_addend = inst & 0xffff;
 -              break;
 +              return inst & 0xffff;
        case R_MIPS_26:
 -              r->r_addend = (inst & 0x03ffffff) << 2;
 -              break;
 +              return (inst & 0x03ffffff) << 2;
        case R_MIPS_32:
 -              r->r_addend = inst;
 -              break;
 -      default:
 -              r->r_addend = (Elf_Addr)(-1);
 +              return inst;
        }
 -      return 0;
 +      return (Elf_Addr)(-1);
  }
  
  #ifndef EM_RISCV
  #define R_LARCH_SUB32         55
  #endif
  
 +static void get_rel_type_and_sym(struct elf_info *elf, uint64_t r_info,
 +                               unsigned int *r_type, unsigned int *r_sym)
 +{
 +      typedef struct {
 +              Elf64_Word    r_sym;    /* Symbol index */
 +              unsigned char r_ssym;   /* Special symbol for 2nd relocation */
 +              unsigned char r_type3;  /* 3rd relocation type */
 +              unsigned char r_type2;  /* 2nd relocation type */
 +              unsigned char r_type;   /* 1st relocation type */
 +      } Elf64_Mips_R_Info;
 +
 +      bool is_64bit = (elf->hdr->e_ident[EI_CLASS] == ELFCLASS64);
 +
 +      if (elf->hdr->e_machine == EM_MIPS && is_64bit) {
 +              Elf64_Mips_R_Info *mips64_r_info = (void *)&r_info;
 +
 +              *r_type = mips64_r_info->r_type;
 +              *r_sym = TO_NATIVE(mips64_r_info->r_sym);
 +              return;
 +      }
 +
 +      if (is_64bit) {
 +              Elf64_Xword r_info64 = r_info;
 +
 +              r_info = TO_NATIVE(r_info64);
 +      } else {
 +              Elf32_Word r_info32 = r_info;
 +
 +              r_info = TO_NATIVE(r_info32);
 +      }
 +
 +      *r_type = ELF_R_TYPE(r_info);
 +      *r_sym = ELF_R_SYM(r_info);
 +}
 +
  static void section_rela(struct module *mod, struct elf_info *elf,
                         Elf_Shdr *sechdr)
  {
        Elf_Rela *rela;
 -      Elf_Rela r;
 -      unsigned int r_sym;
        unsigned int fsecndx = sechdr->sh_info;
        const char *fromsec = sec_name(elf, fsecndx);
        Elf_Rela *start = (void *)elf->hdr + sechdr->sh_offset;
                return;
  
        for (rela = start; rela < stop; rela++) {
 -              r.r_offset = TO_NATIVE(rela->r_offset);
 -#if KERNEL_ELFCLASS == ELFCLASS64
 -              if (elf->hdr->e_machine == EM_MIPS) {
 -                      unsigned int r_typ;
 -                      r_sym = ELF64_MIPS_R_SYM(rela->r_info);
 -                      r_sym = TO_NATIVE(r_sym);
 -                      r_typ = ELF64_MIPS_R_TYPE(rela->r_info);
 -                      r.r_info = ELF64_R_INFO(r_sym, r_typ);
 -              } else {
 -                      r.r_info = TO_NATIVE(rela->r_info);
 -                      r_sym = ELF_R_SYM(r.r_info);
 -              }
 -#else
 -              r.r_info = TO_NATIVE(rela->r_info);
 -              r_sym = ELF_R_SYM(r.r_info);
 -#endif
 -              r.r_addend = TO_NATIVE(rela->r_addend);
 +              Elf_Addr taddr, r_offset;
 +              unsigned int r_type, r_sym;
 +
 +              r_offset = TO_NATIVE(rela->r_offset);
 +              get_rel_type_and_sym(elf, rela->r_info, &r_type, &r_sym);
 +
 +              taddr = TO_NATIVE(rela->r_addend);
 +
                switch (elf->hdr->e_machine) {
                case EM_RISCV:
                        if (!strcmp("__ex_table", fromsec) &&
 -                          ELF_R_TYPE(r.r_info) == R_RISCV_SUB32)
 +                          r_type == R_RISCV_SUB32)
                                continue;
                        break;
                case EM_LOONGARCH:
                        if (!strcmp("__ex_table", fromsec) &&
 -                          ELF_R_TYPE(r.r_info) == R_LARCH_SUB32)
 +                          r_type == R_LARCH_SUB32)
                                continue;
                        break;
                }
  
                check_section_mismatch(mod, elf, elf->symtab_start + r_sym,
 -                                     fsecndx, fromsec, r.r_offset, r.r_addend);
 +                                     fsecndx, fromsec, r_offset, taddr);
        }
  }
  
@@@ -1506,6 -1508,8 +1515,6 @@@ static void section_rel(struct module *
                        Elf_Shdr *sechdr)
  {
        Elf_Rel *rel;
 -      Elf_Rela r;
 -      unsigned int r_sym;
        unsigned int fsecndx = sechdr->sh_info;
        const char *fromsec = sec_name(elf, fsecndx);
        Elf_Rel *start = (void *)elf->hdr + sechdr->sh_offset;
  
        for (rel = start; rel < stop; rel++) {
                Elf_Sym *tsym;
 +              Elf_Addr taddr = 0, r_offset;
 +              unsigned int r_type, r_sym;
                void *loc;
  
 -              r.r_offset = TO_NATIVE(rel->r_offset);
 -#if KERNEL_ELFCLASS == ELFCLASS64
 -              if (elf->hdr->e_machine == EM_MIPS) {
 -                      unsigned int r_typ;
 -                      r_sym = ELF64_MIPS_R_SYM(rel->r_info);
 -                      r_sym = TO_NATIVE(r_sym);
 -                      r_typ = ELF64_MIPS_R_TYPE(rel->r_info);
 -                      r.r_info = ELF64_R_INFO(r_sym, r_typ);
 -              } else {
 -                      r.r_info = TO_NATIVE(rel->r_info);
 -                      r_sym = ELF_R_SYM(r.r_info);
 -              }
 -#else
 -              r.r_info = TO_NATIVE(rel->r_info);
 -              r_sym = ELF_R_SYM(r.r_info);
 -#endif
 -              r.r_addend = 0;
 +              r_offset = TO_NATIVE(rel->r_offset);
 +              get_rel_type_and_sym(elf, rel->r_info, &r_type, &r_sym);
  
 -              loc = sym_get_data_by_offset(elf, fsecndx, r.r_offset);
 +              loc = sym_get_data_by_offset(elf, fsecndx, r_offset);
                tsym = elf->symtab_start + r_sym;
  
                switch (elf->hdr->e_machine) {
                case EM_386:
 -                      addend_386_rel(loc, &r);
 +                      taddr = addend_386_rel(loc, r_type);
                        break;
                case EM_ARM:
 -                      addend_arm_rel(loc, tsym, &r);
 +                      taddr = addend_arm_rel(loc, tsym, r_type);
                        break;
                case EM_MIPS:
 -                      addend_mips_rel(loc, &r);
 +                      taddr = addend_mips_rel(loc, r_type);
                        break;
                default:
                        fatal("Please add code to calculate addend for this architecture\n");
                }
  
                check_section_mismatch(mod, elf, tsym,
 -                                     fsecndx, fromsec, r.r_offset, r.r_addend);
 +                                     fsecndx, fromsec, r_offset, taddr);
        }
  }
  
@@@ -2264,7 -2281,7 +2273,7 @@@ int main(int argc, char **argv
        LIST_HEAD(dump_lists);
        struct dump_list *dl, *dl2;
  
 -      while ((opt = getopt(argc, argv, "ei:mnT:to:au:WwENd:")) != -1) {
 +      while ((opt = getopt(argc, argv, "ei:MmnT:to:au:WwENd:")) != -1) {
                switch (opt) {
                case 'e':
                        external_module = true;
                        dl->file = optarg;
                        list_add_tail(&dl->list, &dump_lists);
                        break;
 +              case 'M':
 +                      module_enabled = true;
 +                      break;
                case 'm':
                        modversions = true;
                        break;
This page took 0.08238 seconds and 4 git commands to generate.