[PATCH] Remove misleading readelf MIPS output
Thiemo Seufer
ica2_ts@csv.ica.uni-stuttgart.de
Wed Dec 12 16:46:00 GMT 2001
More information about the Binutils mailing list
Wed Dec 12 16:46:00 GMT 2001
- Previous message (by thread): [PATCH] Remove misleading readelf MIPS output
- Next message (by thread): [PATCH] Remove misleading readelf MIPS output
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Thiemo Seufer wrote: > cgd@broadcom.com wrote: > > ica2_ts@csv.ica.uni-stuttgart.de ("Thiemo Seufer") writes: > > > this prevents readelf to output "UNKNOWN" for every object file > > > which isn't compiled for one of the CPU's noted in the ELF header. > > > > personally, my preference is as done in > > http://sources.redhat.com/ml/binutils/2001-11/msg00113.html (print > > "UNKNOWN machine" -- i'd be OK with different capitlization -- and > > "unknown ISA", rrather than just not printing anything). > > If we have noted the CPU type somewhere else (e.g. a .note section) > this would be even more misleading IMHO. > > > Guess the question is, do we expect these to have meaningful values as > > defined in the binutils MIPS elf headers? 8-) > > Only for a few CPU's, for most we don't. I have refined and expanded my earlier patch. It should now work well for all MIPS ELF header flags currently in use. Thiemo 2001-12-13 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de> /binutils/ChangeLog * readelf.c (get_machine_flags): Recognize header flags for ABI and ASE extensions. More robust code for ISA checking. Ignore empty fields in header flags for GNU extensions. diff -BurpN source-orig/binutils/readelf.c source/binutils/readelf.c --- source-orig/binutils/readelf.c Wed Dec 12 02:45:59 2001 +++ source/binutils/readelf.c Thu Dec 13 00:59:21 2001 @@ -1630,30 +1630,12 @@ get_machine_flags (e_flags, e_machine) if (e_flags & EF_MIPS_ABI2) strcat (buf, ", abi2"); + if (e_flags & EF_MIPS_OPTIONS_FIRST) + strcat (buf, ", odk first"); + if (e_flags & EF_MIPS_32BITMODE) strcat (buf, ", 32bitmode"); - if ((e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_1) - strcat (buf, ", mips1"); - - if ((e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_2) - strcat (buf, ", mips2"); - - if ((e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_3) - strcat (buf, ", mips3"); - - if ((e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_4) - strcat (buf, ", mips4"); - - if ((e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_5) - strcat (buf, ", mips5"); - - if ((e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_32) - strcat (buf, ", mips32"); - - if ((e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_64) - strcat (buf, ", mips64"); - switch ((e_flags & EF_MIPS_MACH)) { case E_MIPS_MACH_3900: strcat (buf, ", 3900"); break; @@ -1662,8 +1644,47 @@ get_machine_flags (e_flags, e_machine) case E_MIPS_MACH_4650: strcat (buf, ", 4650"); break; case E_MIPS_MACH_4111: strcat (buf, ", 4111"); break; case E_MIPS_MACH_SB1: strcat (buf, ", sb1"); break; - default: strcat (buf, " UNKNOWN"); break; + case 0: + /* We simply ignore the field in this case to avoid confusion: + MIPS ELF does not specify EF_MIPS_MACH, it is a GNU extension. + */ + break; + default: strcat (buf, ", unknown CPU"); break; } + + switch ((e_flags & EF_MIPS_ABI)) + { + case E_MIPS_ABI_O32: strcat (buf, ", o32"); break; + case E_MIPS_ABI_O64: strcat (buf, ", o64"); break; + case E_MIPS_ABI_EABI32: strcat (buf, ", eabi32"); break; + case E_MIPS_ABI_EABI64: strcat (buf, ", eabi64"); break; + case 0: + /* We simply ignore the field in this case to avoid confusion: + MIPS ELF does not specify EF_MIPS_ABI, it is a GNU extension. + This means it is likely to be an o32 file, but not for sure. + */ + break; + default: strcat (buf, ", unknown ABI"); break; + } + + if (e_flags & EF_MIPS_ARCH_ASE_MDMX) + strcat (buf, ", mdmx"); + + if (e_flags & EF_MIPS_ARCH_ASE_M16) + strcat (buf, ", mips16"); + + switch ((e_flags & EF_MIPS_ARCH)) + { + case E_MIPS_ARCH_1: strcat (buf, ", mips1"); break; + case E_MIPS_ARCH_2: strcat (buf, ", mips2"); break; + case E_MIPS_ARCH_3: strcat (buf, ", mips3"); break; + case E_MIPS_ARCH_4: strcat (buf, ", mips4"); break; + case E_MIPS_ARCH_5: strcat (buf, ", mips5"); break; + case E_MIPS_ARCH_32: strcat (buf, ", mips32"); break; + case E_MIPS_ARCH_64: strcat (buf, ", mips64"); break; + default: strcat (buf, ", unknown ISA"); break; + } + break; case EM_SPARCV9:
- Previous message (by thread): [PATCH] Remove misleading readelf MIPS output
- Next message (by thread): [PATCH] Remove misleading readelf MIPS output
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list