diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-02-03 10:30:27 -0800 | 
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-02-03 10:30:27 -0800 | 
| commit | 2cb54ce9ee92ae627bc1cef8bea236905910a86d (patch) | |
| tree | 8cf38943b5acd64b25621d6eab72591c6a65ba1e /scripts/mod/modpost.c | |
| parent | 29905b52fad0854351f57bab867647e4982285bf (diff) | |
| parent | 4b9eee96fcb361a5e16a8d2619825e8a048f81f7 (diff) | |
Merge branch 'modversions' (modversions fixes for powerpc from Ard)
Merge kcrctab entry fixes from Ard Biesheuvel:
 "This is a followup to [0] 'modversions: redefine kcrctab entries as
  relative CRC pointers', but since relative CRC pointers do not work in
  modules, and are actually only needed by powerpc with
  CONFIG_RELOCATABLE=y, I have made it a Kconfig selectable feature
  instead.
  First it introduces the MODULE_REL_CRCS Kconfig symbol, and adds the
  kbuild handling of it, i.e., modpost, genksyms and kallsyms.
  Then it switches all architectures to 32-bit CRC entries in kcrctab,
  where all architectures except powerpc with CONFIG_RELOCATABLE=y use
  absolute ELF symbol references as before"
[0] http://marc.info/?l=linux-arch&m=148493613415294&w=2
* emailed patches from Ard Biesheuvel:
  module: unify absolute krctab definitions for 32-bit and 64-bit
  modversions: treat symbol CRCs as 32 bit quantities
  kbuild: modversions: add infrastructure for emitting relative CRCs
Diffstat (limited to 'scripts/mod/modpost.c')
| -rw-r--r-- | scripts/mod/modpost.c | 10 | 
1 files changed, 10 insertions, 0 deletions
| diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 29c89a6bad3d..4dedd0d3d3a7 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -621,6 +621,16 @@ static void handle_modversions(struct module *mod, struct elf_info *info,  	if (strncmp(symname, CRC_PFX, strlen(CRC_PFX)) == 0) {  		is_crc = true;  		crc = (unsigned int) sym->st_value; +		if (sym->st_shndx != SHN_UNDEF && sym->st_shndx != SHN_ABS) { +			unsigned int *crcp; + +			/* symbol points to the CRC in the ELF object */ +			crcp = (void *)info->hdr + sym->st_value + +			       info->sechdrs[sym->st_shndx].sh_offset - +			       (info->hdr->e_type != ET_REL ? +				info->sechdrs[sym->st_shndx].sh_addr : 0); +			crc = *crcp; +		}  		sym_update_crc(symname + strlen(CRC_PFX), mod, crc,  				export);  	} | 
