aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog14
-rw-r--r--binutils/Makefile.am20
-rw-r--r--binutils/Makefile.in20
-rw-r--r--binutils/nlmconv.c4
-rw-r--r--binutils/readelf.c33
-rw-r--r--binutils/srconv.c26
-rw-r--r--binutils/sysdump.c12
-rw-r--r--binutils/sysinfo.y11
-rw-r--r--binutils/syslex.l20
9 files changed, 95 insertions, 65 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 19cec9d..2e5cbf9 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,17 @@
+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
diff --git a/binutils/Makefile.am b/binutils/Makefile.am
index fab929d..79ed321 100644
--- a/binutils/Makefile.am
+++ b/binutils/Makefile.am
@@ -219,20 +219,20 @@ sysroff.h: sysinfo$(EXEEXT_FOR_BUILD) sysroff.info
./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.
@@ -247,10 +247,10 @@ srconv_SOURCES = srconv.c coffgrok.c $(BULIBS)
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)
@@ -544,7 +544,7 @@ arlex.o: arlex.c $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
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
diff --git a/binutils/Makefile.in b/binutils/Makefile.in
index 0ec63a2..ebfbc10 100644
--- a/binutils/Makefile.in
+++ b/binutils/Makefile.in
@@ -989,20 +989,20 @@ sysroff.h: sysinfo$(EXEEXT_FOR_BUILD) sysroff.info
./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.
@@ -1012,10 +1012,10 @@ nlmheader.h: nlmheader.c
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
@@ -1283,7 +1283,7 @@ arlex.o: arlex.c $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
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
diff --git a/binutils/nlmconv.c b/binutils/nlmconv.c
index 44593c1..b7798eb 100644
--- a/binutils/nlmconv.c
+++ b/binutils/nlmconv.c
@@ -193,7 +193,7 @@ main (int argc, char **argv)
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;
@@ -976,7 +976,7 @@ main (int argc, char **argv)
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;
}
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 877c04b..75be6c4 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -4027,7 +4027,8 @@ process_section_groups (FILE *file)
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;
@@ -7011,7 +7012,7 @@ dump_section (Elf_Internal_Shdr *section, FILE *file)
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;
@@ -7075,7 +7076,7 @@ static int
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;
@@ -7445,7 +7446,7 @@ process_abbrev_section (unsigned char *start, unsigned char *end)
while (start < end)
{
- int bytes_read;
+ unsigned int bytes_read;
unsigned long entry;
unsigned long tag;
unsigned long attribute;
@@ -7620,7 +7621,7 @@ decode_location_expression (unsigned char * data,
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;
@@ -7990,7 +7991,7 @@ read_and_display_attr_value (unsigned long attribute,
{
unsigned long uvalue = 0;
unsigned char *block_start = NULL;
- int bytes_read;
+ unsigned int bytes_read;
switch (form)
{
@@ -8729,7 +8730,7 @@ process_debug_info (Elf_Internal_Shdr *section, unsigned char *start,
level = 0;
while (tags < start)
{
- int bytes_read;
+ unsigned int bytes_read;
unsigned long abbrev_number;
abbrev_entry *entry;
abbrev_attr *attr;
@@ -9031,7 +9032,7 @@ display_debug_lines (Elf_Internal_Shdr *section,
while (*data != 0)
{
unsigned char *name;
- int bytes_read;
+ unsigned int bytes_read;
printf (_(" %d\t"), ++state_machine_regs.last_file_entry);
name = data;
@@ -9058,7 +9059,7 @@ display_debug_lines (Elf_Internal_Shdr *section,
{
unsigned char op_code;
int adv;
- int bytes_read;
+ unsigned int bytes_read;
op_code = *data++;
@@ -9306,7 +9307,7 @@ display_debug_macinfo (Elf_Internal_Shdr *section,
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);
@@ -9315,7 +9316,7 @@ display_debug_macinfo (Elf_Internal_Shdr *section,
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);
@@ -9327,7 +9328,7 @@ display_debug_macinfo (Elf_Internal_Shdr *section,
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);
@@ -10006,7 +10007,7 @@ display_debug_frames (Elf_Internal_Shdr *section,
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));
@@ -10074,8 +10075,8 @@ display_debug_frames (Elf_Internal_Shdr *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')
{
@@ -10151,7 +10152,7 @@ display_debug_frames (Elf_Internal_Shdr *section,
if (augmentation_data_len)
{
unsigned char *p, *q;
- p = fc->augmentation + 1;
+ p = (unsigned char *) fc->augmentation + 1;
q = augmentation_data;
while (1)
diff --git a/binutils/srconv.c b/binutils/srconv.c
index 6f6fc5c..4c909b7 100644
--- a/binutils/srconv.c
+++ b/binutils/srconv.c
@@ -1,6 +1,6 @@
/* 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.
@@ -46,11 +46,11 @@ static int get_member_id (int);
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 *);
@@ -158,7 +158,7 @@ strip_suffix (char *name)
/* 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;
@@ -181,7 +181,7 @@ checksum (FILE *file, char *ptr, int size, int code)
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;
@@ -222,7 +222,7 @@ writeINT (int n, char *ptr, int *idx, int size, FILE *file)
}
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;
@@ -239,8 +239,8 @@ writeBITS (int val, char *ptr, int *idx, int size)
}
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;
@@ -250,7 +250,7 @@ writeBARRAY (barray data, char *ptr, int *idx, int size ATTRIBUTE_UNUSED,
}
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;
diff --git a/binutils/sysdump.c b/binutils/sysdump.c
index e75de84..3b219c7 100644
--- a/binutils/sysdump.c
+++ b/binutils/sysdump.c
@@ -1,5 +1,5 @@
/* 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.
@@ -55,10 +55,10 @@ static void module (void);
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 **);
@@ -121,7 +121,7 @@ dh (unsigned char *ptr, int size)
}
int
-fillup (char *ptr)
+fillup (unsigned char *ptr)
{
int size;
int sum;
@@ -198,7 +198,7 @@ getINT (unsigned char *ptr, int *idx, int size, int max)
}
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;
@@ -265,7 +265,7 @@ pbarray (barray *y)
void
sysroff_swap_tr_in (void)
{
- char raw[255];
+ unsigned char raw[255];
memset (raw, 0, 255);
fillup (raw);
diff --git a/binutils/sysinfo.y b/binutils/sysinfo.y
index bf19263..807ac78 100644
--- a/binutils/sysinfo.y
+++ b/binutils/sysinfo.y
@@ -1,4 +1,4 @@
-/* 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.
@@ -37,6 +37,9 @@ int rdepth;
char *loop [] = {"","n","m","/*BAD*/"};
char *names[] = {" ","[n]","[n][m]"};
char *pnames[]= {"","*","**"};
+
+static int yyerror (char *s);
+extern int yylex (void);
%}
@@ -117,7 +120,7 @@ it:
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");
@@ -129,7 +132,7 @@ it:
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);
@@ -431,7 +434,7 @@ if (writecode == 'd')
return 0;
}
-int
+static int
yyerror (char *s)
{
fprintf(stderr, "%s\n" , s);
diff --git a/binutils/syslex.l b/binutils/syslex.l
index ffaf4fa..6dd32fa 100644
--- a/binutils/syslex.l
+++ b/binutils/syslex.l
@@ -1,5 +1,5 @@
%{
-/* Copyright 2001, 2003 Free Software Foundation, Inc.
+/* Copyright 2001, 2003, 2005 Free Software Foundation, Inc.
This file is part of GLD, the Gnu Linker.
@@ -18,14 +18,26 @@ along with GLD; see the file COPYING. If not, write to the Free
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 '(';}
@@ -37,9 +49,9 @@ static int yywrap (void) { return 1; }
"\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;
}