X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=binutils%2Fnlmconv.c;h=2fb74bfe0e85057b09c8e055cb9b87646a8f2333;hb=a8da6403829d6f87867da6a737dfdaa736a37dfa;hp=46b439751d1df9aa875309b9e4d94b5cc04504b9;hpb=b5e6aa6331a60ca1f9fdcc68bc3d163fbd1751f1;p=deliverable%2Fbinutils-gdb.git diff --git a/binutils/nlmconv.c b/binutils/nlmconv.c index 46b439751d..2fb74bfe0e 100644 --- a/binutils/nlmconv.c +++ b/binutils/nlmconv.c @@ -1,12 +1,12 @@ /* nlmconv.c -- NLM conversion program Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003, 2004, 2005 Free Software Foundation, Inc. + 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. 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 + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -16,7 +16,9 @@ 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. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, + MA 02110-1301, USA. */ + /* Written by Ian Lance Taylor . @@ -32,9 +34,9 @@ #endif #endif +#include "sysdep.h" #include "bfd.h" #include "libiberty.h" -#include "bucomm.h" #include "safe-ctype.h" #include "ansidecl.h" @@ -53,15 +55,13 @@ #include "coff/ecoff.h" #endif +#include "bucomm.h" + /* If strerror is just a macro, we want to use the one from libiberty since it will handle undefined values. */ #undef strerror extern char *strerror (int); -#ifndef localtime -extern struct tm *localtime (const time_t *); -#endif - #ifndef SEEK_SET #define SEEK_SET 0 #endif @@ -197,7 +197,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; @@ -214,6 +214,8 @@ main (int argc, char **argv) program_name = argv[0]; xmalloc_set_program_name (program_name); + expandargv (&argc, &argv); + bfd_init (); set_default_bfd_target (); @@ -739,7 +741,7 @@ main (int argc, char **argv) || ! bfd_set_section_flags (outbfd, help_section, SEC_HAS_CONTENTS)) bfd_fatal (_("help section")); - strncpy (nlm_extended_header (outbfd)->stamp, "MeSsAgEs", 8); + LITMEMCPY (nlm_extended_header (outbfd)->stamp, "MeSsAgEs"); } } if (message_file != NULL) @@ -761,7 +763,7 @@ main (int argc, char **argv) || ! bfd_set_section_flags (outbfd, message_section, SEC_HAS_CONTENTS)) bfd_fatal (_("message section")); - strncpy (nlm_extended_header (outbfd)->stamp, "MeSsAgEs", 8); + LITMEMCPY (nlm_extended_header (outbfd)->stamp, "MeSsAgEs"); } } if (modules != NULL) @@ -797,7 +799,7 @@ main (int argc, char **argv) || ! bfd_set_section_flags (outbfd, rpc_section, SEC_HAS_CONTENTS)) bfd_fatal (_("rpc section")); - strncpy (nlm_extended_header (outbfd)->stamp, "MeSsAgEs", 8); + LITMEMCPY (nlm_extended_header (outbfd)->stamp, "MeSsAgEs"); } } if (sharelib_file != NULL) @@ -854,20 +856,20 @@ main (int argc, char **argv) || ! bfd_set_section_flags (outbfd, shared_section, SEC_HAS_CONTENTS)) bfd_fatal (_("shared section")); - strncpy (nlm_extended_header (outbfd)->stamp, "MeSsAgEs", 8); + LITMEMCPY (nlm_extended_header (outbfd)->stamp, "MeSsAgEs"); } } } /* Check whether a version was given. */ - if (strncmp (version_hdr->stamp, "VeRsIoN#", 8) != 0) + if (!CONST_STRNEQ (version_hdr->stamp, "VeRsIoN#")) non_fatal (_("warning: No version number given")); /* At least for now, always create an extended header, because that is what NLMLINK does. */ - strncpy (nlm_extended_header (outbfd)->stamp, "MeSsAgEs", 8); + LITMEMCPY (nlm_extended_header (outbfd)->stamp, "MeSsAgEs"); - strncpy (nlm_cygnus_ext_header (outbfd)->stamp, "CyGnUsEx", 8); + LITMEMCPY (nlm_cygnus_ext_header (outbfd)->stamp, "CyGnUsEx"); /* If the date was not given, force it in. */ if (nlm_version_header (outbfd)->month == 0 @@ -882,7 +884,7 @@ main (int argc, char **argv) nlm_version_header (outbfd)->month = ptm->tm_mon + 1; nlm_version_header (outbfd)->day = ptm->tm_mday; nlm_version_header (outbfd)->year = ptm->tm_year + 1900; - strncpy (version_hdr->stamp, "VeRsIoN#", 8); + LITMEMCPY (version_hdr->stamp, "VeRsIoN#"); } #ifdef NLMCONV_POWERPC @@ -980,7 +982,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; } @@ -1107,10 +1109,11 @@ show_usage (FILE *file, int status) -T --header-file= Read for NLM header information\n\ -l --linker= Use for any linking\n\ -d --debug Display on stderr the linker command line\n\ + @ Read options from .\n\ -h --help Display this information\n\ -v --version Display the program's version\n\ ")); - if (status == 0) + if (REPORT_BUGS_TO[0] && status == 0) fprintf (file, _("Report bugs to %s\n"), REPORT_BUGS_TO); exit (status); } @@ -1748,9 +1751,9 @@ powerpc_build_stubs (bfd *inbfd, bfd *outbfd ATTRIBUTE_UNUSED, /* Make a new undefined symbol with the same name but without the leading `.'. */ - newsym = (asymbol *) xmalloc (sizeof (asymbol)); + newsym = xmalloc (sizeof (asymbol)); *newsym = *sym; - newname = (char *) xmalloc (strlen (bfd_asymbol_name (sym))); + newname = xmalloc (strlen (bfd_asymbol_name (sym))); strcpy (newname, bfd_asymbol_name (sym) + 1); newsym->name = newname;