* 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-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
## -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
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 \
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
$(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
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) \
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)
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 \
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 \
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
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)
$(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
--- /dev/null
+/* 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);
+}
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*)
BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
;;
powerpc*-*-linux* | powerpc*-*-elf*)
- BUILD_MISC=embedspu
+ BUILD_MISC="${BUILD_MISC} embedspu"
;;
sh*-*-pe)
BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
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
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
BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
;;
powerpc*-*-linux* | powerpc*-*-elf*)
- BUILD_MISC=embedspu
+ BUILD_MISC="${BUILD_MISC} embedspu"
;;
sh*-*-pe)
BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
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
ar.c
arsup.c
arsup.h
+bin2c.c
binemul.c
binemul.h
bucomm.c
/* 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"));