Re: Build failure triggered by recordmcount

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Mon, Nov 22, 2010 at 9:57 AM, wu zhangjin <wuzhangjin@xxxxxxxxx> wrote:
> Hi,
>
> The cause should be the endian problem, I guess you were cross-compiling it?
>
yes.

> If we compile the kernel for (32bit + big endian) target on an x86
> machine(little endian) or reversely, then, it will fail.
>
> Since the scripts/recordmcount is compiled with the local toolchain,
> the data structs will be explained according to the local
> configuration(endian...).
>
will it ? recordmcount.c does not switch endianness based on the host,
but based on format of the object file, see the switch
(ehdr->e_ident[EI_DATA]) { ... } in do_file(), the result does also
depend a runtime endianness check.

> So, we may need to custom our own elf.h for recordmcount according to
> the target type(endian here) of the kernel image:
>
> At first, pass the target information to recordmcount(only a demo
> here, we may need to clear it carefully):
>
> diff --git a/scripts/Makefile b/scripts/Makefile
> index 2e08810..151fe3e 100644
> --- a/scripts/Makefile
> +++ b/scripts/Makefile
> @@ -11,6 +11,9 @@ hostprogs-$(CONFIG_KALLSYMS)     += kallsyms
>  hostprogs-$(CONFIG_LOGO)         += pnmtologo
>  hostprogs-$(CONFIG_VT)           += conmakehash
>  hostprogs-$(CONFIG_IKCONFIG)     += bin2c
> +HOSTCFLAGS_recordmcount.o        += -DARCH=__$(ARCH)__ \
> +       -DBIT=__$(if $(CONFIG_64BIT),64,32)__           \
> +       -DENDIAN=__$(if $(CONFIG_CPU_BIG_ENDIAN),big,little)__
>  hostprogs-$(BUILD_C_RECORDMCOUNT) += recordmcount
>
>  always         := $(hostprogs-y) $(hostprogs-m)
>
hum,

% grep "BIT\|ENDIAN" scripts/recordmcount.*
scripts/recordmcount.h: mcsec.sh_type = w(SHT_PROGBITS);
scripts/recordmcount.h: if (SHT_PROGBITS != w(txthdr->sh_type) ||

so none these macro are not checked explicitly, and headers included
should not either.

 - Arnaud



[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux