modpost: drop executable ELF support
Since commit 269a535ca931 ("modpost: generate vmlinux.symvers and reuse it for the second modpost"), modpost only parses relocatable files (ET_REL). Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
This commit is contained in:
parent
1fd49a0b5c
commit
5764f6626f
@ -321,9 +321,6 @@ static void *sym_get_data_by_offset(const struct elf_info *info,
|
|||||||
{
|
{
|
||||||
Elf_Shdr *sechdr = &info->sechdrs[secindex];
|
Elf_Shdr *sechdr = &info->sechdrs[secindex];
|
||||||
|
|
||||||
if (info->hdr->e_type != ET_REL)
|
|
||||||
offset -= sechdr->sh_addr;
|
|
||||||
|
|
||||||
return (void *)info->hdr + sechdr->sh_offset + offset;
|
return (void *)info->hdr + sechdr->sh_offset + offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -466,6 +463,10 @@ static int parse_elf(struct elf_info *info, const char *filename)
|
|||||||
sechdrs = (void *)hdr + hdr->e_shoff;
|
sechdrs = (void *)hdr + hdr->e_shoff;
|
||||||
info->sechdrs = sechdrs;
|
info->sechdrs = sechdrs;
|
||||||
|
|
||||||
|
/* modpost only works for relocatable objects */
|
||||||
|
if (hdr->e_type != ET_REL)
|
||||||
|
fatal("%s: not relocatable object.", filename);
|
||||||
|
|
||||||
/* Check if file offset is correct */
|
/* Check if file offset is correct */
|
||||||
if (hdr->e_shoff > info->size) {
|
if (hdr->e_shoff > info->size) {
|
||||||
fatal("section header offset=%lu in file '%s' is bigger than filesize=%zu\n",
|
fatal("section header offset=%lu in file '%s' is bigger than filesize=%zu\n",
|
||||||
@ -1622,9 +1623,6 @@ static int addend_386_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r)
|
|||||||
break;
|
break;
|
||||||
case R_386_PC32:
|
case R_386_PC32:
|
||||||
r->r_addend = TO_NATIVE(*location) + 4;
|
r->r_addend = TO_NATIVE(*location) + 4;
|
||||||
/* For CONFIG_RELOCATABLE=y */
|
|
||||||
if (elf->hdr->e_type == ET_EXEC)
|
|
||||||
r->r_addend += r->r_offset;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user