1999-05-10 DJ Delorie <dj@cygnus.com>
authorDJ Delorie <dj@redhat.com>
Tue, 11 May 1999 21:06:16 +0000 (21:06 +0000)
committerDJ Delorie <dj@redhat.com>
Tue, 11 May 1999 21:06:16 +0000 (21:06 +0000)
* 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

binutils/ChangeLog
binutils/Makefile.am
binutils/Makefile.in
binutils/objdump.c
binutils/rescoff.c
binutils/windres.c

index b61c921..f84ca5c 100644 (file)
@@ -1,3 +1,17 @@
+1999-05-10  DJ Delorie  <dj@cygnus.com>
+
+       * 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  <ian@zembu.com>
 
        * rename.c (smart_rename): Fix test of whether file exists.
index 4f3014f..f24ad92 100644 (file)
@@ -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)
index c32ae4d..5479616 100644 (file)
@@ -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
index 811dd0e..5baf235 100644 (file)
@@ -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);
        }
index 9a028c7..fe2487a 100644 (file)
@@ -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");
index 7de28c2..885cd51 100644 (file)
@@ -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;
            }