X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=ld%2Fldmisc.c;h=42adceeac3eecfa5eafae5f3ddaf18e90a7a4507;hb=3b16e843f2a75ccf8e7ecc5102e1217a122a05ad;hp=e07ce1ba2cae4e50df6cbed0db86eced028cf395;hpb=a2b64bede395d988a7ae6676e2411b7ec5da8248;p=deliverable%2Fbinutils-gdb.git diff --git a/ld/ldmisc.c b/ld/ldmisc.c index e07ce1ba2c..42adceeac3 100644 --- a/ld/ldmisc.c +++ b/ld/ldmisc.c @@ -1,5 +1,6 @@ /* ldmisc.c - Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 + Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, + 2000, 2002 Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support. @@ -27,10 +28,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #ifdef ANSI_PROTOTYPES #include -#define USE_STDARG 1 #else #include -#define USE_STDARG 0 #endif #include "ld.h" @@ -71,18 +70,20 @@ demangle (string) const char *string; { char *res; + const char *p; if (output_bfd != NULL && bfd_get_symbol_leading_char (output_bfd) == string[0]) ++string; - /* This is a hack for better error reporting on XCOFF, or the MS PE - format. Xcoff has a single '.', while the NT PE for PPC has - '..'. So we remove all of them. */ - while (string[0] == '.') - ++string; + /* This is a hack for better error reporting on XCOFF, PowerPC64-ELF + or the MS PE format. These formats have a number of leading '.'s + on at least some symbols, so we remove all dots. */ + p = string; + while (*p == '.') + ++p; - res = cplus_demangle (string, DMGL_ANSI | DMGL_PARAMS); + res = cplus_demangle (p, DMGL_ANSI | DMGL_PARAMS); return res ? res : xstrdup (string); } @@ -335,10 +336,10 @@ vfinfo (fp, fmt, arg) last_bfd = abfd; if (last_file != NULL) free (last_file); - last_file = buystring (filename); + last_file = xstrdup (filename); if (last_function != NULL) free (last_function); - last_function = buystring (functionname); + last_function = xstrdup (functionname); } discard_last = false; if (linenumber != 0) @@ -399,6 +400,9 @@ vfinfo (fp, fmt, arg) } } + if (config.fatal_warnings) + config.make_executable = false; + if (fatal == true) xexit (1); } @@ -409,51 +413,25 @@ vfinfo (fp, fmt, arg) would hosed by LynxOS, which defines that name in its libc.) */ void -#if USE_STDARG -info_msg (const char *fmt, ...) -#else -info_msg (va_alist) - va_dcl -#endif +info_msg VPARAMS ((const char *fmt, ...)) { - va_list arg; - -#if ! USE_STDARG - const char *fmt; - - va_start (arg); - fmt = va_arg (arg, const char *); -#else - va_start (arg, fmt); -#endif + VA_OPEN (arg, fmt); + VA_FIXEDARG (arg, const char *, fmt); vfinfo (stdout, fmt, arg); - va_end (arg); + VA_CLOSE (arg); } /* ('e' for error.) Format info message and print on stderr. */ void -#if USE_STDARG -einfo (const char *fmt, ...) -#else -einfo (va_alist) - va_dcl -#endif +einfo VPARAMS ((const char *fmt, ...)) { - va_list arg; - -#if ! USE_STDARG - const char *fmt; - - va_start (arg); - fmt = va_arg (arg, const char *); -#else - va_start (arg, fmt); -#endif + VA_OPEN (arg, fmt); + VA_FIXEDARG (arg, const char *, fmt); vfinfo (stderr, fmt, arg); - va_end (arg); + VA_CLOSE (arg); } void @@ -464,63 +442,27 @@ info_assert (file, line) einfo (_("%F%P: internal error %s %d\n"), file, line); } -char * -buystring (x) - CONST char *CONST x; -{ - size_t l = strlen (x) + 1; - char *r = xmalloc (l); - memcpy (r, x, l); - return r; -} - /* ('m' for map) Format info message and print on map. */ void -#if USE_STDARG -minfo (const char *fmt, ...) -#else -minfo (va_alist) - va_dcl -#endif +minfo VPARAMS ((const char *fmt, ...)) { - va_list arg; - -#if ! USE_STDARG - const char *fmt; - va_start (arg); - fmt = va_arg (arg, const char *); -#else - va_start (arg, fmt); -#endif + VA_OPEN (arg, fmt); + VA_FIXEDARG (arg, const char *, fmt); vfinfo (config.map_file, fmt, arg); - va_end (arg); + VA_CLOSE (arg); } void -#if USE_STDARG -lfinfo (FILE *file, const char *fmt, ...) -#else -lfinfo (va_alist) - va_dcl -#endif +lfinfo VPARAMS ((FILE *file, const char *fmt, ...)) { - va_list arg; - -#if ! USE_STDARG - FILE *file; - const char *fmt; - - va_start (arg); - file = va_arg (arg, FILE *); - fmt = va_arg (arg, const char *); -#else - va_start (arg, fmt); -#endif + VA_OPEN (arg, fmt); + VA_FIXEDARG (arg, FILE *, file); + VA_FIXEDARG (arg, const char *, fmt); vfinfo (file, fmt, arg); - va_end (arg); + VA_CLOSE (arg); } /* Functions to print the link map. */