aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2012-10-30 12:44:58 +0000
committerNick Clifton <nickc@redhat.com>2012-10-30 12:44:58 +0000
commit3bfcb6528e6fb6a324b2e119f50f72a0674a1402 (patch)
treed9395ca1bd3a2389a2833f97550a714da9b1d59d /binutils
parentb1bd052dee559a2b5f09a0e8b1e4d4e45d38f39f (diff)
downloadgdb-3bfcb6528e6fb6a324b2e119f50f72a0674a1402.zip
gdb-3bfcb6528e6fb6a324b2e119f50f72a0674a1402.tar.gz
gdb-3bfcb6528e6fb6a324b2e119f50f72a0674a1402.tar.bz2
bfd:
* elf32-arm.c (elf32_arm_print_private_bfd_data): Recognise and display the new ARM hard-float/soft-float ABI flags for EABI_VER5 (elf32_arm_post_process_headers): Add the hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC in EABI_VER5. binutils: * readelf.c (decode_ARM_machine_flags): Recognise and display the new ARM hard-float/soft-float ABI flags for EABI_VER5. Split out the code for EABI_VER4 and EABI_VER5 to allow this. elfcpp: * arm.h: New enum for EABI soft- and hard-float flags. gold: * gold.cc (Target_arm::do_adjust_elf_header): Add the hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC in EABI_VER5. include: * elf/arm.h (EF_ARM_ABI_FLOAT_SOFT): New define. (EF_ARM_ABI_FLOAT_HARD): Likewise. ld/testsuite: * ld-arm/eabi-hard-float.s: New test source. * ld-arm/eabi-soft-float.s: New test source. * ld-arm/eabi-hard-float.d: New test. * ld-arm/eabi-soft-float.d: New test. * ld-arm/eabi-soft-float-ABI4.d: New test. * ld-arm/eabi-soft-float-r.d: New test. * ld-arm/arm-elf.xp: Use the new tests. binutils: PR binutils/14779 * configure.in: Add checks for wchar.h and mbstate_t. * config.in: Regenerate. * configure: Regenerate. * readelf.c: Conditionally include wchar.h. (print_symbol): Conditionally use mbstate_t.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog15
-rw-r--r--binutils/bfdtest1.c4
-rw-r--r--binutils/config.in8
-rwxr-xr-xbinutils/configure28
-rw-r--r--binutils/configure.in10
-rw-r--r--binutils/readelf.c51
6 files changed, 108 insertions, 8 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 8286e5a..c814959 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,18 @@
+2012-10-30 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/14779
+ * configure.in: Add checks for wchar.h and mbstate_t.
+ * config.in: Regenerate.
+ * configure: Regenerate.
+ * readelf.c: Conditionally include wchar.h.
+ (print_symbol): Conditionally use mbstate_t.
+
+2012-10-30 Steve McIntyre <steve.mcintyre@linaro.org>
+
+ * readelf.c (decode_ARM_machine_flags): Recognise and display the
+ new ARM hard-float/soft-float ABI flags for EABI_VER5. Split out
+ the code for EABI_VER4 and EABI_VER5 to allow this.
+
2012-10-29 Alan Modra <amodra@gmail.com>
* dlltool.c (INIT_SEC_DATA): Move.
diff --git a/binutils/bfdtest1.c b/binutils/bfdtest1.c
index b246a04..eaee2fd 100644
--- a/binutils/bfdtest1.c
+++ b/binutils/bfdtest1.c
@@ -35,9 +35,11 @@ main (int argc, char **argv)
bfd *last, *next;
if (argc != 2)
- die ("bad usage");
+ die ("usage: bfdtest1 <archive>");
archive = bfd_openr (argv[1], NULL);
+ if (archive == NULL)
+ die ("no such archive");
if (!bfd_check_format (archive, bfd_archive))
{
diff --git a/binutils/config.in b/binutils/config.in
index 4ed54e9..bcabbba 100644
--- a/binutils/config.in
+++ b/binutils/config.in
@@ -2,7 +2,7 @@
/* Check that config.h is #included before system headers
(this works only for glibc, but that should be enough). */
-#if defined(__GLIBC__) && !defined(__FreeBSD_kernel__)
+#if defined(__GLIBC__)
# error config.h must be #included before system headers
#endif
@@ -100,6 +100,9 @@
/* Define to 1 if you have the <locale.h> header file. */
#undef HAVE_LOCALE_H
+/* Define if mbstate_t exists in wchar.h. */
+#undef HAVE_MBSTATE_T
+
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
@@ -160,6 +163,9 @@
/* Define to 1 if you have the `utimes' function. */
#undef HAVE_UTIMES
+/* Define to 1 if you have the <wchar.h> header file. */
+#undef HAVE_WCHAR_H
+
/* Define to 1 if you have the <zlib.h> header file. */
#undef HAVE_ZLIB_H
diff --git a/binutils/configure b/binutils/configure
index 25f9360..7c162ad 100755
--- a/binutils/configure
+++ b/binutils/configure
@@ -12446,7 +12446,7 @@ case "${host}" in
esac
-for ac_header in string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h limits.h locale.h sys/param.h
+for ac_header in string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h limits.h locale.h sys/param.h wchar.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
@@ -12750,6 +12750,32 @@ $as_echo "#define HAVE_MKDTEMP 1" >>confdefs.h
fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mbstate_t" >&5
+$as_echo_n "checking for mbstate_t... " >&6; }
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <wchar.h>
+int
+main ()
+{
+mbstate_t teststate;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ have_mbstate_t=yes
+else
+ have_mbstate_t=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_mbstate_t" >&5
+$as_echo "$have_mbstate_t" >&6; }
+ if test x"$have_mbstate_t" = xyes; then
+
+$as_echo "#define HAVE_MBSTATE_T 1" >>confdefs.h
+
+ fi
# Some systems have frexp only in -lm, not in -lc.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing frexp" >&5
diff --git a/binutils/configure.in b/binutils/configure.in
index a21e85d..e9852de 100644
--- a/binutils/configure.in
+++ b/binutils/configure.in
@@ -96,7 +96,7 @@ case "${host}" in
esac
AC_SUBST(DEMANGLER_NAME)
-AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h limits.h locale.h sys/param.h)
+AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h limits.h locale.h sys/param.h wchar.h)
AC_HEADER_SYS_WAIT
ACX_HEADER_STRING
AC_FUNC_ALLOCA
@@ -107,6 +107,14 @@ AC_CHECK_FUNC([mkstemp],
AC_CHECK_FUNC([mkdtemp],
AC_DEFINE([HAVE_MKDTEMP], 1,
[Define to 1 if you have the `mkdtemp' function.]))
+ AC_MSG_CHECKING([for mbstate_t])
+ AC_TRY_COMPILE([#include <wchar.h>],
+ [mbstate_t teststate;],
+ have_mbstate_t=yes, have_mbstate_t=no)
+ AC_MSG_RESULT($have_mbstate_t)
+ if test x"$have_mbstate_t" = xyes; then
+ AC_DEFINE(HAVE_MBSTATE_T,1,[Define if mbstate_t exists in wchar.h.])
+ fi
# Some systems have frexp only in -lm, not in -lc.
AC_SEARCH_LIBS(frexp, m)
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;