summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2007-02-27 08:31:46 +0000
committerAlan Modra <amodra@bigpond.net.au>2007-02-27 08:31:46 +0000
commit15a5b0534456a303c93b6b7c00c23b4f056635b3 (patch)
tree07ebff4b7b1caa853a8b9f65d1ef80cc5771f2fd
parentee5b280fadd2f8eea2c027d0a24ec4a13182c749 (diff)
downloadbinutils-redhat-15a5b0534456a303c93b6b7c00c23b4f056635b3.tar.gz
* 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.
-rw-r--r--binutils/ChangeLog13
-rw-r--r--binutils/Makefile.am9
-rw-r--r--binutils/Makefile.in29
-rw-r--r--binutils/bin2c.c104
-rwxr-xr-xbinutils/configure6
-rw-r--r--binutils/configure.in6
-rw-r--r--binutils/po/POTFILES.in1
-rw-r--r--binutils/version.c2
8 files changed, 157 insertions, 13 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 2b3ed49f6f..6116e416ef 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -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
diff --git a/binutils/Makefile.am b/binutils/Makefile.am
index 6350e1d50d..cc4cc48582 100644
--- a/binutils/Makefile.am
+++ b/binutils/Makefile.am
@@ -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
diff --git a/binutils/Makefile.in b/binutils/Makefile.in
index 61ccbac1ac..75ca231a31 100644
--- a/binutils/Makefile.in
+++ b/binutils/Makefile.in
@@ -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
index 0000000000..4f58a7326b
--- /dev/null
+++ b/binutils/bin2c.c
@@ -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);
+}
diff --git a/binutils/configure b/binutils/configure
index bf7cfbad3c..f2b898c557 100755
--- a/binutils/configure
+++ b/binutils/configure
@@ -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
diff --git a/binutils/configure.in b/binutils/configure.in
index 2ab4a38c6e..39d0ace887 100644
--- a/binutils/configure.in
+++ b/binutils/configure.in
@@ -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
diff --git a/binutils/po/POTFILES.in b/binutils/po/POTFILES.in
index d3f6cb3fa7..c4b06d2bb2 100644
--- a/binutils/po/POTFILES.in
+++ b/binutils/po/POTFILES.in
@@ -2,6 +2,7 @@ addr2line.c
ar.c
arsup.c
arsup.h
+bin2c.c
binemul.c
binemul.h
bucomm.c
diff --git a/binutils/version.c b/binutils/version.c
index 2843e69f06..9831416e36 100644
--- a/binutils/version.c
+++ b/binutils/version.c
@@ -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"));