This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Commit: Add RX port
- From: Andreas Schwab <schwab at linux-m68k dot org>
- To: Nick Clifton <nickc at redhat dot com>
- Cc: binutils at sourceware dot org
- Date: Sat, 03 Oct 2009 10:33:15 +0200
- Subject: Re: Commit: Add RX port
- References: <m3vdj1zwv7.fsf@redhat.com> <m21vlkrk9b.fsf@whitebox.home>
Update to also fix the #line directives.
Andreas.
2009-10-03 Andreas Schwab <schwab@linux-m68k.org>
* opc2c.c: Include "libiberty.h" and <errno.h>.
(orig_filename): Constify.
(dump_lines): Fix line number directive.
(main): Set orig_filename to basename of input file. Use
xstrerror.
* Makefile.am (rx-dis.lo): Remove explicit dependencies.
($(srcdir)/rx-decode.c): Use @MAINT@. Use $(EXEEXT_FOR_BUILD)
instead of $(EXEEXT).
(opc2c$(EXEEXT_FOR_BUILD)): Renamed from opc2c$(EXEEXT) and use
$(LINK_FOR_BUILD). Link with libiberty.
(MOSTLYCLEANFILES): Add opc2c$(EXEEXT_FOR_BUILD).
(MAINTAINERCLEANFILES): Add $(srcdir)/rx-decode.c.
* Makefile.in: Regenerated.
* rx-decode.c: Regenerated.
Index: opcodes/Makefile.am
===================================================================
RCS file: /cvs/src/src/opcodes/Makefile.am,v
retrieving revision 1.150
diff -u -a -p -r1.150 Makefile.am
--- opcodes/Makefile.am 29 Sep 2009 14:17:18 -0000 1.150
+++ opcodes/Makefile.am 3 Oct 2009 08:29:05 -0000
@@ -437,14 +437,6 @@ stamp-iq2000: $(CGENDEPS) $(srcdir)/../c
archfile=$(srcdir)/../cpu/iq2000.cpu \
opcfile=$(srcdir)/../cpu/iq2000.opc extrafiles=
-$(srcdir)/rx-decode.c : $(srcdir)/rx-decode.opc opc2c$(EXEEXT)
- ./opc2c$(EXEEXT) $(srcdir)/rx-decode.opc > $(srcdir)/rx-decode.c
-
-rx-dis.lo : rx-dis.c sysdep.h config.h $(BFD_H) $(INCDIR)/opcode/rx.h
-
-opc2c$(EXEEXT) : $(srcdir)/opc2c.c
- gcc $(srcdir)/opc2c.c -o opc2c$(EXEEXT)
-
$(srcdir)/xstormy16-desc.h $(srcdir)/xstormy16-desc.c $(srcdir)/xstormy16-opc.h $(srcdir)/xstormy16-opc.c $(srcdir)/xstormy16-ibld.c $(srcdir)/xstormy16-asm.c $(srcdir)/xstormy16-dis.c: $(XSTORMY16_DEPS)
@true
stamp-xstormy16: $(CGENDEPS) $(CPUDIR)/xstormy16.cpu $(CPUDIR)/xstormy16.opc
@@ -458,10 +450,12 @@ stamp-xc16x: $(CGENDEPS) $(CPUDIR)/xc16x
archfile=$(CPUDIR)/xc16x.cpu opcfile=$(CPUDIR)/xc16x.opc extrafiles=
MOSTLYCLEANFILES = i386-gen$(EXEEXT_FOR_BUILD) ia64-gen$(EXEEXT_FOR_BUILD) \
- s390-mkopc$(EXEEXT_FOR_BUILD) z8kgen$(EXEEXT_FOR_BUILD)
+ s390-mkopc$(EXEEXT_FOR_BUILD) z8kgen$(EXEEXT_FOR_BUILD) \
+ opc2c$(EXEEXT_FOR_BUILD)
MAINTAINERCLEANFILES = $(srcdir)/i386-tbl.h $(srcdir)/i386-init.h \
- $(srcdir)/ia64-asmtab.c s390-opc.tab $(srcdir)/z8k-opc.h
+ $(srcdir)/ia64-asmtab.c s390-opc.tab $(srcdir)/z8k-opc.h \
+ $(srcdir)/rx-decode.c
i386-gen$(EXEEXT_FOR_BUILD): i386-gen.o $(BUILD_LIB_DEPS)
$(LINK_FOR_BUILD) i386-gen.o $(BUILD_LIBS)
@@ -499,6 +493,15 @@ $(srcdir)/ia64-asmtab.c: @MAINT@ $(ia64_
ia64-opc.lo: $(srcdir)/ia64-asmtab.c
+$(srcdir)/rx-decode.c: @MAINT@ $(srcdir)/rx-decode.opc opc2c$(EXEEXT_FOR_BUILD)
+ ./opc2c$(EXEEXT_FOR_BUILD) $(srcdir)/rx-decode.opc > $(srcdir)/rx-decode.c
+
+opc2c$(EXEEXT_FOR_BUILD): opc2c.o $(BUILD_LIBS_DEPS)
+ $(LINK_FOR_BUILD) opc2c.o $(BUILD_LIBS)
+
+opc2c.o: opc2c.c $(INCDIR)/libiberty.h
+ $(COMPILE_FOR_BUILD) -c $(srcdir)/opc2c.c
+
s390-mkopc$(EXEEXT_FOR_BUILD): s390-mkopc.c
$(COMPILE_FOR_BUILD) -o s390-mkopc $(srcdir)/s390-mkopc.c
Index: opcodes/opc2c.c
===================================================================
RCS file: /cvs/src/src/opcodes/opc2c.c,v
retrieving revision 1.1
diff -u -a -p -r1.1 opc2c.c
--- opcodes/opc2c.c 29 Sep 2009 14:17:19 -0000 1.1
+++ opcodes/opc2c.c 3 Oct 2009 08:29:05 -0000
@@ -23,6 +23,8 @@
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
+#include <errno.h>
+#include "libiberty.h"
static char * line_buf = NULL;
static int line_buf_size = 0;
@@ -119,7 +121,7 @@ int n_varies = 0;
unsigned char cur_bits[MAX_BYTES + 1];
-char * orig_filename;
+const char *orig_filename;
FILE * sim_log = NULL;
#define lprintf if (sim_log) fprintf
@@ -288,7 +290,7 @@ dump_lines (opcode * op, int level, Indi
}
*np = 0;
varnames[vn++] = strdup (name);
- printf ("#line %d \"%s\"\n", op->lineno, orig_filename);
+ printf ("#line %d \"%s\"\n", op->lineno + 1, orig_filename);
if (mask & ~0xff)
{
fprintf (stderr, "Error: variable %s spans bytes: %s\n",
@@ -586,19 +588,19 @@ main (int argc, char ** argv)
exit (1);
}
- orig_filename = argv[1];
+ orig_filename = lbasename (argv[1]);
in = fopen (argv[1], "r");
if (!in)
{
- fprintf (stderr, "Unable to open file %s for reading\n", argv[1]);
- perror ("The error was");
+ fprintf (stderr, "Unable to open file %s for reading: %s\n", argv[1],
+ xstrerror (errno));
exit (1);
}
n_opcodes = 0;
opcodes = (opcode **) malloc (sizeof (opcode *));
op = &prefix_text;
- op->lineno = 1;
+ op->lineno = 0;
while ((line = safe_fgets (in)) != 0)
{
lineno++;
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."