Re: [git patches] kbuild fixes for -rc

From: Chris Wright
Date: Mon May 08 2006 - 15:00:07 EST


Hi Sam,

* Sam Ravnborg (sam@xxxxxxxxxxxx) wrote:
> commit c8d8b837ebe4b4f11e1b0c4a2bdc358c697692ed
> Author: Atsushi Nemoto <anemo@xxxxxxxxxxxxx>
> Date: Tue Apr 25 01:53:43 2006 +0900
>
> kbuild: fix modpost segfault for 64bit mipsel kernel
>
> 64bit mips has different r_info layout. This patch fixes modpost
> segfault for 64bit little endian mips kernel.
>
> Signed-off-by: Atsushi Nemoto <anemo@xxxxxxxxxxxxx>
> Signed-off-by: Sam Ravnborg <sam@xxxxxxxxxxxx>

This one breaks building 32-bit x86 kernels on x86_64 box. Hmm, actually,
breaks 32-bit x86 build...period.

<snip>
> @@ -709,10 +709,17 @@ static void check_sec_ref(struct module
> for (rela = start; rela < stop; rela++) {
> Elf_Rela r;
> const char *secname;
> + unsigned int r_sym;
> r.r_offset = TO_NATIVE(rela->r_offset);
> - r.r_info = TO_NATIVE(rela->r_info);
> + if (hdr->e_ident[EI_CLASS] == ELFCLASS64 &&
> + hdr->e_machine == EM_MIPS) {
> + r_sym = ELF64_MIPS_R_SYM(rela->r_info);

$ make ARCH=i386 bzImage
HOSTCC scripts/mod/modpost.o
/home/chrisw/hg/linux/linux-2.6/scripts/mod/modpost.c: In function âcheck_sec_refâ:
/home/chrisw/hg/linux/linux-2.6/scripts/mod/modpost.c:716: error: cast to union type from type not present in union

Perhaps something at compile time keyed from mk_elfconfig, and drop the
change to modpost.c?

As in, mk_elfconfig can generate:
"#define KERNEL_ELFMACHINE EM_$MACHINE"

And modpost.h can define:
#if KERNELCLASS == ELF32CLASS
...
#define ELF_R_SYM ELF32_R_SYM
...
#else
#if KERNEL_ELFMACHINE == EM_MIPS
/* Mips specific relocation stuff */
...
#define ELF_R_SYM ELF64_MIPS_R_SYM
#else
#define ELF_R_SYM ELF64_R_SYM
#endif
...
#endif

thanks,
-chris
-
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/