diff options
Diffstat (limited to 'binutils/readelf.c')
-rw-r--r-- | binutils/readelf.c | 51 |
1 files changed, 47 insertions, 4 deletions
diff --git a/binutils/readelf.c b/binutils/readelf.c index b4f9f4e..399402d 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -48,7 +48,9 @@ #ifdef HAVE_ZLIB_H #include <zlib.h> #endif +#ifdef HAVE_WCHAR_H #include <wchar.h> +#endif #if __GNUC__ >= 2 /* Define BFD64 here, even if our default architecture is 32 bit ELF @@ -386,7 +388,7 @@ print_vma (bfd_vma vma, print_mode mode) } /* Display a symbol on stdout. Handles the display of control characters and - multibye characters. + multibye characters (assuming the host environment supports them). Display at most abs(WIDTH) characters, truncating as necessary, unless do_wide is true. @@ -400,7 +402,9 @@ print_symbol (int width, const char *symbol) { bfd_boolean extra_padding = FALSE; int num_printed = 0; +#ifdef HAVE_MBSTATE_T mbstate_t state; +#endif int width_remaining; if (width < 0) @@ -417,13 +421,14 @@ print_symbol (int width, const char *symbol) else width_remaining = width; +#ifdef HAVE_MBSTATE_T /* Initialise the multibyte conversion state. */ memset (& state, 0, sizeof (state)); +#endif while (width_remaining) { size_t n; - wchar_t w; const char c = *symbol++; if (c == 0) @@ -449,15 +454,22 @@ print_symbol (int width, const char *symbol) } else { +#ifdef HAVE_MBSTATE_T + wchar_t w; +#endif /* Let printf do the hard work of displaying multibyte characters. */ printf ("%.1s", symbol - 1); width_remaining --; num_printed ++; +#ifdef HAVE_MBSTATE_T /* Try to find out how many bytes made up the character that was just printed. Advance the symbol pointer past the bytes that were displayed. */ n = mbrtowc (& w, symbol - 1, MB_CUR_MAX, & state); +#else + n = 1; +#endif if (n != (size_t) -1 && n != (size_t) -2 && n > 0) symbol += (n - 1); } @@ -2122,11 +2134,34 @@ decode_ARM_machine_flags (unsigned e_flags, char buf[]) case EF_ARM_EABI_VER4: strcat (buf, ", Version4 EABI"); - goto eabi; + while (e_flags) + { + unsigned flag; + + /* Process flags one bit at a time. */ + flag = e_flags & - e_flags; + e_flags &= ~ flag; + + switch (flag) + { + case EF_ARM_BE8: + strcat (buf, ", BE8"); + break; + + case EF_ARM_LE8: + strcat (buf, ", LE8"); + break; + + default: + unknown = 1; + break; + } + break; + } + break; case EF_ARM_EABI_VER5: strcat (buf, ", Version5 EABI"); - eabi: while (e_flags) { unsigned flag; @@ -2145,6 +2180,14 @@ decode_ARM_machine_flags (unsigned e_flags, char buf[]) strcat (buf, ", LE8"); break; + case EF_ARM_ABI_FLOAT_SOFT: /* Conflicts with EF_ARM_SOFT_FLOAT. */ + strcat (buf, ", soft-float ABI"); + break; + + case EF_ARM_ABI_FLOAT_HARD: /* Conflicts with EF_ARM_VFP_FLOAT. */ + strcat (buf, ", hard-float ABI"); + break; + default: unknown = 1; break; |