Re: [RFC] Crash on modpost, addend_386_rel()

From: Linus Torvalds
Date: Tue May 22 2007 - 00:56:54 EST




On Tue, 22 May 2007, Atsushi Nemoto wrote:
>
> Anyway, here is a updated patch tested on i386 (RELOCATABLE=y/n), arm,
> and mips. On calculation of 'location', sh_addr should be subtracted
> (thank you for debugging, Linus). And this patch contains an another
> fix and an improvement of added_mips_rel

Would you mind also just making this whole logic (that is generic and
shared with all the different arch versions) be an inline function of its
own?

> + Elf_Shdr *sechdrs = elf->sechdrs;
> + unsigned int *location;
> + int section = sechdrs[rsection].sh_info;
> +
> + location = (void *)elf->hdr + sechdrs[section].sh_offset +
> + (r->r_offset - sechdrs[section].sh_addr);

so that all the functions could just use some generic

location = reloc_location(elf, rsection, r);

or similar, instead of having that complex thing duplicated three times
(arm, mips and i386)?

Especially since other architectures will likely end up doing the same
thing too...

Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/