mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 12:43:29 +02:00
modpost: replace r->r_offset, r->r_addend with faddr, taddr
r_offset/r_addend holds the offset address from/to which a symbol is referenced. It is unclear unless you are familiar with ELF. Rename them to faddr, taddr, respectively. The prefix 'f' means 'from', 't' means 'to'. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
This commit is contained in:
@@ -1185,18 +1185,18 @@ static bool is_executable_section(struct elf_info *elf, unsigned int secndx)
|
||||
|
||||
static void default_mismatch_handler(const char *modname, struct elf_info *elf,
|
||||
const struct sectioncheck* const mismatch,
|
||||
Elf_Rela *r, Elf_Sym *tsym,
|
||||
unsigned int fsecndx, const char *fromsec,
|
||||
const char *tosec)
|
||||
Elf_Sym *tsym,
|
||||
unsigned int fsecndx, const char *fromsec, Elf_Addr faddr,
|
||||
const char *tosec, Elf_Addr taddr)
|
||||
{
|
||||
Elf_Sym *from;
|
||||
const char *tosym;
|
||||
const char *fromsym;
|
||||
|
||||
from = find_fromsym(elf, r->r_offset, fsecndx);
|
||||
from = find_fromsym(elf, faddr, fsecndx);
|
||||
fromsym = sym_name(elf, from);
|
||||
|
||||
tsym = find_tosym(elf, r->r_addend, tsym);
|
||||
tsym = find_tosym(elf, taddr, tsym);
|
||||
tosym = sym_name(elf, tsym);
|
||||
|
||||
/* check whitelist - we may ignore it */
|
||||
@@ -1223,7 +1223,7 @@ static void default_mismatch_handler(const char *modname, struct elf_info *elf,
|
||||
break;
|
||||
case EXTABLE_TO_NON_TEXT:
|
||||
warn("%s(%s+0x%lx): Section mismatch in reference to the %s:%s\n",
|
||||
modname, fromsec, (long)r->r_offset, tosec, tosym);
|
||||
modname, fromsec, (long)faddr, tosec, tosym);
|
||||
|
||||
if (match(tosec, mismatch->bad_tosec))
|
||||
fatal("The relocation at %s+0x%lx references\n"
|
||||
@@ -1231,7 +1231,7 @@ static void default_mismatch_handler(const char *modname, struct elf_info *elf,
|
||||
"Something is seriously wrong and should be fixed.\n"
|
||||
"You might get more information about where this is\n"
|
||||
"coming from by using scripts/check_extable.sh %s\n",
|
||||
fromsec, (long)r->r_offset, tosec, modname);
|
||||
fromsec, (long)faddr, tosec, modname);
|
||||
else if (is_executable_section(elf, get_secindex(elf, tsym)))
|
||||
warn("The relocation at %s+0x%lx references\n"
|
||||
"section \"%s\" which is not in the list of\n"
|
||||
@@ -1240,17 +1240,18 @@ static void default_mismatch_handler(const char *modname, struct elf_info *elf,
|
||||
"list of authorized sections to jump to on fault.\n"
|
||||
"This can be achieved by adding \"%s\" to\n"
|
||||
"OTHER_TEXT_SECTIONS in scripts/mod/modpost.c.\n",
|
||||
fromsec, (long)r->r_offset, tosec, tosec, tosec);
|
||||
fromsec, (long)faddr, tosec, tosec, tosec);
|
||||
else
|
||||
error("%s+0x%lx references non-executable section '%s'\n",
|
||||
fromsec, (long)r->r_offset, tosec);
|
||||
fromsec, (long)faddr, tosec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void check_section_mismatch(const char *modname, struct elf_info *elf,
|
||||
Elf_Rela *r, Elf_Sym *sym,
|
||||
unsigned int fsecndx, const char *fromsec)
|
||||
Elf_Sym *sym,
|
||||
unsigned int fsecndx, const char *fromsec,
|
||||
Elf_Addr faddr, Elf_Addr taddr)
|
||||
{
|
||||
const char *tosec = sec_name(elf, get_secindex(elf, sym));
|
||||
const struct sectioncheck *mismatch = section_mismatch(fromsec, tosec);
|
||||
@@ -1258,8 +1259,9 @@ static void check_section_mismatch(const char *modname, struct elf_info *elf,
|
||||
if (!mismatch)
|
||||
return;
|
||||
|
||||
default_mismatch_handler(modname, elf, mismatch, r, sym, fsecndx, fromsec,
|
||||
tosec);
|
||||
default_mismatch_handler(modname, elf, mismatch, sym,
|
||||
fsecndx, fromsec, faddr,
|
||||
tosec, taddr);
|
||||
}
|
||||
|
||||
static unsigned int *reloc_location(struct elf_info *elf,
|
||||
@@ -1417,7 +1419,8 @@ static void section_rela(const char *modname, struct elf_info *elf,
|
||||
/* Skip special sections */
|
||||
if (is_shndx_special(sym->st_shndx))
|
||||
continue;
|
||||
check_section_mismatch(modname, elf, &r, sym, fsecndx, fromsec);
|
||||
check_section_mismatch(modname, elf, sym,
|
||||
fsecndx, fromsec, r.r_offset, r.r_addend);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1475,7 +1478,8 @@ static void section_rel(const char *modname, struct elf_info *elf,
|
||||
/* Skip special sections */
|
||||
if (is_shndx_special(sym->st_shndx))
|
||||
continue;
|
||||
check_section_mismatch(modname, elf, &r, sym, fsecndx, fromsec);
|
||||
check_section_mismatch(modname, elf, sym,
|
||||
fsecndx, fromsec, r.r_offset, r.r_addend);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user