* bin2c.c: New file.
authorAlan Modra <amodra@gmail.com>
Tue, 27 Feb 2007 08:31:46 +0000 (08:31 +0000)
committerAlan Modra <amodra@gmail.com>
Tue, 27 Feb 2007 08:31:46 +0000 (08:31 +0000)
* Makefile.am (EXTRA_PROGRAMS): Add bin2c.
(CFILES): Add bin2c.c.
(bin2c_SOURCES): Define.
(bin2c.o): Dependencies from "make dep-am".
* configure.in (BUILD_MISC): Add bin2c.
* version.c: Update year.
* po/POTFILES.in: Regenerate.
* Makefile.in: Regenerate.
* configure: Regenerate.

binutils/ChangeLog
binutils/Makefile.am
binutils/Makefile.in
binutils/bin2c.c [new file with mode: 0644]
binutils/configure
binutils/configure.in
binutils/po/POTFILES.in
binutils/version.c

index 2b3ed49..6116e41 100644 (file)
@@ -1,3 +1,16 @@
+2007-02-27  Alan Modra  <amodra@bigpond.net.au>
+
+       * bin2c.c: New file.
+       * Makefile.am (EXTRA_PROGRAMS): Add bin2c.
+       (CFILES): Add bin2c.c.
+       (bin2c_SOURCES): Define.
+       (bin2c.o): Dependencies from "make dep-am".
+       * configure.in (BUILD_MISC): Add bin2c.
+       * version.c: Update year.
+       * po/POTFILES.in: Regenerate.
+       * Makefile.in: Regenerate.
+       * configure: Regenerate.
+
 2007-02-17  Mark Mitchell  <mark@codesourcery.com>
             Nathan Sidwell  <nathan@codesourcery.com>
             Vladimir Prus  <vladimir@codesourcery.com
index 6350e1d..cc4cc48 100644 (file)
@@ -58,7 +58,7 @@ bin_PROGRAMS = $(SIZE_PROG) $(OBJDUMP_PROG) $(AR_PROG) $(STRINGS_PROG) $(RANLIB_
 ## -new, and to rename cxxfilt to c++filt.
 noinst_PROGRAMS = $(NM_PROG) $(STRIP_PROG) $(DEMANGLER_PROG)
 
-EXTRA_PROGRAMS = $(NLMCONV_PROG) srconv sysdump coffdump $(DLLTOOL_PROG) $(WINDRES_PROG) $(DLLWRAP_PROG)
+EXTRA_PROGRAMS = $(NLMCONV_PROG) srconv sysdump coffdump $(DLLTOOL_PROG) $(WINDRES_PROG) $(DLLWRAP_PROG) bin2c
 
 # Stuff that goes in tooldir/ if appropriate.
 TOOL_PROGS = nm-new strip-new ar ranlib dlltool objdump
@@ -87,7 +87,7 @@ HFILES = \
 GENERATED_HFILES = arparse.h sysroff.h sysinfo.h defparse.h rcparse.h
 
 CFILES = \
-       addr2line.c ar.c arsup.c binemul.c bucomm.c budemang.c \
+       addr2line.c ar.c arsup.c bin2c.c binemul.c bucomm.c budemang.c \
        coffdump.c coffgrok.c cxxfilt.c \
        dwarf.c debug.c dlltool.c dllwrap.c \
        emul_aix.c emul_vanilla.c filemode.c \
@@ -340,6 +340,8 @@ windres_LDADD = $(BFDLIB) $(LIBIBERTY) @LEXLIB@ $(LIBINTL)
 dllwrap_SOURCES = dllwrap.c version.c
 dllwrap_LDADD = $(LIBIBERTY) $(LIBINTL)
 
+bin2c_SOURCES = bin2c.c version.c
+
 
 EXTRA_DIST = arparse.c arparse.h arlex.c nlmheader.c sysinfo.c sysinfo.h \
        syslex.c deflex.c defparse.h defparse.c rclex.c rcparse.h rcparse.c
@@ -444,6 +446,9 @@ arsup.o: arsup.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
   $(INCDIR)/symcat.h arsup.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
   bucomm.h $(INCDIR)/ansidecl.h config.h $(INCDIR)/fopen-same.h \
   $(INCDIR)/filenames.h
+bin2c.o: bin2c.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
+  $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h config.h \
+  $(INCDIR)/fopen-same.h
 binemul.o: binemul.c binemul.h ../bfd/bfd.h $(INCDIR)/ansidecl.h \
   $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h config.h \
   $(INCDIR)/fopen-same.h
index 61ccbac..75ca231 100644 (file)
@@ -44,7 +44,7 @@ bin_PROGRAMS = $(am__EXEEXT_5) $(am__EXEEXT_6) $(am__EXEEXT_7) \
 noinst_PROGRAMS = $(am__EXEEXT_13) $(am__EXEEXT_14) $(am__EXEEXT_15)
 EXTRA_PROGRAMS = $(am__EXEEXT_1) srconv$(EXEEXT) sysdump$(EXEEXT) \
        coffdump$(EXEEXT) $(am__EXEEXT_2) $(am__EXEEXT_3) \
-       $(am__EXEEXT_4)
+       $(am__EXEEXT_4) bin2c$(EXEEXT)
 DIST_COMMON = $(srcdir)/../config.guess $(srcdir)/../config.sub NEWS \
        README ChangeLog $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
        $(top_srcdir)/configure $(am__configure_deps) \
@@ -101,6 +101,11 @@ am_ar_OBJECTS = arparse.$(OBJEXT) arlex.$(OBJEXT) ar.$(OBJEXT) \
        not-ranlib.$(OBJEXT) arsup.$(OBJEXT) rename.$(OBJEXT) \
        binemul.$(OBJEXT) emul_$(EMULATION).$(OBJEXT) $(am__objects_1)
 ar_OBJECTS = $(am_ar_OBJECTS)
+am_bin2c_OBJECTS = bin2c.$(OBJEXT) version.$(OBJEXT)
+bin2c_OBJECTS = $(am_bin2c_OBJECTS)
+bin2c_LDADD = $(LDADD)
+bin2c_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \
+       $(am__DEPENDENCIES_3)
 am_coffdump_OBJECTS = coffdump.$(OBJEXT) coffgrok.$(OBJEXT) \
        $(am__objects_1)
 coffdump_OBJECTS = $(am_coffdump_OBJECTS)
@@ -178,12 +183,13 @@ YLWRAP = $(top_srcdir)/../ylwrap
 YACCCOMPILE = $(YACC) $(YFLAGS) $(AM_YFLAGS)
 LTYACCCOMPILE = $(LIBTOOL) --mode=compile $(YACC) $(YFLAGS) \
        $(AM_YFLAGS)
-SOURCES = $(addr2line_SOURCES) $(ar_SOURCES) $(coffdump_SOURCES) \
-       $(cxxfilt_SOURCES) $(dlltool_SOURCES) $(dllwrap_SOURCES) \
-       $(nlmconv_SOURCES) $(nm_new_SOURCES) $(objcopy_SOURCES) \
-       $(objdump_SOURCES) $(ranlib_SOURCES) $(readelf_SOURCES) \
-       $(size_SOURCES) $(srconv_SOURCES) $(strings_SOURCES) \
-       $(strip_new_SOURCES) $(sysdump_SOURCES) $(windres_SOURCES)
+SOURCES = $(addr2line_SOURCES) $(ar_SOURCES) $(bin2c_SOURCES) \
+       $(coffdump_SOURCES) $(cxxfilt_SOURCES) $(dlltool_SOURCES) \
+       $(dllwrap_SOURCES) $(nlmconv_SOURCES) $(nm_new_SOURCES) \
+       $(objcopy_SOURCES) $(objdump_SOURCES) $(ranlib_SOURCES) \
+       $(readelf_SOURCES) $(size_SOURCES) $(srconv_SOURCES) \
+       $(strings_SOURCES) $(strip_new_SOURCES) $(sysdump_SOURCES) \
+       $(windres_SOURCES)
 RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
        html-recursive info-recursive install-data-recursive \
        install-exec-recursive install-info-recursive \
@@ -382,7 +388,7 @@ HFILES = \
 
 GENERATED_HFILES = arparse.h sysroff.h sysinfo.h defparse.h rcparse.h
 CFILES = \
-       addr2line.c ar.c arsup.c binemul.c bucomm.c budemang.c \
+       addr2line.c ar.c arsup.c bin2c.c binemul.c bucomm.c budemang.c \
        coffdump.c coffgrok.c cxxfilt.c \
        dwarf.c debug.c dlltool.c dllwrap.c \
        emul_aix.c emul_vanilla.c filemode.c \
@@ -478,6 +484,7 @@ windres_SOURCES = windres.c resrc.c rescoff.c resbin.c rcparse.y rclex.l \
 windres_LDADD = $(BFDLIB) $(LIBIBERTY) @LEXLIB@ $(LIBINTL)
 dllwrap_SOURCES = dllwrap.c version.c
 dllwrap_LDADD = $(LIBIBERTY) $(LIBINTL)
+bin2c_SOURCES = bin2c.c version.c
 EXTRA_DIST = arparse.c arparse.h arlex.c nlmheader.c sysinfo.c sysinfo.h \
        syslex.c deflex.c defparse.h defparse.c rclex.c rcparse.h rcparse.c
 
@@ -586,6 +593,9 @@ addr2line$(EXEEXT): $(addr2line_OBJECTS) $(addr2line_DEPENDENCIES)
 ar$(EXEEXT): $(ar_OBJECTS) $(ar_DEPENDENCIES) 
        @rm -f ar$(EXEEXT)
        $(LINK) $(ar_LDFLAGS) $(ar_OBJECTS) $(ar_LDADD) $(LIBS)
+bin2c$(EXEEXT): $(bin2c_OBJECTS) $(bin2c_DEPENDENCIES) 
+       @rm -f bin2c$(EXEEXT)
+       $(LINK) $(bin2c_LDFLAGS) $(bin2c_OBJECTS) $(bin2c_LDADD) $(LIBS)
 coffdump$(EXEEXT): $(coffdump_OBJECTS) $(coffdump_DEPENDENCIES) 
        @rm -f coffdump$(EXEEXT)
        $(LINK) $(coffdump_LDFLAGS) $(coffdump_OBJECTS) $(coffdump_LDADD) $(LIBS)
@@ -1165,6 +1175,9 @@ arsup.o: arsup.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
   $(INCDIR)/symcat.h arsup.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
   bucomm.h $(INCDIR)/ansidecl.h config.h $(INCDIR)/fopen-same.h \
   $(INCDIR)/filenames.h
+bin2c.o: bin2c.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
+  $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h config.h \
+  $(INCDIR)/fopen-same.h
 binemul.o: binemul.c binemul.h ../bfd/bfd.h $(INCDIR)/ansidecl.h \
   $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h config.h \
   $(INCDIR)/fopen-same.h
diff --git a/binutils/bin2c.c b/binutils/bin2c.c
new file mode 100644 (file)
index 0000000..4f58a73
--- /dev/null
@@ -0,0 +1,104 @@
+/* bin2c.c -- dump binary file in hex format
+   Copyright 2007 Free Software Foundation, Inc.
+
+   This file is part of GNU Binutils.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+   02110-1301, USA.  */
+
+#include "bfd.h"
+#include "bucomm.h"
+
+#if !defined O_BINARY && defined _O_BINARY
+  /* For MSC-compatible compilers.  */
+# define O_BINARY _O_BINARY
+# define O_TEXT _O_TEXT
+#endif
+
+#ifdef __BEOS__
+  /* BeOS 5 has O_BINARY and O_TEXT, but they have no effect.  */
+# undef O_BINARY
+# undef O_TEXT
+#endif
+
+#if O_BINARY
+# ifndef __DJGPP__
+#  define setmode _setmode
+#  define fileno(_fp) _fileno (_fp)
+# endif /* not DJGPP */
+# define SET_BINARY(_f) \
+  do { if (!isatty (_f)) setmode (_f, O_BINARY); } while (0)
+#else
+# define SET_BINARY(f) (void) 0
+# define O_BINARY 0
+# define O_TEXT 0
+#endif /* O_BINARY */
+
+int
+main (int argc, char *argv[])
+{
+  int c;
+  int i;
+
+#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
+  setlocale (LC_MESSAGES, "");
+#endif
+#if defined (HAVE_SETLOCALE)
+  setlocale (LC_CTYPE, "");
+#endif
+  bindtextdomain (PACKAGE, LOCALEDIR);
+  textdomain (PACKAGE);
+
+  if (argc != 1)
+    {
+      int ishelp = 0;
+      int isvers = 0;
+      FILE *stream;
+
+      if (argc == 2 && argv[1][0] == '-')
+       {
+         const char *opt = &argv[1][1];
+         if (*opt == '-')
+           ++opt;
+         ishelp = *opt == 'h' || *opt == 'H';
+         isvers = *opt == 'v' || *opt == 'V';
+       }
+
+      if (isvers)
+       print_version ("bin2c");
+
+      stream = ishelp ? stdout : stderr;
+      fprintf (stream, _("Usage: %s < input_file > output_file\n"), argv[0]);
+      fprintf (stream, _("Prints bytes from stdin in hex format.\n"));
+      exit (!ishelp);
+    }
+
+  SET_BINARY (fileno (stdin));
+
+  i = 0;
+  while ((c = getc (stdin)) != EOF)
+    {
+      printf ("0x%02x,", c);
+      if (++i == 16)
+       {
+         printf ("\n");
+         i = 0;
+       }
+    }
+  if (i != 0)
+    printf ("\n");
+
+  exit (0);
+}
index bf7cfba..f2b898c 100755 (executable)
@@ -8630,6 +8630,7 @@ do
        BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
        BUILD_SRCONV='$(SRCONV_PROG)'
        NLMCONV_DEFS="-DNLMCONV_I386 -DNLMCONV_ALPHA -DNLMCONV_POWERPC -DNLMCONV_SPARC"
+       BUILD_MISC="${BUILD_MISC} bin2c"
     else
        case $targ in
        i[3-7]86*-*-netware*)
@@ -8724,7 +8725,7 @@ do
          BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
          ;;
        powerpc*-*-linux* | powerpc*-*-elf*)
-         BUILD_MISC=embedspu
+         BUILD_MISC="${BUILD_MISC} embedspu"
          ;;
        sh*-*-pe)
          BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
@@ -8734,6 +8735,9 @@ do
          DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_SH"
          BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
          ;;
+       spu-*-*)
+         BUILD_MISC="${BUILD_MISC} bin2c"
+         ;;
        mips*-*-pe)
          BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
          if test -z "$DLLTOOL_DEFAULT"; then
index 2ab4a38..39d0ace 100644 (file)
@@ -233,6 +233,7 @@ do
        BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
        BUILD_SRCONV='$(SRCONV_PROG)'
        NLMCONV_DEFS="-DNLMCONV_I386 -DNLMCONV_ALPHA -DNLMCONV_POWERPC -DNLMCONV_SPARC"
+       BUILD_MISC="${BUILD_MISC} bin2c"
     else
        case $targ in
 changequote(,)dnl
@@ -335,7 +336,7 @@ changequote([,])dnl
          BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
          ;;
        powerpc*-*-linux* | powerpc*-*-elf*)
-         BUILD_MISC=embedspu
+         BUILD_MISC="${BUILD_MISC} embedspu"
          ;;
        sh*-*-pe)
          BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
@@ -345,6 +346,9 @@ changequote([,])dnl
          DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_SH"
          BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
          ;;
+       spu-*-*)
+         BUILD_MISC="${BUILD_MISC} bin2c"
+         ;;
        mips*-*-pe)
          BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
          if test -z "$DLLTOOL_DEFAULT"; then
index d3f6cb3..c4b06d2 100644 (file)
@@ -2,6 +2,7 @@ addr2line.c
 ar.c
 arsup.c
 arsup.h
+bin2c.c
 binemul.c
 binemul.h
 bucomm.c
index 2843e69..9831416 100644 (file)
@@ -32,7 +32,7 @@ print_version (const char *name)
   /* This output is intended to follow the GNU standards document.  */
   /* xgettext:c-format */
   printf ("GNU %s %s\n", name, BFD_VERSION_STRING);
-  printf (_("Copyright 2005 Free Software Foundation, Inc.\n"));
+  printf (_("Copyright 2007 Free Software Foundation, Inc.\n"));
   printf (_("\
 This program is free software; you may redistribute it under the terms of\n\
 the GNU General Public License.  This program has absolutely no warranty.\n"));