+2005-02-22 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.am (syslex.o, sysinfo.o): Pass AM_CFLAGS to compiler.
+ (syslex.o, sysinfo.o, dlltool.o, rescoff.o): Remove duplicate
+ dependencies. Run "make dep-am".
+ * nlmconv.c: Warning fixes.
+ * readelf.c: Likewise.
+ * srconv.c: Likewise.
+ * sysdump.c: Likewise.
+ * sysinfo.y: Likewise.
+ * syslex.l: Likewise. Use yyleng instead of strlen, memcpy instead
+ of strcpy.
+ * Makefile.in: Regenerate.
+
2005-02-21 H.J. Lu <hongjiu.lu@intel.com>
* objcopy.c (parse_flags): Replace SEC_SHARED with
./sysinfo$(EXEEXT_FOR_BUILD) -d <$(srcdir)/sysroff.info >sysroff.h
sysinfo$(EXEEXT_FOR_BUILD): sysinfo.o syslex.o
- $(CC_FOR_BUILD) $(CFLAGS) $(LDFLAGS) -o $@ sysinfo.o syslex.o
+ $(CC_FOR_BUILD) $(CFLAGS) $(LDFLAGS) -o $@ sysinfo.o syslex.o
-syslex.o: syslex.c sysinfo.h
+syslex.o:
if [ -r syslex.c ]; then \
- $(CC_FOR_BUILD) -c -I. $(CFLAGS) syslex.c ; \
+ $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS) syslex.c ; \
else \
- $(CC_FOR_BUILD) -c -I. -I$(srcdir) $(CFLAGS) $(srcdir)/syslex.c ;\
+ $(CC_FOR_BUILD) -c -I. -I$(srcdir) $(AM_CFLAGS) $(CFLAGS) $(srcdir)/syslex.c ;\
fi
-sysinfo.o: sysinfo.c
+sysinfo.o:
if [ -r sysinfo.c ]; then \
- $(CC_FOR_BUILD) -c -I. $(CFLAGS) sysinfo.c ; \
+ $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS) sysinfo.c ; \
else \
- $(CC_FOR_BUILD) -c -I. $(CFLAGS) $(srcdir)/sysinfo.c ; \
+ $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS) $(srcdir)/sysinfo.c ; \
fi
# We need these for parallel make.
dlltool_SOURCES = dlltool.c defparse.y deflex.l $(BULIBS)
dlltool_LDADD = $(BFDLIB) $(LIBIBERTY) @LEXLIB@ $(INTLLIBS)
-dlltool.o:dlltool.c
+dlltool.o:
$(COMPILE) -c $(DLLTOOL_DEFS) $(srcdir)/dlltool.c
-rescoff.o:rescoff.c
+rescoff.o:
$(COMPILE) -c $(DLLTOOL_DEFS) $(srcdir)/rescoff.c
coffdump_SOURCES = coffdump.c coffgrok.c $(BULIBS)
arparse.h
sysroff.o: sysroff.c
sysinfo.o: sysinfo.c
-syslex.o: syslex.c sysinfo.h
+syslex.o: syslex.c config.h sysinfo.h
defparse.o: defparse.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
$(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \
$(INCDIR)/fopen-same.h dlltool.h
./sysinfo$(EXEEXT_FOR_BUILD) -d <$(srcdir)/sysroff.info >sysroff.h
sysinfo$(EXEEXT_FOR_BUILD): sysinfo.o syslex.o
- $(CC_FOR_BUILD) $(CFLAGS) $(LDFLAGS) -o $@ sysinfo.o syslex.o
+ $(CC_FOR_BUILD) $(CFLAGS) $(LDFLAGS) -o $@ sysinfo.o syslex.o
-syslex.o: syslex.c sysinfo.h
+syslex.o:
if [ -r syslex.c ]; then \
- $(CC_FOR_BUILD) -c -I. $(CFLAGS) syslex.c ; \
+ $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS) syslex.c ; \
else \
- $(CC_FOR_BUILD) -c -I. -I$(srcdir) $(CFLAGS) $(srcdir)/syslex.c ;\
+ $(CC_FOR_BUILD) -c -I. -I$(srcdir) $(AM_CFLAGS) $(CFLAGS) $(srcdir)/syslex.c ;\
fi
-sysinfo.o: sysinfo.c
+sysinfo.o:
if [ -r sysinfo.c ]; then \
- $(CC_FOR_BUILD) -c -I. $(CFLAGS) sysinfo.c ; \
+ $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS) sysinfo.c ; \
else \
- $(CC_FOR_BUILD) -c -I. $(CFLAGS) $(srcdir)/sysinfo.c ; \
+ $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS) $(srcdir)/sysinfo.c ; \
fi
# We need these for parallel make.
rcparse.h: rcparse.c
sysinfo.h: sysinfo.c
-dlltool.o:dlltool.c
+dlltool.o:
$(COMPILE) -c $(DLLTOOL_DEFS) $(srcdir)/dlltool.c
-rescoff.o:rescoff.c
+rescoff.o:
$(COMPILE) -c $(DLLTOOL_DEFS) $(srcdir)/rescoff.c
# coff/sym.h and coff/ecoff.h won't be found by the automatic dependency
arparse.h
sysroff.o: sysroff.c
sysinfo.o: sysinfo.c
-syslex.o: syslex.c sysinfo.h
+syslex.o: syslex.c config.h sysinfo.h
defparse.o: defparse.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
$(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \
$(INCDIR)/fopen-same.h dlltool.h
bfd *sharedbfd;
size_t shared_offset = 0;
size_t shared_size = 0;
- Nlm_Internal_Fixed_Header sharedhdr;
+ static Nlm_Internal_Fixed_Header sharedhdr;
int len;
char *modname;
char **matching;
for (l = modules; l != NULL; l = l->next)
{
*set = strlen (l->string);
- strncpy (set + 1, l->string, *set);
+ strncpy ((char *) set + 1, l->string, *set);
set += *set + 1;
++c;
}
if (section->sh_type == SHT_GROUP)
{
char *name = SECTION_NAME (section);
- char *group_name, *start, *indices;
+ char *group_name;
+ unsigned char *start, *indices;
unsigned int entry, j, size;
Elf_Internal_Shdr *sec;
Elf_Internal_Sym *sym;
static unsigned long int
-read_leb128 (unsigned char *data, int *length_return, int sign)
+read_leb128 (unsigned char *data, unsigned int *length_return, int sign)
{
unsigned long int result = 0;
unsigned int num_read = 0;
process_extended_line_op (unsigned char *data, int is_stmt, int pointer_size)
{
unsigned char op_code;
- int bytes_read;
+ unsigned int bytes_read;
unsigned int len;
unsigned char *name;
unsigned long adr;
while (start < end)
{
- int bytes_read;
+ unsigned int bytes_read;
unsigned long entry;
unsigned long tag;
unsigned long attribute;
unsigned long cu_offset)
{
unsigned op;
- int bytes_read;
+ unsigned int bytes_read;
unsigned long uvalue;
unsigned char *end = data + length;
int need_frame_base = 0;
{
unsigned long uvalue = 0;
unsigned char *block_start = NULL;
- int bytes_read;
+ unsigned int bytes_read;
switch (form)
{
level = 0;
while (tags < start)
{
- int bytes_read;
+ unsigned int bytes_read;
unsigned long abbrev_number;
abbrev_entry *entry;
abbrev_attr *attr;
while (*data != 0)
{
unsigned char *name;
- int bytes_read;
+ unsigned int bytes_read;
printf (_(" %d\t"), ++state_machine_regs.last_file_entry);
name = data;
{
unsigned char op_code;
int adv;
- int bytes_read;
+ unsigned int bytes_read;
op_code = *data++;
case DW_MACINFO_define:
lineno = read_leb128 (curr, & bytes_read, 0);
curr += bytes_read;
- string = curr;
+ string = (char *) curr;
curr += strlen (string) + 1;
printf (_(" DW_MACINFO_define - lineno : %d macro : %s\n"),
lineno, string);
case DW_MACINFO_undef:
lineno = read_leb128 (curr, & bytes_read, 0);
curr += bytes_read;
- string = curr;
+ string = (char *) curr;
curr += strlen (string) + 1;
printf (_(" DW_MACINFO_undef - lineno : %d macro : %s\n"),
lineno, string);
constant = read_leb128 (curr, & bytes_read, 0);
curr += bytes_read;
- string = curr;
+ string = (char *) curr;
curr += strlen (string) + 1;
printf (_(" DW_MACINFO_vendor_ext - constant : %d string : %s\n"),
constant, string);
Frame_Chunk *remembered_state = 0;
Frame_Chunk *rs;
int is_eh = streq (SECTION_NAME (section), ".eh_frame");
- int length_return;
+ unsigned int length_return;
int max_regs = 0;
printf (_("The section %s contains:\n"), SECTION_NAME (section));
version = *start++;
- fc->augmentation = start;
- start = strchr (start, '\0') + 1;
+ fc->augmentation = (char *) start;
+ start = (unsigned char *) strchr ((char *) start, '\0') + 1;
if (fc->augmentation[0] == 'z')
{
if (augmentation_data_len)
{
unsigned char *p, *q;
- p = fc->augmentation + 1;
+ p = (unsigned char *) fc->augmentation + 1;
q = augmentation_data;
while (1)
/* srconv.c -- Sysroff conversion program
- Copyright 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004
- Free Software Foundation, Inc.
+ Copyright 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+ 2005 Free Software Foundation, Inc.
This file is part of GNU Binutils.
static int get_ordinary_id (int);
static char *section_translate (char *);
static char *strip_suffix (char *);
-static void checksum (FILE *, char *, int, int);
-static void writeINT (int, char *, int *, int, FILE *);
-static void writeBITS (int, char *, int *, int);
-static void writeBARRAY (barray, char *, int *, int, FILE *);
-static void writeCHARS (char *, char *, int *, int, FILE *);
+static void checksum (FILE *, unsigned char *, int, int);
+static void writeINT (int, unsigned char *, int *, int, FILE *);
+static void writeBITS (int, unsigned char *, int *, int);
+static void writeBARRAY (barray, unsigned char *, int *, int, FILE *);
+static void writeCHARS (char *, unsigned char *, int *, int, FILE *);
static void wr_tr (void);
static void wr_un (struct coff_ofile *, struct coff_sfile *, int, int);
static void wr_hd (struct coff_ofile *);
/* IT LEN stuff CS */
static void
-checksum (FILE *file, char *ptr, int size, int code)
+checksum (FILE *file, unsigned char *ptr, int size, int code)
{
int j;
int last;
static void
-writeINT (int n, char *ptr, int *idx, int size, FILE *file)
+writeINT (int n, unsigned char *ptr, int *idx, int size, FILE *file)
{
int byte = *idx / 8;
}
static void
-writeBITS (int val, char *ptr, int *idx, int size)
+writeBITS (int val, unsigned char *ptr, int *idx, int size)
{
int byte = *idx / 8;
int bit = *idx % 8;
}
static void
-writeBARRAY (barray data, char *ptr, int *idx, int size ATTRIBUTE_UNUSED,
- FILE *file)
+writeBARRAY (barray data, unsigned char *ptr, int *idx,
+ int size ATTRIBUTE_UNUSED, FILE *file)
{
int i;
}
static void
-writeCHARS (char *string, char *ptr, int *idx, int size, FILE *file)
+writeCHARS (char *string, unsigned char *ptr, int *idx, int size, FILE *file)
{
int i = *idx / 8;
/* Sysroff object format dumper.
- Copyright 1994, 1995, 1998, 1999, 2000, 2001, 2002, 2003
+ Copyright 1994, 1995, 1998, 1999, 2000, 2001, 2002, 2003, 2005
Free Software Foundation, Inc.
This file is part of GNU Binutils.
static void show_usage (FILE *, int);
extern char *getCHARS (unsigned char *, int *, int, int);
-extern int fillup (char *);
+extern int fillup (unsigned char *);
extern barray getBARRAY (unsigned char *, int *, int, int);
extern int getINT (unsigned char *, int *, int, int);
-extern int getBITS (char *, int *, int, int);
+extern int getBITS (unsigned char *, int *, int, int);
extern void sysroff_swap_tr_in (void);
extern void sysroff_print_tr_out (void);
extern int main (int, char **);
}
int
-fillup (char *ptr)
+fillup (unsigned char *ptr)
{
int size;
int sum;
}
int
-getBITS (char *ptr, int *idx, int size, int max)
+getBITS (unsigned char *ptr, int *idx, int size, int max)
{
int byte = *idx / 8;
int bit = *idx % 8;
void
sysroff_swap_tr_in (void)
{
- char raw[255];
+ unsigned char raw[255];
memset (raw, 0, 255);
fillup (raw);
-/* Copyright 2001, 2003 Free Software Foundation, Inc.
+/* Copyright 2001, 2003, 2005 Free Software Foundation, Inc.
Written by Steve Chamberlain of Cygnus Support (steve@cygnus.com).
This file is part of GNU binutils.
char *loop [] = {"","n","m","/*BAD*/"};
char *names[] = {" ","[n]","[n][m]"};
char *pnames[]= {"","*","**"};
+
+static int yyerror (char *s);
+extern int yylex (void);
%}
printf("void sysroff_swap_%s_in(ptr)\n",$2);
printf("struct IT_%s *ptr;\n", it);
printf("{\n");
- printf("char raw[255];\n");
+ printf("unsigned char raw[255];\n");
printf("\tint idx = 0 ;\n");
printf("\tint size;\n");
printf("memset(raw,0,255);\n");
printf("FILE * file;\n");
printf("struct IT_%s *ptr;\n", it);
printf("{\n");
- printf("\tchar raw[255];\n");
+ printf("\tunsigned char raw[255];\n");
printf("\tint idx = 16 ;\n");
printf("\tmemset (raw, 0, 255);\n");
printf("\tcode = IT_%s_CODE;\n", it);
return 0;
}
-int
+static int
yyerror (char *s)
{
fprintf(stderr, "%s\n" , s);
%{
-/* Copyright 2001, 2003 Free Software Foundation, Inc.
+/* Copyright 2001, 2003, 2005 Free Software Foundation, Inc.
This file is part of GLD, the Gnu Linker.
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
+#include "config.h"
+#ifdef HAVE_STRING_H
+#include <string.h>
+#else
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+#endif
#include "sysinfo.h"
char *word;
int number;
int unit;
+#define YY_NO_UNPUT
+
#ifndef yywrap
static int yywrap (void) { return 1; }
#endif
+
+extern int yylex (void);
%}
%%
"(" { return '(';}
"\t" { ; }
"\n" { ; }
"\""[^\"]*"\"" {
-yylval.s = malloc(strlen (yytext));
-strcpy(yylval.s, yytext+1);
-yylval.s[strlen(yylval.s)-1] = 0;
+ yylval.s = malloc (yyleng - 1);
+ memcpy (yylval.s, yytext + 1, yyleng - 2);
+ yylval.s[yyleng - 2] = '\0';
return NAME;
}