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

Re: [Xen-devel] Endian safe mkelf32.c

>>>>> "VH" == Vincent Hanquez <tab@xxxxxxxxx> writes:

 VH> On Wed, Feb 23, 2005 at 01:37:32PM -0500, Jimi Xenidis wrote:
 >> apply in xen/arch/x86/boot

 >> +    if ( (in32_ehdr.e_type >> 8) == ET_EXEC &&
 >> +        (in32_ehdr.e_type & 0xff) != ET_EXEC )
 >> +    {
 >> +       swap = 1;
 >> +       swap_ehdr32(&in32_ehdr);
 >> +    }
 >> +    else if ( (in32_ehdr.e_type >> 8) != ET_EXEC &&
 >> +             (in32_ehdr.e_type & 0xff) == ET_EXEC )

 VH> This looks wrong. The endianess is figured by e.ident[EI_DATA] not by
 VH> reading e_type to see if we can recognize the type in all endianess.

This test is discover if the build machine is the same endian of the
image or not.

 VH> Since you didn't remove the test just before

 VH> if ( !IS_ELF(in32_ehdr) ||
 VH>    (in32_ehdr.e_ident[EI_DATA] != ELFDATA2LSB) )
 VH> {
 VH>    fprintf(stderr, "Input image must be a little-endian Elf image.\n");
 VH>    return 1;
 VH> }

 VH> so you can't be there with a valid MSB ELF image.

This is a different test, AFAIK this program is not relavent for any
MSB ELF image.  If we find an MSB ELF that does require this
"massaging" then we can revisit this last test.

 VH> the only explanation I have for the patch, is that you have an ELF file
 VH> that report to be LSB but is in fact MSB ...

This patch is to solve the problem of running the program on then MSB
build machine that is operating on the LSB ELF image.

 VH> please explain why this patch is necessary, thanks,

I think I've addressed your issues.

SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.