diff --git a/binutils/ChangeLog b/binutils/ChangeLog index b61c92128a..f84ca5ca8b 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,17 @@ +1999-05-10 DJ Delorie + + * windres.c (quot): Quote shell metacharacters in a string + (main): quote parameters to cpp that might have metacharacters in + them. Allow -D as an alias for --define to allow for sharing make + macros with gcc. + + * objdump.c (dump_reloc_set): don't core if howto->name is NULL + + * Makefile.am: Give rescoff.c a cpu-specific -D so it can set + the correct BFD. + * Makefile.in: ditto + * rescoff.c (write_coff_file): Set the correct BFD + 1999-05-06 Ian Lance Taylor * rename.c (smart_rename): Fix test of whether file exists. diff --git a/binutils/Makefile.am b/binutils/Makefile.am index 4f3014f328..f24ad920bc 100644 --- a/binutils/Makefile.am +++ b/binutils/Makefile.am @@ -240,6 +240,9 @@ dlltool_LDADD = $(BFDLIB) $(LIBIBERTY) @LEXLIB@ $(INTLLIBS) dlltool.o:dlltool.c $(COMPILE) -c $(DLLTOOL_DEFS) $(srcdir)/dlltool.c +rescoff.o:rescoff.c + $(COMPILE) -c $(DLLTOOL_DEFS) $(srcdir)/rescoff.c + coffdump_SOURCES = coffdump.c coffgrok.c $(BULIBS) sysdump_SOURCES = sysdump.c $(BULIBS) diff --git a/binutils/Makefile.in b/binutils/Makefile.in index c32ae4d723..54796164a3 100644 --- a/binutils/Makefile.in +++ b/binutils/Makefile.in @@ -1125,6 +1125,9 @@ sysinfo.o: sysinfo.c dlltool.o:dlltool.c $(COMPILE) -c $(DLLTOOL_DEFS) $(srcdir)/dlltool.c +rescoff.o:rescoff.c + $(COMPILE) -c $(DLLTOOL_DEFS) $(srcdir)/rescoff.c + # coff/sym.h and coff/ecoff.h won't be found by the automatic dependency # scripts, since they are only included conditionally. nlmconv.o: nlmconv.c $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h diff --git a/binutils/objdump.c b/binutils/objdump.c index 811dd0eff1..5baf235ebb 100644 --- a/binutils/objdump.c +++ b/binutils/objdump.c @@ -2468,7 +2468,10 @@ dump_reloc_set (abfd, sec, relpp, relcount) if (sym_name) { printf_vma (q->address); - printf (" %-16s ", q->howto->name); + if (q->howto->name) + printf (" %-16s ", q->howto->name); + else + printf (" %-16d ", q->howto->type); objdump_print_symname (abfd, (struct disassemble_info *) NULL, *q->sym_ptr_ptr); } diff --git a/binutils/rescoff.c b/binutils/rescoff.c index 9a028c7305..fe2487a396 100644 --- a/binutils/rescoff.c +++ b/binutils/rescoff.c @@ -447,9 +447,14 @@ write_coff_file (filename, target, resources) if (! bfd_set_format (abfd, bfd_object)) bfd_fatal ("bfd_set_format"); +#ifdef DLLTOOL_ARM + if (! bfd_set_arch_mach (abfd, bfd_arch_arm, 0)) + bfd_fatal ("bfd_set_arch_mach(arm)"); +#else /* FIXME: This is obviously i386 specific. */ if (! bfd_set_arch_mach (abfd, bfd_arch_i386, 0)) - bfd_fatal ("bfd_set_arch_mach"); + bfd_fatal ("bfd_set_arch_mach(i386)"); +#endif /* arm */ if (! bfd_set_file_flags (abfd, HAS_SYMS | HAS_RELOC)) bfd_fatal ("bfd_set_file_flags"); diff --git a/binutils/windres.c b/binutils/windres.c index 7de28c259e..885cd51fc0 100644 --- a/binutils/windres.c +++ b/binutils/windres.c @@ -724,6 +724,34 @@ No input-file is stdin, default rc. No output-file is stdout, default rc.\n")); exit (status); } +/* Quote characters that will confuse the shell when we run the preprocessor */ +static const char *quot (string) + const char *string; +{ + static char *buf = 0; + static int buflen = 0; + int slen = strlen (string); + const char *src; + char *dest; + + if ((buflen < slen * 2 + 2) || !buf) + { + buflen = slen * 2 + 2; + if (buf) + free (buf); + buf = (char *) xmalloc (buflen); + } + + for (src=string, dest=buf; *src; src++, dest++) + { + if (*src == '(' || *src == ')' || *src == ' ') + *dest++ = '\\'; + *dest = *src; + } + *dest = 0; + return buf; +} + /* The main function. */ int @@ -739,6 +767,7 @@ main (argc, argv) char *target; char *preprocessor; char *preprocargs; + const char *quotedarg; int language; struct res_directory *resources; @@ -765,7 +794,7 @@ main (argc, argv) preprocargs = NULL; language = -1; - while ((c = getopt_long (argc, argv, "i:o:I:O:F:", long_options, + while ((c = getopt_long (argc, argv, "i:o:I:O:F:D:", long_options, (int *) 0)) != EOF) { switch (c) @@ -794,18 +823,21 @@ main (argc, argv) preprocessor = optarg; break; + case 'D': case OPTION_DEFINE: if (preprocargs == NULL) { - preprocargs = xmalloc (strlen (optarg) + 3); - sprintf (preprocargs, "-D%s", optarg); + quotedarg = quot (optarg); + preprocargs = xmalloc (strlen (quotedarg) + 3); + sprintf (preprocargs, "-D%s", quotedarg); } else { char *n; - n = xmalloc (strlen (preprocargs) + strlen (optarg) + 4); - sprintf (n, "%s -D%s", preprocargs, optarg); + quotedarg = quot (optarg); + n = xmalloc (strlen (preprocargs) + strlen (quotedarg) + 4); + sprintf (n, "%s -D%s", preprocargs, quotedarg); free (preprocargs); preprocargs = n; } @@ -814,15 +846,17 @@ main (argc, argv) case OPTION_INCLUDE_DIR: if (preprocargs == NULL) { - preprocargs = xmalloc (strlen (optarg) + 3); - sprintf (preprocargs, "-I%s", optarg); + quotedarg = quot (optarg); + preprocargs = xmalloc (strlen (quotedarg) + 3); + sprintf (preprocargs, "-I%s", quotedarg); } else { char *n; - n = xmalloc (strlen (preprocargs) + strlen (optarg) + 4); - sprintf (n, "%s -I%s", preprocargs, optarg); + quotedarg = quot (optarg); + n = xmalloc (strlen (preprocargs) + strlen (quotedarg) + 4); + sprintf (n, "%s -I%s", preprocargs, quotedarg); free (preprocargs); preprocargs = n; }