Subject: ELF header's machine field
To: NetBSD port-mips <port-mips@netbsd.org>
From: TAKEMURA, Shin <takemura@netbsd.org>
List: port-mips
Date: 11/03/1999 19:53:03
Hello there.
I got these outputs when I ran 'file' command to a MIPS lettle
endian binary.
bash-2.03$ file ./netbsd
./netbsd: ELF 32-bit LSB executable, MIPS R3000_BE - invalid byte order,
version 1 MathCoPro/FPU/MAU Required, statically linked, not stripped
I found two files releated this.
src/gnu/dist/include/elf/common.h:
/* Values for e_machine, which identifies the architecture */
#define EM_MIPS 8 /* MIPS R3000 (officially, big-endian
only) */
#define EM_MIPS_RS4_BE 10 /* MIPS R4000 big-endian */
/usr/share/misc/magic: (This file was made from
src/usr.bin/file/magdir/olf)
>>18 leshort 8 MIPS R3000_BE - invalid
byteorder,
>>18 leshort 10 MIPS R3000_LE,
>>18 beshort 8 MIPS R3000_BE,
>>18 beshort 10 MIPS R3000_LE - invalid
byteorder,
A gcc generate ELF header with machine=08, 00 which means
0x0008 in a lettle endian style and a file command shows
'invalid byte order' acording to the magic file.
I don't know which is correct :-(
Should we fix src/usr.bin/file/magdir/olf ?
Like below ?
>>18 leshort 8 MIPS R3000_LE,
>>18 leshort 10 MIPS R4000_LE,
>>18 beshort 8 MIPS R3000_BE,
>>18 beshort 10 MIPS R4000_BE,
Takemura