diff options
author | Daniel Jacobowitz <drow@false.org> | 2004-04-09 18:28:17 +0000 |
---|---|---|
committer | Daniel Jacobowitz <drow@false.org> | 2004-04-09 18:28:17 +0000 |
commit | 8a258c7fd660c7db8910882cb91166d6cf876c5e (patch) | |
tree | a009339ef52ebdb2c3504725e97f85ef67b57a84 /binutils | |
parent | 312dab883fa14712dfe066ec6ce903b5a6ca81f0 (diff) | |
download | fsf-binutils-gdb-8a258c7fd660c7db8910882cb91166d6cf876c5e.zip fsf-binutils-gdb-8a258c7fd660c7db8910882cb91166d6cf876c5e.tar.gz fsf-binutils-gdb-8a258c7fd660c7db8910882cb91166d6cf876c5e.tar.bz2 |
Merge to 2.15 branch.
Diffstat (limited to 'binutils')
-rw-r--r-- | binutils/ChangeLog | 53 | ||||
-rw-r--r-- | binutils/MAINTAINERS | 6 | ||||
-rw-r--r-- | binutils/ar.c | 183 | ||||
-rw-r--r-- | binutils/arsup.c | 4 | ||||
-rw-r--r-- | binutils/deflex.l | 32 | ||||
-rw-r--r-- | binutils/defparse.y | 40 | ||||
-rw-r--r-- | binutils/dlltool.c | 80 | ||||
-rw-r--r-- | binutils/dlltool.h | 11 | ||||
-rw-r--r-- | binutils/objcopy.c | 4 | ||||
-rw-r--r-- | binutils/readelf.c | 29 | ||||
-rw-r--r-- | binutils/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/ar.exp | 38 |
12 files changed, 305 insertions, 181 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 9c9ce85..eb820f9 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,56 @@ +2004-04-09 Daniel Jacobowitz <drow@mvista.com> + + Merge from mainline: + 2004-04-07 Benjamin Monate <benjamin.monate@cea.fr> + PR 86 + * arsup.c (ar_save): Use smart_rename. + + 2004-04-01 Dean Luick <luick@cray.com> + * readelf.c (display_debug_pubnames): Align offset and data + columns. + (read_and_display_attr_value): Add missing break; + (debug_displays): Enable the display of the .debug_pubtypes + section. + + 2004-03-21 Richard Henderson <rth@redhat.com> + * readelf.c (display_debug_frames): Don't crash for mismatched + DW_CFA_restore_state. + + 2004-03-10 Ben Elliston <bje@gnu.org> + * MAINTAINERS: Update my mail address. + + 2004-03-08 Danny Smith <dannysmith@users.sourceforge.net> + * deflex.l: Handle "PRIVATE" string. + * defparse.y (%token): Add PRIVATE. + (%type): Add opt_PRIVATE. + (expline): Pass opt_PRIVATE to def_exports. + (opt_PRIVATE): Handle PRIVATE token. + * dlltool.h (def_exports): Add 7th param for private flag to + declaration. + * dlltool.c: Add PRIVATE to comment on EXPORTS syntax. + (struct export): Add 'private' field. + (def_exports): Set 'private' field of struct exports. + (scan_drectve_symbols): Adjust calls to def_exports. + (scan_filtered_symbols): Likewise. + (dump_def_info): Print 'private' field. + (gen_def_file): Likewise. + (gen_lib_file): Skip generation of lib object if private. + Delete tmp object files in same order as they were generated. + Don't delete non-existent private object files. + + 2004-02-27 Andreas Schwab <schwab@suse.de> + * ar.c (main): Support POSIX-compatible argument parsing. + + 2004-02-23 Daniel Lucq <daniel@lucq.org> + * readelf.c (process_mips_specific): Print conflictsno as an + unsigned long. + + 2004-02-21 Dmitry Timoshkov <dmitry@baikal.ru> + * dlltool.c (gen_exp_file): Always output names for forwarded symbols. + + 2004-02-19 Jakub Jelinek <jakub@redhat.com> + * objcopy.c (copy_section): Avoid warnings. + 2004-02-14 Andrew Cagney <cagney@redhat.com> * ar.c (remove_output): Use bfd_cache_close. diff --git a/binutils/MAINTAINERS b/binutils/MAINTAINERS index 79cabaa..28c9144 100644 --- a/binutils/MAINTAINERS +++ b/binutils/MAINTAINERS @@ -59,7 +59,7 @@ responsibility among the other maintainers. ARM Richard Earnshaw <rearnsha@arm.com> AVR Denis Chertykov <denisc@overta.ru> AVR Marek Michalkiewicz <marekm@amelek.gda.pl> - BUILD SYSTEM Ben Elliston <bje@wasabisystems.com> + BUILD SYSTEM Ben Elliston <bje@gnu.org> BUILD SYSTEM Daniel Jacobowitz <dan@debian.org> CRIS Hans-Peter Nilsson <hp@axis.com> DWARF2 Jason Merrill <jason@redhat.com> @@ -77,7 +77,7 @@ responsibility among the other maintainers. ix86 H.J.Lu <hjl@gnu.org> ix86 INTEL MODE Diego Novillo <dnovillo@redhat.com> M68HC11 M68HC12 Stephane Carrez <stcarrez@nerim.fr> - M68k Ben Elliston <bje@wasabisystems.com> + M68k Ben Elliston <bje@gnu.org> MIPS Eric Christopher <echristo@redhat.com> MIPS Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de> MMIX Hans-Peter Nilsson <hp@bitrange.com> @@ -90,7 +90,7 @@ responsibility among the other maintainers. SH Alexandre Oliva <aoliva@redhat.com> SH Kaz Kojima <kkojima@rr.iij4u.or.jp> SPARC Jakub Jelinek <jakub@redhat.com> - TESTSUITES Ben Elliston <bje@wasabisystems.com> + TESTSUITES Ben Elliston <bje@gnu.org> TIC4X Svein Seldal <svein.seldal@solidas.com> TIC54X Timothy Wall <twall@alum.mit.edu> VAX Jason R Thorpe <thorpej@wasabisystems.com> diff --git a/binutils/ar.c b/binutils/ar.c index b85d62e..ec0657d 100644 --- a/binutils/ar.c +++ b/binutils/ar.c @@ -1,6 +1,6 @@ /* ar.c - Archive modify and extract. Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003 + 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -353,6 +353,7 @@ main (int argc, char **argv) char *inarch_filename; int show_version; int i; + int do_posix = 0; #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) setlocale (LC_MESSAGES, ""); @@ -459,107 +460,125 @@ main (int argc, char **argv) if (argc < 2) usage (0); - arg_ptr = argv[1]; + arg_index = 1; + arg_ptr = argv[arg_index]; if (*arg_ptr == '-') - ++arg_ptr; /* compatibility */ + { + /* When the first option starts with '-' we support POSIX-compatible + option parsing. */ + do_posix = 1; + ++arg_ptr; /* compatibility */ + } - while ((c = *arg_ptr++) != '\0') + do { - switch (c) + while ((c = *arg_ptr++) != '\0') { - case 'd': - case 'm': - case 'p': - case 'q': - case 'r': - case 't': - case 'x': - if (operation != none) - fatal (_("two different operation options specified")); switch (c) { case 'd': - operation = delete; - operation_alters_arch = TRUE; - break; case 'm': - operation = move; - operation_alters_arch = TRUE; - break; case 'p': - operation = print_files; - break; case 'q': - operation = quick_append; - operation_alters_arch = TRUE; - break; case 'r': - operation = replace; - operation_alters_arch = TRUE; - break; case 't': - operation = print_table; - break; case 'x': - operation = extract; + if (operation != none) + fatal (_("two different operation options specified")); + switch (c) + { + case 'd': + operation = delete; + operation_alters_arch = TRUE; + break; + case 'm': + operation = move; + operation_alters_arch = TRUE; + break; + case 'p': + operation = print_files; + break; + case 'q': + operation = quick_append; + operation_alters_arch = TRUE; + break; + case 'r': + operation = replace; + operation_alters_arch = TRUE; + break; + case 't': + operation = print_table; + break; + case 'x': + operation = extract; + break; + } + case 'l': + break; + case 'c': + silent_create = 1; + break; + case 'o': + preserve_dates = 1; + break; + case 'V': + show_version = TRUE; + break; + case 's': + write_armap = 1; + break; + case 'S': + write_armap = -1; + break; + case 'u': + newer_only = 1; + break; + case 'v': + verbose = 1; + break; + case 'a': + postype = pos_after; + break; + case 'b': + postype = pos_before; break; + case 'i': + postype = pos_before; + break; + case 'M': + mri_mode = 1; + break; + case 'N': + counted_name_mode = TRUE; + break; + case 'f': + ar_truncate = TRUE; + break; + case 'P': + full_pathname = TRUE; + break; + default: + /* xgettext:c-format */ + non_fatal (_("illegal option -- %c"), c); + usage (0); } - case 'l': - break; - case 'c': - silent_create = 1; - break; - case 'o': - preserve_dates = 1; - break; - case 'V': - show_version = TRUE; - break; - case 's': - write_armap = 1; - break; - case 'S': - write_armap = -1; - break; - case 'u': - newer_only = 1; - break; - case 'v': - verbose = 1; - break; - case 'a': - postype = pos_after; - break; - case 'b': - postype = pos_before; - break; - case 'i': - postype = pos_before; - break; - case 'M': - mri_mode = 1; - break; - case 'N': - counted_name_mode = TRUE; - break; - case 'f': - ar_truncate = TRUE; - break; - case 'P': - full_pathname = TRUE; - break; - default: - /* xgettext:c-format */ - non_fatal (_("illegal option -- %c"), c); - usage (0); } + + /* With POSIX-compatible option parsing continue with the next + argument if it starts with '-'. */ + if (do_posix && arg_index + 1 < argc && argv[arg_index + 1][0] == '-') + arg_ptr = argv[++arg_index] + 1; + else + do_posix = 0; } + while (do_posix); if (show_version) print_version ("ar"); - if (argc < 3) + ++arg_index; + if (arg_index >= argc) usage (0); if (mri_mode) @@ -578,7 +597,7 @@ main (int argc, char **argv) if ((operation == none || operation == print_table) && write_armap == 1) { - ranlib_only (argv[2]); + ranlib_only (argv[arg_index]); xexit (0); } @@ -588,8 +607,6 @@ main (int argc, char **argv) if (newer_only && operation != replace) fatal (_("`u' is only meaningful with the `r' option.")); - arg_index = 2; - if (postype != pos_default) posname = argv[arg_index++]; diff --git a/binutils/arsup.c b/binutils/arsup.c index a621bf9..5160dc4 100644 --- a/binutils/arsup.c +++ b/binutils/arsup.c @@ -1,5 +1,5 @@ /* arsup.c - Archive support for MRI compatibility - Copyright 1992, 1994, 1995, 1996, 1997, 2000, 2002, 2003 + Copyright 1992, 1994, 1995, 1996, 1997, 2000, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -333,7 +333,7 @@ ar_save (void) bfd_close (obfd); - rename (ofilename, real_name); + smart_rename (ofilename, real_name, 0); obfd = 0; free (ofilename); } diff --git a/binutils/deflex.l b/binutils/deflex.l index 106cc7b..bdf15d3 100644 --- a/binutils/deflex.l +++ b/binutils/deflex.l @@ -1,28 +1,27 @@ %{/* deflex.l - Lexer for .def files */ -/* Copyright 1995, 1997, 1998, 1999, 2002, 2003 Free Software Foundation, Inc. +/* Copyright 1995, 1997, 1998, 1999, 2002, 2003, 2004 + Free Software Foundation, Inc. -This file is part of GNU Binutils. + This file is part of GNU Binutils. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* Contributed by Steve Chamberlain - sac@cygnus.com +/* Contributed by Steve Chamberlain: sac@cygnus.com */ -*/ #define DONTDECLARE_MALLOC #include "libiberty.h" #include "defparse.h" @@ -46,6 +45,7 @@ int linenumber; "BASE" { return BASE;} "CONSTANT" { return CONSTANT; } "NONAME" { return NONAME; } +"PRIVATE" { return PRIVATE; } "READ" { return READ;} "WRITE" { return WRITE;} "EXECUTE" { return EXECUTE;} diff --git a/binutils/defparse.y b/binutils/defparse.y index d0bccd9..b58aaee 100644 --- a/binutils/defparse.y +++ b/binutils/defparse.y @@ -1,22 +1,23 @@ %{ /* defparse.y - parser for .def files */ -/* Copyright 1995, 1997, 1998, 1999 Free Software Foundation, Inc. +/* Copyright 1995, 1997, 1998, 1999, 2004 + Free Software Foundation, Inc. -This file is part of GNU Binutils. + This file is part of GNU Binutils. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" #include "bucomm.h" @@ -30,11 +31,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ %token NAME, LIBRARY, DESCRIPTION, STACKSIZE, HEAPSIZE, CODE, DATA %token SECTIONS, EXPORTS, IMPORTS, VERSIONK, BASE, CONSTANT -%token READ WRITE EXECUTE SHARED NONSHARED NONAME +%token READ WRITE EXECUTE SHARED NONSHARED NONAME PRIVATE %token SINGLE MULTIPLE INITINSTANCE INITGLOBAL TERMINSTANCE TERMGLOBAL %token <id> ID %token <number> NUMBER -%type <number> opt_base opt_ordinal opt_NONAME opt_CONSTANT opt_DATA +%type <number> opt_base opt_ordinal opt_NONAME opt_CONSTANT opt_DATA opt_PRIVATE %type <number> attr attr_list opt_number %type <id> opt_name opt_equal_name @@ -66,8 +67,8 @@ explist: ; expline: - ID opt_equal_name opt_ordinal opt_NONAME opt_CONSTANT opt_DATA - { def_exports ($1, $2, $3, $4, $5, $6);} + ID opt_equal_name opt_ordinal opt_NONAME opt_CONSTANT opt_DATA opt_PRIVATE + { def_exports ($1, $2, $3, $4, $5, $6, $7);} ; implist: implist impline @@ -132,6 +133,11 @@ opt_DATA: | { $$ = 0; } ; +opt_PRIVATE: + PRIVATE { $$ = 1; } + | { $$ = 0; } + ; + opt_name: ID { $$ =$1; } | ID '.' ID { diff --git a/binutils/dlltool.c b/binutils/dlltool.c index 9d25861..5f921ae 100644 --- a/binutils/dlltool.c +++ b/binutils/dlltool.c @@ -1,5 +1,5 @@ /* dlltool.c -- tool to generate stuff for PE style DLLs - Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 + Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -49,7 +49,7 @@ EXPORTS ( ( ( <name1> [ = <name2> ] ) | ( <name1> = <module-name> . <external-name>)) - [ @ <integer> ] [ NONAME ] [CONSTANT] [DATA] ) * + [ @ <integer> ] [ NONAME ] [CONSTANT] [DATA] [PRIVATE] ) * Declares name1 as an exported symbol from the DLL, with optional ordinal number <integer>. Or declares name1 as an alias (forward) of the function <external-name> @@ -643,7 +643,8 @@ typedef struct export const char *internal_name; int ordinal; int constant; - int noname; + int noname; /* Don't put name in image file. */ + int private; /* Don't put reference in import lib. */ int data; int hint; int forward; /* Number of forward label, 0 means no forward. */ @@ -889,7 +890,7 @@ yyerror (const char * err ATTRIBUTE_UNUSED) void def_exports (const char *name, const char *internal_name, int ordinal, - int noname, int constant, int data) + int noname, int constant, int data, int private) { struct export *p = (struct export *) xmalloc (sizeof (*p)); @@ -898,6 +899,7 @@ def_exports (const char *name, const char *internal_name, int ordinal, p->ordinal = ordinal; p->constant = constant; p->noname = noname; + p->private = private; p->data = data; p->next = d_exports; d_exports = p; @@ -1246,7 +1248,7 @@ scan_drectve_symbols (bfd *abfd) /* FIXME: The 5th arg is for the `constant' field. What should it be? Not that it matters since it's not currently useful. */ - def_exports (c, 0, -1, 0, 0, ! (flags & BSF_FUNCTION)); + def_exports (c, 0, -1, 0, 0, ! (flags & BSF_FUNCTION), 0); if (add_stdcall_alias && strchr (c, '@')) { @@ -1255,7 +1257,7 @@ scan_drectve_symbols (bfd *abfd) char *atsym = strchr (exported_name, '@'); *atsym = '\0'; /* Note: stdcall alias symbols can never be data. */ - def_exports (exported_name, xstrdup (c), -1, 0, 0, 0); + def_exports (exported_name, xstrdup (c), -1, 0, 0, 0, 0); } } else @@ -1294,7 +1296,7 @@ scan_filtered_symbols (bfd *abfd, void *minisyms, long symcount, ++symbol_name; def_exports (xstrdup (symbol_name) , 0, -1, 0, 0, - ! (sym->flags & BSF_FUNCTION)); + ! (sym->flags & BSF_FUNCTION), 0); if (add_stdcall_alias && strchr (symbol_name, '@')) { @@ -1303,7 +1305,7 @@ scan_filtered_symbols (bfd *abfd, void *minisyms, long symcount, char *atsym = strchr (exported_name, '@'); *atsym = '\0'; /* Note: stdcall alias symbols can never be data. */ - def_exports (exported_name, xstrdup (symbol_name), -1, 0, 0, 0); + def_exports (exported_name, xstrdup (symbol_name), -1, 0, 0, 0, 0); } } } @@ -1518,13 +1520,14 @@ dump_def_info (FILE *f) fprintf (f, "\n"); for (i = 0, exp = d_exports; exp; i++, exp = exp->next) { - fprintf (f, "%s %d = %s %s @ %d %s%s%s\n", + fprintf (f, "%s %d = %s %s @ %d %s%s%s%s\n", ASM_C, i, exp->name, exp->internal_name, exp->ordinal, exp->noname ? "NONAME " : "", + exp->private ? "PRIVATE " : "", exp->constant ? "CONSTANT" : "", exp->data ? "DATA" : ""); } @@ -1595,20 +1598,20 @@ gen_def_file (void) if (strcmp (exp->name, exp->internal_name) == 0) { - - fprintf (output_def, "\t%s%s%s @ %d%s%s\n", + fprintf (output_def, "\t%s%s%s @ %d%s%s%s\n", quote, exp->name, quote, exp->ordinal, exp->noname ? " NONAME" : "", + exp->private ? "PRIVATE " : "", exp->data ? " DATA" : ""); } else { - char *quote1 = strchr (exp->internal_name, '.') ? "\"" : ""; + char * quote1 = strchr (exp->internal_name, '.') ? "\"" : ""; /* char *alias = */ - fprintf (output_def, "\t%s%s%s = %s%s%s @ %d%s%s\n", + fprintf (output_def, "\t%s%s%s = %s%s%s @ %d%s%s%s\n", quote, exp->name, quote, @@ -1617,6 +1620,7 @@ gen_def_file (void) quote1, exp->ordinal, exp->noname ? " NONAME" : "", + exp->private ? "PRIVATE " : "", exp->data ? " DATA" : ""); } } @@ -1841,14 +1845,14 @@ gen_exp_file (void) fprintf(f,"%s Export Name Table\n", ASM_C); for (i = 0; (exp = d_exports_lexically[i]); i++) - if (!exp->noname || show_allnames) - { + { + if (!exp->noname || show_allnames) fprintf (f, "n%d: %s \"%s\"\n", exp->ordinal, ASM_TEXT, xlate (exp->name)); - if (exp->forward != 0) - fprintf (f, "f%d: %s \"%s\"\n", - exp->forward, ASM_TEXT, exp->internal_name); - } + if (exp->forward != 0) + fprintf (f, "f%d: %s \"%s\"\n", + exp->forward, ASM_TEXT, exp->internal_name); + } if (a_list) { @@ -2794,7 +2798,11 @@ gen_lib_file (void) for (i = 0; (exp = d_exports_lexically[i]); i++) { - bfd *n = make_one_lib_file (exp, i); + bfd *n; + /* Don't add PRIVATE entries to import lib. */ + if (exp->private) + continue; + n = make_one_lib_file (exp, i); n->next = head; head = n; } @@ -2831,8 +2839,11 @@ gen_lib_file (void) char *name; name = (char *) alloca (strlen (TMP_STUB) + 10); - for (i = 0, exp = d_exports; exp; i++, exp = exp->next) + for (i = 0; (exp = d_exports_lexically[i]); i++) { + /* Don't delete non-existent stubs for PRIVATE entries. */ + if (exp->private) + continue; sprintf (name, "%s%05d.o", TMP_STUB, i); if (unlink (name) < 0) /* xgettext:c-format */ @@ -2843,10 +2854,9 @@ gen_lib_file (void) inform (_("Created lib file")); } -/**********************************************************************/ - /* Run through the information gathered from the .o files and the .def file and work out the best stuff. */ + static int pfunc (const void *a, const void *b) { @@ -2890,11 +2900,7 @@ remove_null_names (export_type **ptr) } static void -dtab (export_type **ptr -#ifndef SACDEBUG -ATTRIBUTE_UNUSED -#endif - ) +dtab (export_type **ptr ATTRIBUTE_UNUSED) { #ifdef SACDEBUG int i; @@ -2922,7 +2928,6 @@ process_duplicates (export_type **d_export_vec) while (more) { - more = 0; /* Remove duplicates. */ qsort (d_export_vec, d_nfuncs, sizeof (export_type *), nfunc); @@ -2933,7 +2938,6 @@ process_duplicates (export_type **d_export_vec) if (strcmp (d_export_vec[i]->name, d_export_vec[i + 1]->name) == 0) { - export_type *a = d_export_vec[i]; export_type *b = d_export_vec[i + 1]; @@ -2963,13 +2967,10 @@ process_duplicates (export_type **d_export_vec) } } - /* Count the names. */ for (i = 0; i < d_nfuncs; i++) - { - if (!d_export_vec[i]->noname) - d_named_nfuncs++; - } + if (!d_export_vec[i]->noname) + d_named_nfuncs++; } static void @@ -3008,7 +3009,7 @@ fill_ordinals (export_type **d_export_vec) { if (d_export_vec[i]->ordinal == -1) { - register int j; + int j; /* First try within or after any user supplied range. */ for (j = lowest; j < size; j++) @@ -3063,8 +3064,7 @@ mangle_defs (void) int i; int hint = 0; - export_type **d_export_vec - = (export_type **) xmalloc (sizeof (export_type *) * d_nfuncs); + export_type **d_export_vec = xmalloc (sizeof (export_type *) * d_nfuncs); inform (_("Processing definitions")); @@ -3101,8 +3101,6 @@ mangle_defs (void) inform (_("Processed definitions")); } -/**********************************************************************/ - static void usage (FILE *file, int status) { @@ -3239,7 +3237,7 @@ main (int ac, char **av) as_flags = optarg; break; - /* ignored for compatibility */ + /* Ignored for compatibility. */ case 'u': break; case 'a': diff --git a/binutils/dlltool.h b/binutils/dlltool.h index c2eaea6..f488d96 100644 --- a/binutils/dlltool.h +++ b/binutils/dlltool.h @@ -1,5 +1,5 @@ /* dlltool.h -- header file for dlltool - Copyright 1997, 1998, 2003 Free Software Foundation, Inc. + Copyright 1997, 1998, 2003, 2004 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -24,7 +24,7 @@ extern void def_code (int); extern void def_data (int); extern void def_description (const char *); -extern void def_exports (const char *, const char *, int, int, int, int); +extern void def_exports (const char *, const char *, int, int, int, int, int); extern void def_heapsize (int, int); extern void def_import (const char *, const char *, const char *, const char *, int); @@ -33,9 +33,10 @@ extern void def_name (const char *, int); extern void def_section (const char *, int); extern void def_stacksize (int, int); extern void def_version (int, int); -extern int yyparse (void); -extern int yyerror (const char *); +extern int yyparse (void); +extern int yyerror (const char *); +extern int yylex (void); + extern int yydebug; -extern int yylex (void); extern FILE *yyin; extern int linenumber; diff --git a/binutils/objcopy.c b/binutils/objcopy.c index d31eb8f..9623398 100644 --- a/binutils/objcopy.c +++ b/binutils/objcopy.c @@ -2055,9 +2055,9 @@ copy_section (bfd *ibfd, sec_ptr isection, void *obfdarg) if (copy_byte >= 0) { /* Keep only every `copy_byte'th byte in MEMHUNK. */ - char *from = memhunk + copy_byte; + char *from = (char *) memhunk + copy_byte; char *to = memhunk; - char *end = memhunk + size; + char *end = (char *) memhunk + size; for (; from < end; from += interleave) *to++ = *from; diff --git a/binutils/readelf.c b/binutils/readelf.c index 258c746..e95a501 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -6767,7 +6767,7 @@ display_debug_pubnames (Elf_Internal_Shdr *section, if (offset != 0) { data += offset_size; - printf (" %ld\t\t%s\n", offset, data); + printf (" %-6ld\t\t%s\n", offset, data); data += strlen ((char *) data) + 1; } } @@ -7941,6 +7941,7 @@ read_and_display_attr_value (unsigned long attribute, case DW_FORM_addr: printf (" %#lx", uvalue); + break; case DW_FORM_flag: case DW_FORM_data1: @@ -9150,13 +9151,19 @@ display_debug_frames (Elf_Internal_Shdr *section, if (! do_debug_frames_interp) printf (" DW_CFA_restore_state\n"); rs = remembered_state; - remembered_state = rs->next; - frame_need_space (fc, rs->ncols-1); - memcpy (fc->col_type, rs->col_type, rs->ncols); - memcpy (fc->col_offset, rs->col_offset, rs->ncols * sizeof (int)); - free (rs->col_type); - free (rs->col_offset); - free (rs); + if (rs) + { + remembered_state = rs->next; + frame_need_space (fc, rs->ncols-1); + memcpy (fc->col_type, rs->col_type, rs->ncols); + memcpy (fc->col_offset, rs->col_offset, + rs->ncols * sizeof (int)); + free (rs->col_type); + free (rs->col_offset); + free (rs); + } + else if (do_debug_frames_interp) + printf ("Mismatched DW_CFA_restore_state\n"); break; case DW_CFA_def_cfa: @@ -9321,7 +9328,7 @@ debug_displays[] = { ".debug_macinfo", display_debug_macinfo }, { ".debug_str", display_debug_str }, { ".debug_loc", display_debug_loc }, - { ".debug_pubtypes", display_debug_not_supported }, + { ".debug_pubtypes", display_debug_pubnames }, { ".debug_ranges", display_debug_not_supported }, { ".debug_static_func", display_debug_not_supported }, { ".debug_static_vars", display_debug_not_supported }, @@ -9787,8 +9794,8 @@ process_mips_specific (FILE *file) free (econf64); } - printf (_("\nSection '.conflict' contains %ld entries:\n"), - (long) conflictsno); + printf (_("\nSection '.conflict' contains %lu entries:\n"), + (unsigned long) conflictsno); puts (_(" Num: Index Value Name")); for (cnt = 0; cnt < conflictsno; ++cnt) diff --git a/binutils/testsuite/ChangeLog b/binutils/testsuite/ChangeLog index 29cb53c..5e6e7a5 100644 --- a/binutils/testsuite/ChangeLog +++ b/binutils/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2004-04-09 Daniel Jacobowitz <drow@mvista.com> + + Merge from mainline: + 2004-02-27 Andreas Schwab <schwab@suse.de> + * binutils-all/ar.exp (argument_parsing): New test. + 2004-04-08 Alan Modra <amodra@bigpond.net.au> Apply from mainline. diff --git a/binutils/testsuite/binutils-all/ar.exp b/binutils/testsuite/binutils-all/ar.exp index f418e94..7f01c76 100644 --- a/binutils/testsuite/binutils-all/ar.exp +++ b/binutils/testsuite/binutils-all/ar.exp @@ -1,4 +1,4 @@ -# Copyright 1995, 1997 Free Software Foundation, Inc. +# Copyright 1995, 1997, 2004 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -214,7 +214,43 @@ proc symbol_table { } { pass $testname } +# Test POSIX-compatible argument parsing. + +proc argument_parsing { } { + global AR + global AS + global srcdir + global subdir + + set testname "ar argument parsing" + + if ![binutils_assemble $srcdir/$subdir/bintest.s tmpdir/bintest.o] { + unresolved $testname + return + } + + if [is_remote host] { + set archive artest.a + set objfile [remote_download host tmpdir/bintest.o] + remote_file host delete $archive + } else { + set archive tmpdir/artest.a + set objfile tmpdir/bintest.o + } + + remote_file build delete tmpdir/artest.a + + set got [binutils_run $AR "-r -c $archive ${objfile}"] + if ![string match "" $got] { + fail $testname + return + } + + pass $testname +} + # Run the tests. long_filenames symbol_table +argument_parsing |