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
This commit is contained in:
DJ Delorie 1999-05-11 21:06:16 +00:00
parent ec0ef80e9f
commit 09cda596de
6 changed files with 73 additions and 11 deletions

View 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.

View 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)

View 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

View 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);
}

View 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");

View 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;
}