From c9bc005cab0b1c015e5d438d470aa17e2a5dd6f5 Mon Sep 17 00:00:00 2001 From: The GNU Toolchain Authors <> Date: Mon, 24 Jul 2023 23:42:38 +0200 Subject: [PATCH] Update imported files: GCC, 2014-05-01 [#1, #42] GCC commit a4ebe104540e7b6d3c637d793dbcd5171b4b8209 (Subversion r209988). Co-authored-by: Thomas Schwinge --- README-development | 7 +- include/ChangeLog | 65 +- include/ansidecl.h | 150 +-- include/demangle.h | 8 + include/dwarf2.def | 3 + include/floatformat.h | 3 +- include/gdb/gdb-index.h | 99 ++ include/libiberty.h | 40 +- include/longlong.h | 1740 +++++++++++++++++++++++++ include/vtv-change-permission.h | 55 + libiberty/ChangeLog | 201 ++- libiberty/Makefile.in | 384 +++++- libiberty/_doprnt.c | 6 +- libiberty/asprintf.c | 9 +- libiberty/concat.c | 61 +- libiberty/configure | 17 +- libiberty/configure.ac | 13 +- libiberty/cp-demangle.c | 487 ++++++- libiberty/cp-demangle.h | 5 + libiberty/floatformat.c | 13 +- libiberty/maint-tool | 5 +- libiberty/regex.c | 6 +- libiberty/simple-object.c | 50 +- libiberty/snprintf.c | 10 +- libiberty/testsuite/demangle-expected | 26 + libiberty/testsuite/test-demangle.c | 3 + libiberty/testsuite/test-expandargv.c | 3 + libiberty/vasprintf.c | 8 +- libiberty/vsnprintf.c | 10 +- 29 files changed, 3175 insertions(+), 312 deletions(-) create mode 100644 include/gdb/gdb-index.h create mode 100644 include/longlong.h create mode 100644 include/vtv-change-permission.h diff --git a/README-development b/README-development index a822b86..0b3a2ca 100644 --- a/README-development +++ b/README-development @@ -40,11 +40,8 @@ A number of files are imported from GCC: - 'mkinstalldirs' - 'move-if-change' -These correspond to GCC commit 9ffaa03201577636e08e596570e95b572674681f -(Subversion r201139). - -Exception for 'config.guess', 'config.sub': these correspond to -GCC commit a4ebe104540e7b6d3c637d793dbcd5171b4b8209 (Subversion r209988). +These correspond to GCC commit a4ebe104540e7b6d3c637d793dbcd5171b4b8209 +(Subversion r209988). Exception for 'include/libiberty.h': the 'MAX_ALLOCA_SIZE' definition introduced in #18 commit 39511bae362d5746c0bf0a1dcbc76297b4a0155c diff --git a/include/ChangeLog b/include/ChangeLog index 7fe2842..1655306 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,62 @@ +2014-05-01 Steve Ellcey + + * include/longlong.h: Use 'defined()' to check __mips16. + +2014-04-30 Richard Sandiford + + * longlong.h (__i386__): Remove W_TYPE_SIZE==64 handling. + +2014-04-22 Yufeng Zhang + + * longlong.h: Merge from glibc. + +2014-01-21 Tom Tromey + + * ansidecl.h (ANSI_PROTOTYPES, PTRCONST, LONG_DOUBLE, PARAMS) + (VPARAMS, VA_START, VA_OPEN, VA_CLOSE, VA_FIXEDARG, CONST) + (VOLATILE, SIGNED, PROTO, EXFUN, DEFUN, DEFUN_VOID, AND, DOTS) + (NOARGS): Don't define. + * libiberty.h (expandargv, writeargv): Don't use PARAMS. + +2013-12-23 Bill Maddox + + * demangle.h (enum gnu_v3_ctor_kinds): + Added literal gnu_v3_unified_ctor. + (enum gnu_v3_ctor_kinds): + Added literal gnu_v3_unified_dtor. + +2013-12-04 Richard Sandiford + + * longlong.h: New file. + +2013-10-29 Marc Glisse + + PR tree-optimization/58689 + * ansidecl.h (ATTRIBUTE_RETURNS_NONNULL): New macro. + * libiberty.h (basename, lbasename, dos_lbasename, unix_lbasename, + concat_copy): Mark with attributes nonnull(1) and returns_nonnull. + (concat, reconcat, concat_copy2, choose_temp_base, xstrerror, + xmalloc, xrealloc, xcalloc, xstrdup, xstrndup, xmemdup, pex_init): + Mark with attribute returns_nonnull. + +2013-10-22 Sterling Augustine + + * gdb/gdb-index.h: Merge from gdb tree. + +2013-08-20 Alan Modra + + * floatformat.h (floatformat_ibm_long_double): Delete. + (floatformat_ibm_long_double_big): Declare. + (floatformat_ibm_long_double_little): Declare. + +2013-08-19 Dehao Chen + + * dwarf2.def (DW_AT_GNU_discriminator): New attribute. + +2013-08-02 Caroline Tice + + * vtv-change-permission.h: New file. + 2013-04-03 Jason Merrill Demangle C++11 ref-qualifier. @@ -33,8 +92,8 @@ * demangle.h (enum demangle_component_type): Add DEMANGLE_COMPONENT_TAGGED_NAME. -2012-10-29 Sterling Augustine - Cary Coutant +2012-10-29 Sterling Augustine + Cary Coutant * dwarf2.h (dwarf_location_list_entry_type): New enum with fields DW_LLE_GNU_end_of_list_entry, DW_LLE_GNU_base_address_selection_entry, @@ -301,7 +360,7 @@ Sync LD plugin patch series (part 1/6) with src/include/. * plugin-api.h (LDPT_GNU_LD_VERSION): New ld_plugin_tag enum member. -2010-10-06 Andi Kleen +2010-10-06 Andi Kleen * libiberty.h (setproctitle): Add prototype. diff --git a/include/ansidecl.h b/include/ansidecl.h index 40f4a5f..0fb23bb 100644 --- a/include/ansidecl.h +++ b/include/ansidecl.h @@ -1,6 +1,6 @@ /* ANSI and traditional C compatability macros Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, - 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010 + 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2013 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -24,93 +24,16 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. Macro ANSI C definition Traditional C definition ----- ---- - ---------- ----------- - ---------- - ANSI_PROTOTYPES 1 not defined PTR `void *' `char *' - PTRCONST `void *const' `char *' - LONG_DOUBLE `long double' `double' const not defined `' volatile not defined `' signed not defined `' - VA_START(ap, var) va_start(ap, var) va_start(ap) - - Note that it is safe to write "void foo();" indicating a function - with no return value, in all K+R compilers we have been able to test. - - For declaring functions with prototypes, we also provide these: - - PARAMS ((prototype)) - -- for functions which take a fixed number of arguments. Use this - when declaring the function. When defining the function, write a - K+R style argument list. For example: - - char *strcpy PARAMS ((char *dest, char *source)); - ... - char * - strcpy (dest, source) - char *dest; - char *source; - { ... } - - - VPARAMS ((prototype, ...)) - -- for functions which take a variable number of arguments. Use - PARAMS to declare the function, VPARAMS to define it. For example: - - int printf PARAMS ((const char *format, ...)); - ... - int - printf VPARAMS ((const char *format, ...)) - { - ... - } - - For writing functions which take variable numbers of arguments, we - also provide the VA_OPEN, VA_CLOSE, and VA_FIXEDARG macros. These - hide the differences between K+R and C89 more - thoroughly than the simple VA_START() macro mentioned above. - - VA_OPEN and VA_CLOSE are used *instead of* va_start and va_end. - Immediately after VA_OPEN, put a sequence of VA_FIXEDARG calls - corresponding to the list of fixed arguments. Then use va_arg - normally to get the variable arguments, or pass your va_list object - around. You do not declare the va_list yourself; VA_OPEN does it - for you. - - Here is a complete example: - - int - printf VPARAMS ((const char *format, ...)) - { - int result; - - VA_OPEN (ap, format); - VA_FIXEDARG (ap, const char *, format); - - result = vfprintf (stdout, format, ap); - VA_CLOSE (ap); - - return result; - } - - - You can declare variables either before or after the VA_OPEN, - VA_FIXEDARG sequence. Also, VA_OPEN and VA_CLOSE are the beginning - and end of a block. They must appear at the same nesting level, - and any variables declared after VA_OPEN go out of scope at - VA_CLOSE. Unfortunately, with a K+R compiler, that includes the - argument list. You can have multiple instances of VA_OPEN/VA_CLOSE - pairs in a single function in case you need to traverse the - argument list more than once. For ease of writing code which uses GCC extensions but needs to be portable to other compilers, we provide the GCC_VERSION macro that simplifies testing __GNUC__ and __GNUC_MINOR__ together, and various wrappers around __attribute__. Also, __extension__ will be #defined - to nothing if it doesn't work. See below. - - This header also defines a lot of obsolete macros: - CONST, VOLATILE, SIGNED, PROTO, EXFUN, DEFUN, DEFUN_VOID, - AND, DOTS, NOARGS. Don't use them. */ + to nothing if it doesn't work. See below. */ #ifndef _ANSIDECL_H #define _ANSIDECL_H 1 @@ -149,28 +72,8 @@ So instead we use the macro below and test it against specific values. */ C++ compilers, does not define __STDC__, though it acts as if this was so. (Verified versions: 5.7, 6.2, 6.3, 6.5) */ -#define ANSI_PROTOTYPES 1 #define PTR void * -#define PTRCONST void *const -#define LONG_DOUBLE long double -/* PARAMS is often defined elsewhere (e.g. by libintl.h), so wrap it in - a #ifndef. */ -#ifndef PARAMS -#define PARAMS(ARGS) ARGS -#endif - -#define VPARAMS(ARGS) ARGS -#define VA_START(VA_LIST, VAR) va_start(VA_LIST, VAR) - -/* variadic function helper macros */ -/* "struct Qdmy" swallows the semicolon after VA_OPEN/VA_FIXEDARG's - use without inhibiting further decls and without declaring an - actual variable. */ -#define VA_OPEN(AP, VAR) { va_list AP; va_start(AP, VAR); { struct Qdmy -#define VA_CLOSE(AP) } va_end(AP); } -#define VA_FIXEDARG(AP, T, N) struct Qdmy - #undef const #undef volatile #undef signed @@ -188,35 +91,9 @@ So instead we use the macro below and test it against specific values. */ # endif #endif -/* These are obsolete. Do not use. */ -#ifndef IN_GCC -#define CONST const -#define VOLATILE volatile -#define SIGNED signed - -#define PROTO(type, name, arglist) type name arglist -#define EXFUN(name, proto) name proto -#define DEFUN(name, arglist, args) name(args) -#define DEFUN_VOID(name) name(void) -#define AND , -#define DOTS , ... -#define NOARGS void -#endif /* ! IN_GCC */ - #else /* Not ANSI C. */ -#undef ANSI_PROTOTYPES #define PTR char * -#define PTRCONST PTR -#define LONG_DOUBLE double - -#define PARAMS(args) () -#define VPARAMS(args) (va_alist) va_dcl -#define VA_START(va_list, var) va_start(va_list) - -#define VA_OPEN(AP, VAR) { va_list AP; va_start(AP); { struct Qdmy -#define VA_CLOSE(AP) } va_end(AP); } -#define VA_FIXEDARG(AP, TYPE, NAME) TYPE NAME = va_arg(AP, TYPE) /* some systems define these in header files for non-ansi mode */ #undef const @@ -228,20 +105,6 @@ So instead we use the macro below and test it against specific values. */ #define signed #define inline -#ifndef IN_GCC -#define CONST -#define VOLATILE -#define SIGNED - -#define PROTO(type, name, arglist) type name () -#define EXFUN(name, proto) name() -#define DEFUN(name, arglist, args) name arglist args; -#define DEFUN_VOID(name) name() -#define AND ; -#define DOTS -#define NOARGS -#endif /* ! IN_GCC */ - #endif /* ANSI C. */ /* Define macros for some gcc attributes. This permits us to use the @@ -311,6 +174,15 @@ So instead we use the macro below and test it against specific values. */ # endif /* GNUC >= 3.3 */ #endif /* ATTRIBUTE_NONNULL */ +/* Attribute `returns_nonnull' was valid as of gcc 4.9. */ +#ifndef ATTRIBUTE_RETURNS_NONNULL +# if (GCC_VERSION >= 4009) +# define ATTRIBUTE_RETURNS_NONNULL __attribute__ ((__returns_nonnull__)) +# else +# define ATTRIBUTE_RETURNS_NONNULL +# endif /* GNUC >= 4.9 */ +#endif /* ATTRIBUTE_RETURNS_NONNULL */ + /* Attribute `pure' was valid as of gcc 3.0. */ #ifndef ATTRIBUTE_PURE # if (GCC_VERSION >= 3000) diff --git a/include/demangle.h b/include/demangle.h index 58bf547..bbad71b 100644 --- a/include/demangle.h +++ b/include/demangle.h @@ -173,6 +173,10 @@ enum gnu_v3_ctor_kinds { gnu_v3_complete_object_ctor = 1, gnu_v3_base_object_ctor, gnu_v3_complete_object_allocating_ctor, + /* These are not part of the V3 ABI. Unified constructors are generated + as a speed-for-space optimization when the -fdeclone-ctor-dtor option + is used, and are always internal symbols. */ + gnu_v3_unified_ctor, gnu_v3_object_ctor_group }; @@ -188,6 +192,10 @@ enum gnu_v3_dtor_kinds { gnu_v3_deleting_dtor = 1, gnu_v3_complete_object_dtor, gnu_v3_base_object_dtor, + /* These are not part of the V3 ABI. Unified destructors are generated + as a speed-for-space optimization when the -fdeclone-ctor-dtor option + is used, and are always internal symbols. */ + gnu_v3_unified_dtor, gnu_v3_object_dtor_group }; diff --git a/include/dwarf2.def b/include/dwarf2.def index 7fe2df1..71a37b3 100644 --- a/include/dwarf2.def +++ b/include/dwarf2.def @@ -390,6 +390,9 @@ DW_AT (DW_AT_GNU_ranges_base, 0x2132) DW_AT (DW_AT_GNU_addr_base, 0x2133) DW_AT (DW_AT_GNU_pubnames, 0x2134) DW_AT (DW_AT_GNU_pubtypes, 0x2135) +/* Attribute for discriminator. + See http://gcc.gnu.org/wiki/Discriminator */ +DW_AT (DW_AT_GNU_discriminator, 0x2136) /* VMS extensions. */ DW_AT (DW_AT_VMS_rtnbeg_pd_address, 0x2201) /* GNAT extensions. */ diff --git a/include/floatformat.h b/include/floatformat.h index b595164..04db61a 100644 --- a/include/floatformat.h +++ b/include/floatformat.h @@ -128,7 +128,8 @@ extern const struct floatformat floatformat_ia64_spill_little; extern const struct floatformat floatformat_ia64_quad_big; extern const struct floatformat floatformat_ia64_quad_little; /* IBM long double (double+double). */ -extern const struct floatformat floatformat_ibm_long_double; +extern const struct floatformat floatformat_ibm_long_double_big; +extern const struct floatformat floatformat_ibm_long_double_little; /* Convert from FMT to a double. FROM is the address of the extended float. diff --git a/include/gdb/gdb-index.h b/include/gdb/gdb-index.h new file mode 100644 index 0000000..b43c68f --- /dev/null +++ b/include/gdb/gdb-index.h @@ -0,0 +1,99 @@ +/* Public attributes of the .gdb_index section. + Copyright 2012 Free Software Foundation, Inc. + + This file is part of GDB. + + 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 3 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. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* This file contains values for understanding the .gdb_index section + needed by more than just GDB, e.g. readelf. */ + +#ifndef GDB_INDEX_H +#define GDB_INDEX_H + +/* Each symbol in .gdb_index refers to a set of CUs that defines the symbol. + Each CU is represented by a 32 bit number that is the index of the CU in + the CU table, plus some attributes of the use of the symbol in that CU. + + The values are defined such that if all the bits are zero, then no + special meaning is assigned to any of them. This is done to preserve + compatibility with older indices. The way this is done is to specify + that if the GDB_INDEX_SYMBOL_KIND value is zero then all other attribute + bits must be zero. + + 0-23 CU index + 24-27 reserved + 28-30 symbol kind + 31 0 == global, 1 == static + + Bits 24-27 are reserved because it's easier to relax restrictions than + it is to impose them after the fact. At present 24 bits to represent + the CU index is plenty. If we need more bits for the CU index or for + attributes then we have them. */ + +/* Whether the symbol is in GLOBAL_BLOCK (== 0) or STATIC_BLOCK (== 1). */ +#define GDB_INDEX_SYMBOL_STATIC_SHIFT 31 +#define GDB_INDEX_SYMBOL_STATIC_MASK 1 +#define GDB_INDEX_SYMBOL_STATIC_VALUE(cu_index) \ + (((cu_index) >> GDB_INDEX_SYMBOL_STATIC_SHIFT) & GDB_INDEX_SYMBOL_STATIC_MASK) +#define GDB_INDEX_SYMBOL_STATIC_SET_VALUE(cu_index, value) \ + do { \ + (cu_index) |= (((value) & GDB_INDEX_SYMBOL_STATIC_MASK) \ + << GDB_INDEX_SYMBOL_STATIC_SHIFT); \ + } while (0) + +/* The kind of the symbol. + We don't use GDB's internal values as these numbers are published + so that other tools can build and read .gdb_index. */ + +typedef enum { + /* Special value to indicate no attributes are present. */ + GDB_INDEX_SYMBOL_KIND_NONE = 0, + GDB_INDEX_SYMBOL_KIND_TYPE = 1, + GDB_INDEX_SYMBOL_KIND_VARIABLE = 2, + GDB_INDEX_SYMBOL_KIND_FUNCTION = 3, + GDB_INDEX_SYMBOL_KIND_OTHER = 4, + /* We currently allocate 3 bits to record the symbol kind. + Give the unused bits a value so gdb will print them sensibly. */ + GDB_INDEX_SYMBOL_KIND_UNUSED5 = 5, + GDB_INDEX_SYMBOL_KIND_UNUSED6 = 6, + GDB_INDEX_SYMBOL_KIND_UNUSED7 = 7 +} gdb_index_symbol_kind; + +#define GDB_INDEX_SYMBOL_KIND_SHIFT 28 +#define GDB_INDEX_SYMBOL_KIND_MASK 7 +#define GDB_INDEX_SYMBOL_KIND_VALUE(cu_index) \ + ((gdb_index_symbol_kind) (((cu_index) >> GDB_INDEX_SYMBOL_KIND_SHIFT) \ + & GDB_INDEX_SYMBOL_KIND_MASK)) +#define GDB_INDEX_SYMBOL_KIND_SET_VALUE(cu_index, value) \ + do { \ + (cu_index) |= (((value) & GDB_INDEX_SYMBOL_KIND_MASK) \ + << GDB_INDEX_SYMBOL_KIND_SHIFT); \ + } while (0) + +#define GDB_INDEX_RESERVED_SHIFT 24 +#define GDB_INDEX_RESERVED_MASK 15 +#define GDB_INDEX_RESERVED_VALUE(cu_index) \ + (((cu_index) >> GDB_INDEX_RESERVED_SHIFT) & GDB_INDEX_RESERVED_MASK) + +/* CU index. */ +#define GDB_INDEX_CU_BITSIZE 24 +#define GDB_INDEX_CU_MASK ((1 << GDB_INDEX_CU_BITSIZE) - 1) +#define GDB_INDEX_CU_VALUE(cu_index) ((cu_index) & GDB_INDEX_CU_MASK) +#define GDB_INDEX_CU_SET_VALUE(cu_index, value) \ + do { \ + (cu_index) |= (value) & GDB_INDEX_CU_MASK; \ + } while (0) + +#endif /* GDB_INDEX_H */ diff --git a/include/libiberty.h b/include/libiberty.h index 29ceafe..5819f28 100644 --- a/include/libiberty.h +++ b/include/libiberty.h @@ -1,7 +1,7 @@ /* Function declarations for libiberty. Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, - 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. + 2006, 2007, 2008, 2009, 2010, 2011, 2013 Free Software Foundation, Inc. Note - certain prototypes declared in this header file are for functions whoes implementation copyright does not belong to the @@ -85,11 +85,11 @@ extern char **dupargv (char **) ATTRIBUTE_MALLOC; /* Expand "@file" arguments in argv. */ -extern void expandargv PARAMS ((int *, char ***)); +extern void expandargv (int *, char ***); /* Write argv to an @-file, inserting necessary quoting. */ -extern int writeargv PARAMS ((char **, FILE *)); +extern int writeargv (char **, FILE *); /* Return the number of elements in argv. */ @@ -107,7 +107,7 @@ extern int countargv (char**); is 1, we found it so don't provide any declaration at all. */ #if !HAVE_DECL_BASENAME #if defined (__GNU_LIBRARY__ ) || defined (__linux__) || defined (__FreeBSD__) || defined (__OpenBSD__) || defined(__NetBSD__) || defined (__CYGWIN__) || defined (__CYGWIN32__) || defined (__MINGW32__) || defined (HAVE_DECL_BASENAME) -extern char *basename (const char *); +extern char *basename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1); #else /* Do not allow basename to be used if there is no prototype seen. We either need to use the above prototype or have one from @@ -118,18 +118,18 @@ extern char *basename (const char *); /* A well-defined basename () that is always compiled in. */ -extern const char *lbasename (const char *); +extern const char *lbasename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1); /* Same, but assumes DOS semantics (drive name, backslash is also a dir separator) regardless of host. */ -extern const char *dos_lbasename (const char *); +extern const char *dos_lbasename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1); /* Same, but assumes Unix semantics (absolute paths always start with a slash, only forward slash is accepted as dir separator) regardless of host. */ -extern const char *unix_lbasename (const char *); +extern const char *unix_lbasename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1); /* A well-defined realpath () that is always compiled in. */ @@ -139,7 +139,7 @@ extern char *lrealpath (const char *); the last argument of this function, to terminate the list of strings. Allocates memory using xmalloc. */ -extern char *concat (const char *, ...) ATTRIBUTE_MALLOC ATTRIBUTE_SENTINEL; +extern char *concat (const char *, ...) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_SENTINEL; /* Concatenate an arbitrary number of strings. You must pass NULL as the last argument of this function, to terminate the list of @@ -148,7 +148,7 @@ extern char *concat (const char *, ...) ATTRIBUTE_MALLOC ATTRIBUTE_SENTINEL; pointer to be freed after the new string is created, similar to the way xrealloc works. */ -extern char *reconcat (char *, const char *, ...) ATTRIBUTE_MALLOC ATTRIBUTE_SENTINEL; +extern char *reconcat (char *, const char *, ...) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_SENTINEL; /* Determine the length of concatenating an arbitrary number of strings. You must pass NULL as the last argument of this function, @@ -161,14 +161,14 @@ extern unsigned long concat_length (const char *, ...) ATTRIBUTE_SENTINEL; to terminate the list of strings. The supplied memory is assumed to be large enough. */ -extern char *concat_copy (char *, const char *, ...) ATTRIBUTE_SENTINEL; +extern char *concat_copy (char *, const char *, ...) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1) ATTRIBUTE_SENTINEL; /* Concatenate an arbitrary number of strings into a GLOBAL area of memory. You must pass NULL as the last argument of this function, to terminate the list of strings. The supplied memory is assumed to be large enough. */ -extern char *concat_copy2 (const char *, ...) ATTRIBUTE_SENTINEL; +extern char *concat_copy2 (const char *, ...) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_SENTINEL; /* This is the global area used by concat_copy2. */ @@ -226,7 +226,7 @@ extern char *make_relative_prefix_ignore_links (const char *, const char *, /* Choose a temporary directory to use for scratch files. */ -extern char *choose_temp_base (void) ATTRIBUTE_MALLOC; +extern char *choose_temp_base (void) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL; /* Return a temporary file name or NULL if unable to create one. */ @@ -256,7 +256,7 @@ extern int strtoerrno (const char *); /* ANSI's strerror(), but more robust. */ -extern char *xstrerror (int); +extern char *xstrerror (int) ATTRIBUTE_RETURNS_NONNULL; /* Return the maximum signal number for which strsignal will return a string. */ @@ -298,30 +298,30 @@ extern void xmalloc_failed (size_t) ATTRIBUTE_NORETURN; message to stderr (using the name set by xmalloc_set_program_name, if any) and then call xexit. */ -extern void *xmalloc (size_t) ATTRIBUTE_MALLOC; +extern void *xmalloc (size_t) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL; /* Reallocate memory without fail. This works like xmalloc. Note, realloc type functions are not suitable for attribute malloc since they may return the same address across multiple calls. */ -extern void *xrealloc (void *, size_t); +extern void *xrealloc (void *, size_t) ATTRIBUTE_RETURNS_NONNULL; /* Allocate memory without fail and set it to zero. This works like xmalloc. */ -extern void *xcalloc (size_t, size_t) ATTRIBUTE_MALLOC; +extern void *xcalloc (size_t, size_t) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL; /* Copy a string into a memory buffer without fail. */ -extern char *xstrdup (const char *) ATTRIBUTE_MALLOC; +extern char *xstrdup (const char *) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL; /* Copy at most N characters from string into a buffer without fail. */ -extern char *xstrndup (const char *, size_t) ATTRIBUTE_MALLOC; +extern char *xstrndup (const char *, size_t) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL; /* Copy an existing memory buffer to a new memory buffer without fail. */ -extern void *xmemdup (const void *, size_t, size_t) ATTRIBUTE_MALLOC; +extern void *xmemdup (const void *, size_t, size_t) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL; /* Physical memory routines. Return values are in BYTES. */ extern double physmem_total (void); @@ -410,7 +410,7 @@ extern void hex_init (void); Returns NULL on error. */ extern struct pex_obj *pex_init (int flags, const char *pname, - const char *tempbase); + const char *tempbase) ATTRIBUTE_RETURNS_NONNULL; /* Flags for pex_run. These are bits to be or'ed together. */ diff --git a/include/longlong.h b/include/longlong.h new file mode 100644 index 0000000..31f88cb --- /dev/null +++ b/include/longlong.h @@ -0,0 +1,1740 @@ +/* longlong.h -- definitions for mixed size 32/64 bit arithmetic. + Copyright (C) 1991-2014 Free Software Foundation, Inc. + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + In addition to the permissions in the GNU Lesser General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file into + combinations with other programs, and to distribute those + combinations without any restriction coming from the use of this + file. (The Lesser General Public License restrictions do apply in + other respects; for example, they cover modification of the file, + and distribution when not linked into a combine executable.) + + The GNU C Library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* You have to define the following before including this file: + + UWtype -- An unsigned type, default type for operations (typically a "word") + UHWtype -- An unsigned type, at least half the size of UWtype. + UDWtype -- An unsigned type, at least twice as large a UWtype + W_TYPE_SIZE -- size in bits of UWtype + + UQItype -- Unsigned 8 bit type. + SItype, USItype -- Signed and unsigned 32 bit types. + DItype, UDItype -- Signed and unsigned 64 bit types. + + On a 32 bit machine UWtype should typically be USItype; + on a 64 bit machine, UWtype should typically be UDItype. */ + +#define __BITS4 (W_TYPE_SIZE / 4) +#define __ll_B ((UWtype) 1 << (W_TYPE_SIZE / 2)) +#define __ll_lowpart(t) ((UWtype) (t) & (__ll_B - 1)) +#define __ll_highpart(t) ((UWtype) (t) >> (W_TYPE_SIZE / 2)) + +#ifndef W_TYPE_SIZE +#define W_TYPE_SIZE 32 +#define UWtype USItype +#define UHWtype USItype +#define UDWtype UDItype +#endif + +/* Used in glibc only. */ +#ifndef attribute_hidden +#define attribute_hidden +#endif + +extern const UQItype __clz_tab[256] attribute_hidden; + +/* Define auxiliary asm macros. + + 1) umul_ppmm(high_prod, low_prod, multiplier, multiplicand) multiplies two + UWtype integers MULTIPLIER and MULTIPLICAND, and generates a two UWtype + word product in HIGH_PROD and LOW_PROD. + + 2) __umulsidi3(a,b) multiplies two UWtype integers A and B, and returns a + UDWtype product. This is just a variant of umul_ppmm. + + 3) udiv_qrnnd(quotient, remainder, high_numerator, low_numerator, + denominator) divides a UDWtype, composed by the UWtype integers + HIGH_NUMERATOR and LOW_NUMERATOR, by DENOMINATOR and places the quotient + in QUOTIENT and the remainder in REMAINDER. HIGH_NUMERATOR must be less + than DENOMINATOR for correct operation. If, in addition, the most + significant bit of DENOMINATOR must be 1, then the pre-processor symbol + UDIV_NEEDS_NORMALIZATION is defined to 1. + + 4) sdiv_qrnnd(quotient, remainder, high_numerator, low_numerator, + denominator). Like udiv_qrnnd but the numbers are signed. The quotient + is rounded towards 0. + + 5) count_leading_zeros(count, x) counts the number of zero-bits from the + msb to the first nonzero bit in the UWtype X. This is the number of + steps X needs to be shifted left to set the msb. Undefined for X == 0, + unless the symbol COUNT_LEADING_ZEROS_0 is defined to some value. + + 6) count_trailing_zeros(count, x) like count_leading_zeros, but counts + from the least significant end. + + 7) add_ssaaaa(high_sum, low_sum, high_addend_1, low_addend_1, + high_addend_2, low_addend_2) adds two UWtype integers, composed by + HIGH_ADDEND_1 and LOW_ADDEND_1, and HIGH_ADDEND_2 and LOW_ADDEND_2 + respectively. The result is placed in HIGH_SUM and LOW_SUM. Overflow + (i.e. carry out) is not stored anywhere, and is lost. + + 8) sub_ddmmss(high_difference, low_difference, high_minuend, low_minuend, + high_subtrahend, low_subtrahend) subtracts two two-word UWtype integers, + composed by HIGH_MINUEND_1 and LOW_MINUEND_1, and HIGH_SUBTRAHEND_2 and + LOW_SUBTRAHEND_2 respectively. The result is placed in HIGH_DIFFERENCE + and LOW_DIFFERENCE. Overflow (i.e. carry out) is not stored anywhere, + and is lost. + + If any of these macros are left undefined for a particular CPU, + C macros are used. */ + +/* The CPUs come in alphabetical order below. + + Please add support for more CPUs here, or improve the current support + for the CPUs below! + (E.g. WE32100, IBM360.) */ + +#if defined (__GNUC__) && !defined (NO_ASM) + +/* We sometimes need to clobber "cc" with gcc2, but that would not be + understood by gcc1. Use cpp to avoid major code duplication. */ +#if __GNUC__ < 2 +#define __CLOBBER_CC +#define __AND_CLOBBER_CC +#else /* __GNUC__ >= 2 */ +#define __CLOBBER_CC : "cc" +#define __AND_CLOBBER_CC , "cc" +#endif /* __GNUC__ < 2 */ + +#if defined (__aarch64__) + +#if W_TYPE_SIZE == 32 +#define count_leading_zeros(COUNT, X) ((COUNT) = __builtin_clz (X)) +#define count_trailing_zeros(COUNT, X) ((COUNT) = __builtin_ctz (X)) +#define COUNT_LEADING_ZEROS_0 32 +#endif /* W_TYPE_SIZE == 32 */ + +#if W_TYPE_SIZE == 64 +#define count_leading_zeros(COUNT, X) ((COUNT) = __builtin_clzll (X)) +#define count_trailing_zeros(COUNT, X) ((COUNT) = __builtin_ctzll (X)) +#define COUNT_LEADING_ZEROS_0 64 +#endif /* W_TYPE_SIZE == 64 */ + +#endif /* __aarch64__ */ + +#if defined (__alpha) && W_TYPE_SIZE == 64 +#define umul_ppmm(ph, pl, m0, m1) \ + do { \ + UDItype __m0 = (m0), __m1 = (m1); \ + (ph) = __builtin_alpha_umulh (__m0, __m1); \ + (pl) = __m0 * __m1; \ + } while (0) +#define UMUL_TIME 46 +#ifndef LONGLONG_STANDALONE +#define udiv_qrnnd(q, r, n1, n0, d) \ + do { UDItype __r; \ + (q) = __udiv_qrnnd (&__r, (n1), (n0), (d)); \ + (r) = __r; \ + } while (0) +extern UDItype __udiv_qrnnd (UDItype *, UDItype, UDItype, UDItype); +#define UDIV_TIME 220 +#endif /* LONGLONG_STANDALONE */ +#ifdef __alpha_cix__ +#define count_leading_zeros(COUNT,X) ((COUNT) = __builtin_clzl (X)) +#define count_trailing_zeros(COUNT,X) ((COUNT) = __builtin_ctzl (X)) +#define COUNT_LEADING_ZEROS_0 64 +#else +#define count_leading_zeros(COUNT,X) \ + do { \ + UDItype __xr = (X), __t, __a; \ + __t = __builtin_alpha_cmpbge (0, __xr); \ + __a = __clz_tab[__t ^ 0xff] - 1; \ + __t = __builtin_alpha_extbl (__xr, __a); \ + (COUNT) = 64 - (__clz_tab[__t] + __a*8); \ + } while (0) +#define count_trailing_zeros(COUNT,X) \ + do { \ + UDItype __xr = (X), __t, __a; \ + __t = __builtin_alpha_cmpbge (0, __xr); \ + __t = ~__t & -~__t; \ + __a = ((__t & 0xCC) != 0) * 2; \ + __a += ((__t & 0xF0) != 0) * 4; \ + __a += ((__t & 0xAA) != 0); \ + __t = __builtin_alpha_extbl (__xr, __a); \ + __a <<= 3; \ + __t &= -__t; \ + __a += ((__t & 0xCC) != 0) * 2; \ + __a += ((__t & 0xF0) != 0) * 4; \ + __a += ((__t & 0xAA) != 0); \ + (COUNT) = __a; \ + } while (0) +#endif /* __alpha_cix__ */ +#endif /* __alpha */ + +#if defined (__arc__) && W_TYPE_SIZE == 32 +#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ + __asm__ ("add.f %1, %4, %5\n\tadc %0, %2, %3" \ + : "=r" ((USItype) (sh)), \ + "=&r" ((USItype) (sl)) \ + : "%r" ((USItype) (ah)), \ + "rIJ" ((USItype) (bh)), \ + "%r" ((USItype) (al)), \ + "rIJ" ((USItype) (bl))) +#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ + __asm__ ("sub.f %1, %4, %5\n\tsbc %0, %2, %3" \ + : "=r" ((USItype) (sh)), \ + "=&r" ((USItype) (sl)) \ + : "r" ((USItype) (ah)), \ + "rIJ" ((USItype) (bh)), \ + "r" ((USItype) (al)), \ + "rIJ" ((USItype) (bl))) + +#define __umulsidi3(u,v) ((UDItype)(USItype)u*(USItype)v) +#ifdef __ARC_NORM__ +#define count_leading_zeros(count, x) \ + do \ + { \ + SItype c_; \ + \ + __asm__ ("norm.f\t%0,%1\n\tmov.mi\t%0,-1" : "=r" (c_) : "r" (x) : "cc");\ + (count) = c_ + 1; \ + } \ + while (0) +#define COUNT_LEADING_ZEROS_0 32 +#endif +#endif + +#if defined (__arm__) && (defined (__thumb2__) || !defined (__thumb__)) \ + && W_TYPE_SIZE == 32 +#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ + __asm__ ("adds %1, %4, %5\n\tadc %0, %2, %3" \ + : "=r" ((USItype) (sh)), \ + "=&r" ((USItype) (sl)) \ + : "%r" ((USItype) (ah)), \ + "rI" ((USItype) (bh)), \ + "%r" ((USItype) (al)), \ + "rI" ((USItype) (bl)) __CLOBBER_CC) +#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ + __asm__ ("subs %1, %4, %5\n\tsbc %0, %2, %3" \ + : "=r" ((USItype) (sh)), \ + "=&r" ((USItype) (sl)) \ + : "r" ((USItype) (ah)), \ + "rI" ((USItype) (bh)), \ + "r" ((USItype) (al)), \ + "rI" ((USItype) (bl)) __CLOBBER_CC) +# if defined(__ARM_ARCH_2__) || defined(__ARM_ARCH_2A__) \ + || defined(__ARM_ARCH_3__) +# define umul_ppmm(xh, xl, a, b) \ + do { \ + register USItype __t0, __t1, __t2; \ + __asm__ ("%@ Inlined umul_ppmm\n" \ + " mov %2, %5, lsr #16\n" \ + " mov %0, %6, lsr #16\n" \ + " bic %3, %5, %2, lsl #16\n" \ + " bic %4, %6, %0, lsl #16\n" \ + " mul %1, %3, %4\n" \ + " mul %4, %2, %4\n" \ + " mul %3, %0, %3\n" \ + " mul %0, %2, %0\n" \ + " adds %3, %4, %3\n" \ + " addcs %0, %0, #65536\n" \ + " adds %1, %1, %3, lsl #16\n" \ + " adc %0, %0, %3, lsr #16" \ + : "=&r" ((USItype) (xh)), \ + "=r" ((USItype) (xl)), \ + "=&r" (__t0), "=&r" (__t1), "=r" (__t2) \ + : "r" ((USItype) (a)), \ + "r" ((USItype) (b)) __CLOBBER_CC ); \ + } while (0) +# define UMUL_TIME 20 +# else +# define umul_ppmm(xh, xl, a, b) \ + do { \ + /* Generate umull, under compiler control. */ \ + register UDItype __t0 = (UDItype)(USItype)(a) * (USItype)(b); \ + (xl) = (USItype)__t0; \ + (xh) = (USItype)(__t0 >> 32); \ + } while (0) +# define UMUL_TIME 3 +# endif +# define UDIV_TIME 100 +#endif /* __arm__ */ + +#if defined(__arm__) +/* Let gcc decide how best to implement count_leading_zeros. */ +#define count_leading_zeros(COUNT,X) ((COUNT) = __builtin_clz (X)) +#define count_trailing_zeros(COUNT,X) ((COUNT) = __builtin_ctz (X)) +#define COUNT_LEADING_ZEROS_0 32 +#endif + +#if defined (__AVR__) + +#if W_TYPE_SIZE == 16 +#define count_leading_zeros(COUNT,X) ((COUNT) = __builtin_clz (X)) +#define count_trailing_zeros(COUNT,X) ((COUNT) = __builtin_ctz (X)) +#define COUNT_LEADING_ZEROS_0 16 +#endif /* W_TYPE_SIZE == 16 */ + +#if W_TYPE_SIZE == 32 +#define count_leading_zeros(COUNT,X) ((COUNT) = __builtin_clzl (X)) +#define count_trailing_zeros(COUNT,X) ((COUNT) = __builtin_ctzl (X)) +#define COUNT_LEADING_ZEROS_0 32 +#endif /* W_TYPE_SIZE == 32 */ + +#if W_TYPE_SIZE == 64 +#define count_leading_zeros(COUNT,X) ((COUNT) = __builtin_clzll (X)) +#define count_trailing_zeros(COUNT,X) ((COUNT) = __builtin_ctzll (X)) +#define COUNT_LEADING_ZEROS_0 64 +#endif /* W_TYPE_SIZE == 64 */ + +#endif /* defined (__AVR__) */ + +#if defined (__CRIS__) + +#if __CRIS_arch_version >= 3 +#define count_leading_zeros(COUNT, X) ((COUNT) = __builtin_clz (X)) +#define COUNT_LEADING_ZEROS_0 32 +#endif /* __CRIS_arch_version >= 3 */ + +#if __CRIS_arch_version >= 8 +#define count_trailing_zeros(COUNT, X) ((COUNT) = __builtin_ctz (X)) +#endif /* __CRIS_arch_version >= 8 */ + +#if __CRIS_arch_version >= 10 +#define __umulsidi3(u,v) ((UDItype)(USItype) (u) * (UDItype)(USItype) (v)) +#else +#define __umulsidi3 __umulsidi3 +extern UDItype __umulsidi3 (USItype, USItype); +#endif /* __CRIS_arch_version >= 10 */ + +#define umul_ppmm(w1, w0, u, v) \ + do { \ + UDItype __x = __umulsidi3 (u, v); \ + (w0) = (USItype) (__x); \ + (w1) = (USItype) (__x >> 32); \ + } while (0) + +/* FIXME: defining add_ssaaaa and sub_ddmmss should be advantageous for + DFmode ("double" intrinsics, avoiding two of the three insns handling + carry), but defining them as open-code C composing and doing the + operation in DImode (UDImode) shows that the DImode needs work: + register pressure from requiring neighboring registers and the + traffic to and from them come to dominate, in the 4.7 series. */ + +#endif /* defined (__CRIS__) */ + +#if defined (__hppa) && W_TYPE_SIZE == 32 +#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ + __asm__ ("add %4,%5,%1\n\taddc %2,%3,%0" \ + : "=r" ((USItype) (sh)), \ + "=&r" ((USItype) (sl)) \ + : "%rM" ((USItype) (ah)), \ + "rM" ((USItype) (bh)), \ + "%rM" ((USItype) (al)), \ + "rM" ((USItype) (bl))) +#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ + __asm__ ("sub %4,%5,%1\n\tsubb %2,%3,%0" \ + : "=r" ((USItype) (sh)), \ + "=&r" ((USItype) (sl)) \ + : "rM" ((USItype) (ah)), \ + "rM" ((USItype) (bh)), \ + "rM" ((USItype) (al)), \ + "rM" ((USItype) (bl))) +#if defined (_PA_RISC1_1) +#define umul_ppmm(w1, w0, u, v) \ + do { \ + union \ + { \ + UDItype __f; \ + struct {USItype __w1, __w0;} __w1w0; \ + } __t; \ + __asm__ ("xmpyu %1,%2,%0" \ + : "=x" (__t.__f) \ + : "x" ((USItype) (u)), \ + "x" ((USItype) (v))); \ + (w1) = __t.__w1w0.__w1; \ + (w0) = __t.__w1w0.__w0; \ + } while (0) +#define UMUL_TIME 8 +#else +#define UMUL_TIME 30 +#endif +#define UDIV_TIME 40 +#define count_leading_zeros(count, x) \ + do { \ + USItype __tmp; \ + __asm__ ( \ + "ldi 1,%0\n" \ +" extru,= %1,15,16,%%r0 ; Bits 31..16 zero?\n" \ +" extru,tr %1,15,16,%1 ; No. Shift down, skip add.\n"\ +" ldo 16(%0),%0 ; Yes. Perform add.\n" \ +" extru,= %1,23,8,%%r0 ; Bits 15..8 zero?\n" \ +" extru,tr %1,23,8,%1 ; No. Shift down, skip add.\n"\ +" ldo 8(%0),%0 ; Yes. Perform add.\n" \ +" extru,= %1,27,4,%%r0 ; Bits 7..4 zero?\n" \ +" extru,tr %1,27,4,%1 ; No. Shift down, skip add.\n"\ +" ldo 4(%0),%0 ; Yes. Perform add.\n" \ +" extru,= %1,29,2,%%r0 ; Bits 3..2 zero?\n" \ +" extru,tr %1,29,2,%1 ; No. Shift down, skip add.\n"\ +" ldo 2(%0),%0 ; Yes. Perform add.\n" \ +" extru %1,30,1,%1 ; Extract bit 1.\n" \ +" sub %0,%1,%0 ; Subtract it.\n" \ + : "=r" (count), "=r" (__tmp) : "1" (x)); \ + } while (0) +#endif + +#if (defined (__i370__) || defined (__s390__) || defined (__mvs__)) && W_TYPE_SIZE == 32 +#if !defined (__zarch__) +#define smul_ppmm(xh, xl, m0, m1) \ + do { \ + union {DItype __ll; \ + struct {USItype __h, __l;} __i; \ + } __x; \ + __asm__ ("lr %N0,%1\n\tmr %0,%2" \ + : "=&r" (__x.__ll) \ + : "r" (m0), "r" (m1)); \ + (xh) = __x.__i.__h; (xl) = __x.__i.__l; \ + } while (0) +#define sdiv_qrnnd(q, r, n1, n0, d) \ + do { \ + union {DItype __ll; \ + struct {USItype __h, __l;} __i; \ + } __x; \ + __x.__i.__h = n1; __x.__i.__l = n0; \ + __asm__ ("dr %0,%2" \ + : "=r" (__x.__ll) \ + : "0" (__x.__ll), "r" (d)); \ + (q) = __x.__i.__l; (r) = __x.__i.__h; \ + } while (0) +#else +#define smul_ppmm(xh, xl, m0, m1) \ + do { \ + register SItype __r0 __asm__ ("0"); \ + register SItype __r1 __asm__ ("1") = (m0); \ + \ + __asm__ ("mr\t%%r0,%3" \ + : "=r" (__r0), "=r" (__r1) \ + : "r" (__r1), "r" (m1)); \ + (xh) = __r0; (xl) = __r1; \ + } while (0) + +#define sdiv_qrnnd(q, r, n1, n0, d) \ + do { \ + register SItype __r0 __asm__ ("0") = (n1); \ + register SItype __r1 __asm__ ("1") = (n0); \ + \ + __asm__ ("dr\t%%r0,%4" \ + : "=r" (__r0), "=r" (__r1) \ + : "r" (__r0), "r" (__r1), "r" (d)); \ + (q) = __r1; (r) = __r0; \ + } while (0) +#endif /* __zarch__ */ +#endif + +#if (defined (__i386__) || defined (__i486__)) && W_TYPE_SIZE == 32 +#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ + __asm__ ("add{l} {%5,%1|%1,%5}\n\tadc{l} {%3,%0|%0,%3}" \ + : "=r" ((USItype) (sh)), \ + "=&r" ((USItype) (sl)) \ + : "%0" ((USItype) (ah)), \ + "g" ((USItype) (bh)), \ + "%1" ((USItype) (al)), \ + "g" ((USItype) (bl))) +#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ + __asm__ ("sub{l} {%5,%1|%1,%5}\n\tsbb{l} {%3,%0|%0,%3}" \ + : "=r" ((USItype) (sh)), \ + "=&r" ((USItype) (sl)) \ + : "0" ((USItype) (ah)), \ + "g" ((USItype) (bh)), \ + "1" ((USItype) (al)), \ + "g" ((USItype) (bl))) +#define umul_ppmm(w1, w0, u, v) \ + __asm__ ("mul{l} %3" \ + : "=a" ((USItype) (w0)), \ + "=d" ((USItype) (w1)) \ + : "%0" ((USItype) (u)), \ + "rm" ((USItype) (v))) +#define udiv_qrnnd(q, r, n1, n0, dv) \ + __asm__ ("div{l} %4" \ + : "=a" ((USItype) (q)), \ + "=d" ((USItype) (r)) \ + : "0" ((USItype) (n0)), \ + "1" ((USItype) (n1)), \ + "rm" ((USItype) (dv))) +#define count_leading_zeros(count, x) ((count) = __builtin_clz (x)) +#define count_trailing_zeros(count, x) ((count) = __builtin_ctz (x)) +#define UMUL_TIME 40 +#define UDIV_TIME 40 +#endif /* 80x86 */ + +#if defined (__x86_64__) && W_TYPE_SIZE == 64 +#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ + __asm__ ("add{q} {%5,%1|%1,%5}\n\tadc{q} {%3,%0|%0,%3}" \ + : "=r" ((UDItype) (sh)), \ + "=&r" ((UDItype) (sl)) \ + : "%0" ((UDItype) (ah)), \ + "rme" ((UDItype) (bh)), \ + "%1" ((UDItype) (al)), \ + "rme" ((UDItype) (bl))) +#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ + __asm__ ("sub{q} {%5,%1|%1,%5}\n\tsbb{q} {%3,%0|%0,%3}" \ + : "=r" ((UDItype) (sh)), \ + "=&r" ((UDItype) (sl)) \ + : "0" ((UDItype) (ah)), \ + "rme" ((UDItype) (bh)), \ + "1" ((UDItype) (al)), \ + "rme" ((UDItype) (bl))) +#define umul_ppmm(w1, w0, u, v) \ + __asm__ ("mul{q} %3" \ + : "=a" ((UDItype) (w0)), \ + "=d" ((UDItype) (w1)) \ + : "%0" ((UDItype) (u)), \ + "rm" ((UDItype) (v))) +#define udiv_qrnnd(q, r, n1, n0, dv) \ + __asm__ ("div{q} %4" \ + : "=a" ((UDItype) (q)), \ + "=d" ((UDItype) (r)) \ + : "0" ((UDItype) (n0)), \ + "1" ((UDItype) (n1)), \ + "rm" ((UDItype) (dv))) +#define count_leading_zeros(count, x) ((count) = __builtin_clzll (x)) +#define count_trailing_zeros(count, x) ((count) = __builtin_ctzll (x)) +#define UMUL_TIME 40 +#define UDIV_TIME 40 +#endif /* x86_64 */ + +#if defined (__i960__) && W_TYPE_SIZE == 32 +#define umul_ppmm(w1, w0, u, v) \ + ({union {UDItype __ll; \ + struct {USItype __l, __h;} __i; \ + } __xx; \ + __asm__ ("emul %2,%1,%0" \ + : "=d" (__xx.__ll) \ + : "%dI" ((USItype) (u)), \ + "dI" ((USItype) (v))); \ + (w1) = __xx.__i.__h; (w0) = __xx.__i.__l;}) +#define __umulsidi3(u, v) \ + ({UDItype __w; \ + __asm__ ("emul %2,%1,%0" \ + : "=d" (__w) \ + : "%dI" ((USItype) (u)), \ + "dI" ((USItype) (v))); \ + __w; }) +#endif /* __i960__ */ + +#if defined (__ia64) && W_TYPE_SIZE == 64 +/* This form encourages gcc (pre-release 3.4 at least) to emit predicated + "sub r=r,r" and "sub r=r,r,1", giving a 2 cycle latency. The generic + code using "al>= _c; \ + if (_x >= 1 << 4) \ + _x >>= 4, _c += 4; \ + if (_x >= 1 << 2) \ + _x >>= 2, _c += 2; \ + _c += _x >> 1; \ + (count) = W_TYPE_SIZE - 1 - _c; \ + } while (0) +/* similar to what gcc does for __builtin_ffs, but 0 based rather than 1 + based, and we don't need a special case for x==0 here */ +#define count_trailing_zeros(count, x) \ + do { \ + UWtype __ctz_x = (x); \ + __asm__ ("popcnt %0 = %1" \ + : "=r" (count) \ + : "r" ((__ctz_x-1) & ~__ctz_x)); \ + } while (0) +#define UMUL_TIME 14 +#endif + +#if defined (__M32R__) && W_TYPE_SIZE == 32 +#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ + /* The cmp clears the condition bit. */ \ + __asm__ ("cmp %0,%0\n\taddx %1,%5\n\taddx %0,%3" \ + : "=r" ((USItype) (sh)), \ + "=&r" ((USItype) (sl)) \ + : "0" ((USItype) (ah)), \ + "r" ((USItype) (bh)), \ + "1" ((USItype) (al)), \ + "r" ((USItype) (bl)) \ + : "cbit") +#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ + /* The cmp clears the condition bit. */ \ + __asm__ ("cmp %0,%0\n\tsubx %1,%5\n\tsubx %0,%3" \ + : "=r" ((USItype) (sh)), \ + "=&r" ((USItype) (sl)) \ + : "0" ((USItype) (ah)), \ + "r" ((USItype) (bh)), \ + "1" ((USItype) (al)), \ + "r" ((USItype) (bl)) \ + : "cbit") +#endif /* __M32R__ */ + +#if defined (__mc68000__) && W_TYPE_SIZE == 32 +#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ + __asm__ ("add%.l %5,%1\n\taddx%.l %3,%0" \ + : "=d" ((USItype) (sh)), \ + "=&d" ((USItype) (sl)) \ + : "%0" ((USItype) (ah)), \ + "d" ((USItype) (bh)), \ + "%1" ((USItype) (al)), \ + "g" ((USItype) (bl))) +#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ + __asm__ ("sub%.l %5,%1\n\tsubx%.l %3,%0" \ + : "=d" ((USItype) (sh)), \ + "=&d" ((USItype) (sl)) \ + : "0" ((USItype) (ah)), \ + "d" ((USItype) (bh)), \ + "1" ((USItype) (al)), \ + "g" ((USItype) (bl))) + +/* The '020, '030, '040, '060 and CPU32 have 32x32->64 and 64/32->32q-32r. */ +#if (defined (__mc68020__) && !defined (__mc68060__)) +#define umul_ppmm(w1, w0, u, v) \ + __asm__ ("mulu%.l %3,%1:%0" \ + : "=d" ((USItype) (w0)), \ + "=d" ((USItype) (w1)) \ + : "%0" ((USItype) (u)), \ + "dmi" ((USItype) (v))) +#define UMUL_TIME 45 +#define udiv_qrnnd(q, r, n1, n0, d) \ + __asm__ ("divu%.l %4,%1:%0" \ + : "=d" ((USItype) (q)), \ + "=d" ((USItype) (r)) \ + : "0" ((USItype) (n0)), \ + "1" ((USItype) (n1)), \ + "dmi" ((USItype) (d))) +#define UDIV_TIME 90 +#define sdiv_qrnnd(q, r, n1, n0, d) \ + __asm__ ("divs%.l %4,%1:%0" \ + : "=d" ((USItype) (q)), \ + "=d" ((USItype) (r)) \ + : "0" ((USItype) (n0)), \ + "1" ((USItype) (n1)), \ + "dmi" ((USItype) (d))) + +#elif defined (__mcoldfire__) /* not mc68020 */ + +#define umul_ppmm(xh, xl, a, b) \ + __asm__ ("| Inlined umul_ppmm\n" \ + " move%.l %2,%/d0\n" \ + " move%.l %3,%/d1\n" \ + " move%.l %/d0,%/d2\n" \ + " swap %/d0\n" \ + " move%.l %/d1,%/d3\n" \ + " swap %/d1\n" \ + " move%.w %/d2,%/d4\n" \ + " mulu %/d3,%/d4\n" \ + " mulu %/d1,%/d2\n" \ + " mulu %/d0,%/d3\n" \ + " mulu %/d0,%/d1\n" \ + " move%.l %/d4,%/d0\n" \ + " clr%.w %/d0\n" \ + " swap %/d0\n" \ + " add%.l %/d0,%/d2\n" \ + " add%.l %/d3,%/d2\n" \ + " jcc 1f\n" \ + " add%.l %#65536,%/d1\n" \ + "1: swap %/d2\n" \ + " moveq %#0,%/d0\n" \ + " move%.w %/d2,%/d0\n" \ + " move%.w %/d4,%/d2\n" \ + " move%.l %/d2,%1\n" \ + " add%.l %/d1,%/d0\n" \ + " move%.l %/d0,%0" \ + : "=g" ((USItype) (xh)), \ + "=g" ((USItype) (xl)) \ + : "g" ((USItype) (a)), \ + "g" ((USItype) (b)) \ + : "d0", "d1", "d2", "d3", "d4") +#define UMUL_TIME 100 +#define UDIV_TIME 400 +#else /* not ColdFire */ +/* %/ inserts REGISTER_PREFIX, %# inserts IMMEDIATE_PREFIX. */ +#define umul_ppmm(xh, xl, a, b) \ + __asm__ ("| Inlined umul_ppmm\n" \ + " move%.l %2,%/d0\n" \ + " move%.l %3,%/d1\n" \ + " move%.l %/d0,%/d2\n" \ + " swap %/d0\n" \ + " move%.l %/d1,%/d3\n" \ + " swap %/d1\n" \ + " move%.w %/d2,%/d4\n" \ + " mulu %/d3,%/d4\n" \ + " mulu %/d1,%/d2\n" \ + " mulu %/d0,%/d3\n" \ + " mulu %/d0,%/d1\n" \ + " move%.l %/d4,%/d0\n" \ + " eor%.w %/d0,%/d0\n" \ + " swap %/d0\n" \ + " add%.l %/d0,%/d2\n" \ + " add%.l %/d3,%/d2\n" \ + " jcc 1f\n" \ + " add%.l %#65536,%/d1\n" \ + "1: swap %/d2\n" \ + " moveq %#0,%/d0\n" \ + " move%.w %/d2,%/d0\n" \ + " move%.w %/d4,%/d2\n" \ + " move%.l %/d2,%1\n" \ + " add%.l %/d1,%/d0\n" \ + " move%.l %/d0,%0" \ + : "=g" ((USItype) (xh)), \ + "=g" ((USItype) (xl)) \ + : "g" ((USItype) (a)), \ + "g" ((USItype) (b)) \ + : "d0", "d1", "d2", "d3", "d4") +#define UMUL_TIME 100 +#define UDIV_TIME 400 + +#endif /* not mc68020 */ + +/* The '020, '030, '040 and '060 have bitfield insns. + cpu32 disguises as a 68020, but lacks them. */ +#if defined (__mc68020__) && !defined (__mcpu32__) +#define count_leading_zeros(count, x) \ + __asm__ ("bfffo %1{%b2:%b2},%0" \ + : "=d" ((USItype) (count)) \ + : "od" ((USItype) (x)), "n" (0)) +/* Some ColdFire architectures have a ff1 instruction supported via + __builtin_clz. */ +#elif defined (__mcfisaaplus__) || defined (__mcfisac__) +#define count_leading_zeros(count,x) ((count) = __builtin_clz (x)) +#define COUNT_LEADING_ZEROS_0 32 +#endif +#endif /* mc68000 */ + +#if defined (__m88000__) && W_TYPE_SIZE == 32 +#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ + __asm__ ("addu.co %1,%r4,%r5\n\taddu.ci %0,%r2,%r3" \ + : "=r" ((USItype) (sh)), \ + "=&r" ((USItype) (sl)) \ + : "%rJ" ((USItype) (ah)), \ + "rJ" ((USItype) (bh)), \ + "%rJ" ((USItype) (al)), \ + "rJ" ((USItype) (bl))) +#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ + __asm__ ("subu.co %1,%r4,%r5\n\tsubu.ci %0,%r2,%r3" \ + : "=r" ((USItype) (sh)), \ + "=&r" ((USItype) (sl)) \ + : "rJ" ((USItype) (ah)), \ + "rJ" ((USItype) (bh)), \ + "rJ" ((USItype) (al)), \ + "rJ" ((USItype) (bl))) +#define count_leading_zeros(count, x) \ + do { \ + USItype __cbtmp; \ + __asm__ ("ff1 %0,%1" \ + : "=r" (__cbtmp) \ + : "r" ((USItype) (x))); \ + (count) = __cbtmp ^ 31; \ + } while (0) +#define COUNT_LEADING_ZEROS_0 63 /* sic */ +#if defined (__mc88110__) +#define umul_ppmm(wh, wl, u, v) \ + do { \ + union {UDItype __ll; \ + struct {USItype __h, __l;} __i; \ + } __xx; \ + __asm__ ("mulu.d %0,%1,%2" \ + : "=r" (__xx.__ll) \ + : "r" ((USItype) (u)), \ + "r" ((USItype) (v))); \ + (wh) = __xx.__i.__h; \ + (wl) = __xx.__i.__l; \ + } while (0) +#define udiv_qrnnd(q, r, n1, n0, d) \ + ({union {UDItype __ll; \ + struct {USItype __h, __l;} __i; \ + } __xx; \ + USItype __q; \ + __xx.__i.__h = (n1); __xx.__i.__l = (n0); \ + __asm__ ("divu.d %0,%1,%2" \ + : "=r" (__q) \ + : "r" (__xx.__ll), \ + "r" ((USItype) (d))); \ + (r) = (n0) - __q * (d); (q) = __q; }) +#define UMUL_TIME 5 +#define UDIV_TIME 25 +#else +#define UMUL_TIME 17 +#define UDIV_TIME 150 +#endif /* __mc88110__ */ +#endif /* __m88000__ */ + +#if defined (__mn10300__) +# if defined (__AM33__) +# define count_leading_zeros(COUNT,X) ((COUNT) = __builtin_clz (X)) +# define umul_ppmm(w1, w0, u, v) \ + asm("mulu %3,%2,%1,%0" : "=r"(w0), "=r"(w1) : "r"(u), "r"(v)) +# define smul_ppmm(w1, w0, u, v) \ + asm("mul %3,%2,%1,%0" : "=r"(w0), "=r"(w1) : "r"(u), "r"(v)) +# else +# define umul_ppmm(w1, w0, u, v) \ + asm("nop; nop; mulu %3,%0" : "=d"(w0), "=z"(w1) : "%0"(u), "d"(v)) +# define smul_ppmm(w1, w0, u, v) \ + asm("nop; nop; mul %3,%0" : "=d"(w0), "=z"(w1) : "%0"(u), "d"(v)) +# endif +# define add_ssaaaa(sh, sl, ah, al, bh, bl) \ + do { \ + DWunion __s, __a, __b; \ + __a.s.low = (al); __a.s.high = (ah); \ + __b.s.low = (bl); __b.s.high = (bh); \ + __s.ll = __a.ll + __b.ll; \ + (sl) = __s.s.low; (sh) = __s.s.high; \ + } while (0) +# define sub_ddmmss(sh, sl, ah, al, bh, bl) \ + do { \ + DWunion __s, __a, __b; \ + __a.s.low = (al); __a.s.high = (ah); \ + __b.s.low = (bl); __b.s.high = (bh); \ + __s.ll = __a.ll - __b.ll; \ + (sl) = __s.s.low; (sh) = __s.s.high; \ + } while (0) +# define udiv_qrnnd(q, r, nh, nl, d) \ + asm("divu %2,%0" : "=D"(q), "=z"(r) : "D"(d), "0"(nl), "1"(nh)) +# define sdiv_qrnnd(q, r, nh, nl, d) \ + asm("div %2,%0" : "=D"(q), "=z"(r) : "D"(d), "0"(nl), "1"(nh)) +# define UMUL_TIME 3 +# define UDIV_TIME 38 +#endif + +#if defined (__mips__) && W_TYPE_SIZE == 32 +#define umul_ppmm(w1, w0, u, v) \ + do { \ + UDItype __x = (UDItype) (USItype) (u) * (USItype) (v); \ + (w1) = (USItype) (__x >> 32); \ + (w0) = (USItype) (__x); \ + } while (0) +#define UMUL_TIME 10 +#define UDIV_TIME 100 + +#if (__mips == 32 || __mips == 64) && ! defined (__mips16) +#define count_leading_zeros(COUNT,X) ((COUNT) = __builtin_clz (X)) +#define COUNT_LEADING_ZEROS_0 32 +#endif +#endif /* __mips__ */ + +#if defined (__ns32000__) && W_TYPE_SIZE == 32 +#define umul_ppmm(w1, w0, u, v) \ + ({union {UDItype __ll; \ + struct {USItype __l, __h;} __i; \ + } __xx; \ + __asm__ ("meid %2,%0" \ + : "=g" (__xx.__ll) \ + : "%0" ((USItype) (u)), \ + "g" ((USItype) (v))); \ + (w1) = __xx.__i.__h; (w0) = __xx.__i.__l;}) +#define __umulsidi3(u, v) \ + ({UDItype __w; \ + __asm__ ("meid %2,%0" \ + : "=g" (__w) \ + : "%0" ((USItype) (u)), \ + "g" ((USItype) (v))); \ + __w; }) +#define udiv_qrnnd(q, r, n1, n0, d) \ + ({union {UDItype __ll; \ + struct {USItype __l, __h;} __i; \ + } __xx; \ + __xx.__i.__h = (n1); __xx.__i.__l = (n0); \ + __asm__ ("deid %2,%0" \ + : "=g" (__xx.__ll) \ + : "0" (__xx.__ll), \ + "g" ((USItype) (d))); \ + (r) = __xx.__i.__l; (q) = __xx.__i.__h; }) +#define count_trailing_zeros(count,x) \ + do { \ + __asm__ ("ffsd %2,%0" \ + : "=r" ((USItype) (count)) \ + : "0" ((USItype) 0), \ + "r" ((USItype) (x))); \ + } while (0) +#endif /* __ns32000__ */ + +/* FIXME: We should test _IBMR2 here when we add assembly support for the + system vendor compilers. + FIXME: What's needed for gcc PowerPC VxWorks? __vxworks__ is not good + enough, since that hits ARM and m68k too. */ +#if (defined (_ARCH_PPC) /* AIX */ \ + || defined (__powerpc__) /* gcc */ \ + || defined (__POWERPC__) /* BEOS */ \ + || defined (__ppc__) /* Darwin */ \ + || (defined (PPC) && ! defined (CPU_FAMILY)) /* gcc 2.7.x GNU&SysV */ \ + || (defined (PPC) && defined (CPU_FAMILY) /* VxWorks */ \ + && CPU_FAMILY == PPC) \ + ) && W_TYPE_SIZE == 32 +#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ + do { \ + if (__builtin_constant_p (bh) && (bh) == 0) \ + __asm__ ("add%I4c %1,%3,%4\n\taddze %0,%2" \ + : "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl));\ + else if (__builtin_constant_p (bh) && (bh) == ~(USItype) 0) \ + __asm__ ("add%I4c %1,%3,%4\n\taddme %0,%2" \ + : "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl));\ + else \ + __asm__ ("add%I5c %1,%4,%5\n\tadde %0,%2,%3" \ + : "=r" (sh), "=&r" (sl) \ + : "%r" (ah), "r" (bh), "%r" (al), "rI" (bl)); \ + } while (0) +#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ + do { \ + if (__builtin_constant_p (ah) && (ah) == 0) \ + __asm__ ("subf%I3c %1,%4,%3\n\tsubfze %0,%2" \ + : "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "r" (bl));\ + else if (__builtin_constant_p (ah) && (ah) == ~(USItype) 0) \ + __asm__ ("subf%I3c %1,%4,%3\n\tsubfme %0,%2" \ + : "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "r" (bl));\ + else if (__builtin_constant_p (bh) && (bh) == 0) \ + __asm__ ("subf%I3c %1,%4,%3\n\taddme %0,%2" \ + : "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "r" (bl));\ + else if (__builtin_constant_p (bh) && (bh) == ~(USItype) 0) \ + __asm__ ("subf%I3c %1,%4,%3\n\taddze %0,%2" \ + : "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "r" (bl));\ + else \ + __asm__ ("subf%I4c %1,%5,%4\n\tsubfe %0,%3,%2" \ + : "=r" (sh), "=&r" (sl) \ + : "r" (ah), "r" (bh), "rI" (al), "r" (bl)); \ + } while (0) +#define count_leading_zeros(count, x) \ + __asm__ ("cntlzw %0,%1" : "=r" (count) : "r" (x)) +#define COUNT_LEADING_ZEROS_0 32 +#if defined (_ARCH_PPC) || defined (__powerpc__) || defined (__POWERPC__) \ + || defined (__ppc__) \ + || (defined (PPC) && ! defined (CPU_FAMILY)) /* gcc 2.7.x GNU&SysV */ \ + || (defined (PPC) && defined (CPU_FAMILY) /* VxWorks */ \ + && CPU_FAMILY == PPC) +#define umul_ppmm(ph, pl, m0, m1) \ + do { \ + USItype __m0 = (m0), __m1 = (m1); \ + __asm__ ("mulhwu %0,%1,%2" : "=r" (ph) : "%r" (m0), "r" (m1)); \ + (pl) = __m0 * __m1; \ + } while (0) +#define UMUL_TIME 15 +#define smul_ppmm(ph, pl, m0, m1) \ + do { \ + SItype __m0 = (m0), __m1 = (m1); \ + __asm__ ("mulhw %0,%1,%2" : "=r" (ph) : "%r" (m0), "r" (m1)); \ + (pl) = __m0 * __m1; \ + } while (0) +#define SMUL_TIME 14 +#define UDIV_TIME 120 +#endif +#endif /* 32-bit POWER architecture variants. */ + +/* We should test _IBMR2 here when we add assembly support for the system + vendor compilers. */ +#if (defined (_ARCH_PPC64) || defined (__powerpc64__)) && W_TYPE_SIZE == 64 +#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ + do { \ + if (__builtin_constant_p (bh) && (bh) == 0) \ + __asm__ ("add%I4c %1,%3,%4\n\taddze %0,%2" \ + : "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl));\ + else if (__builtin_constant_p (bh) && (bh) == ~(UDItype) 0) \ + __asm__ ("add%I4c %1,%3,%4\n\taddme %0,%2" \ + : "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl));\ + else \ + __asm__ ("add%I5c %1,%4,%5\n\tadde %0,%2,%3" \ + : "=r" (sh), "=&r" (sl) \ + : "%r" (ah), "r" (bh), "%r" (al), "rI" (bl)); \ + } while (0) +#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ + do { \ + if (__builtin_constant_p (ah) && (ah) == 0) \ + __asm__ ("subf%I3c %1,%4,%3\n\tsubfze %0,%2" \ + : "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "r" (bl));\ + else if (__builtin_constant_p (ah) && (ah) == ~(UDItype) 0) \ + __asm__ ("subf%I3c %1,%4,%3\n\tsubfme %0,%2" \ + : "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "r" (bl));\ + else if (__builtin_constant_p (bh) && (bh) == 0) \ + __asm__ ("subf%I3c %1,%4,%3\n\taddme %0,%2" \ + : "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "r" (bl));\ + else if (__builtin_constant_p (bh) && (bh) == ~(UDItype) 0) \ + __asm__ ("subf%I3c %1,%4,%3\n\taddze %0,%2" \ + : "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "r" (bl));\ + else \ + __asm__ ("subf%I4c %1,%5,%4\n\tsubfe %0,%3,%2" \ + : "=r" (sh), "=&r" (sl) \ + : "r" (ah), "r" (bh), "rI" (al), "r" (bl)); \ + } while (0) +#define count_leading_zeros(count, x) \ + __asm__ ("cntlzd %0,%1" : "=r" (count) : "r" (x)) +#define COUNT_LEADING_ZEROS_0 64 +#define umul_ppmm(ph, pl, m0, m1) \ + do { \ + UDItype __m0 = (m0), __m1 = (m1); \ + __asm__ ("mulhdu %0,%1,%2" : "=r" (ph) : "%r" (m0), "r" (m1)); \ + (pl) = __m0 * __m1; \ + } while (0) +#define UMUL_TIME 15 +#define smul_ppmm(ph, pl, m0, m1) \ + do { \ + DItype __m0 = (m0), __m1 = (m1); \ + __asm__ ("mulhd %0,%1,%2" : "=r" (ph) : "%r" (m0), "r" (m1)); \ + (pl) = __m0 * __m1; \ + } while (0) +#define SMUL_TIME 14 /* ??? */ +#define UDIV_TIME 120 /* ??? */ +#endif /* 64-bit PowerPC. */ + +#if defined (__ibm032__) /* RT/ROMP */ && W_TYPE_SIZE == 32 +#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ + __asm__ ("a %1,%5\n\tae %0,%3" \ + : "=r" ((USItype) (sh)), \ + "=&r" ((USItype) (sl)) \ + : "%0" ((USItype) (ah)), \ + "r" ((USItype) (bh)), \ + "%1" ((USItype) (al)), \ + "r" ((USItype) (bl))) +#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ + __asm__ ("s %1,%5\n\tse %0,%3" \ + : "=r" ((USItype) (sh)), \ + "=&r" ((USItype) (sl)) \ + : "0" ((USItype) (ah)), \ + "r" ((USItype) (bh)), \ + "1" ((USItype) (al)), \ + "r" ((USItype) (bl))) +#define umul_ppmm(ph, pl, m0, m1) \ + do { \ + USItype __m0 = (m0), __m1 = (m1); \ + __asm__ ( \ + "s r2,r2\n" \ +" mts r10,%2\n" \ +" m r2,%3\n" \ +" m r2,%3\n" \ +" m r2,%3\n" \ +" m r2,%3\n" \ +" m r2,%3\n" \ +" m r2,%3\n" \ +" m r2,%3\n" \ +" m r2,%3\n" \ +" m r2,%3\n" \ +" m r2,%3\n" \ +" m r2,%3\n" \ +" m r2,%3\n" \ +" m r2,%3\n" \ +" m r2,%3\n" \ +" m r2,%3\n" \ +" m r2,%3\n" \ +" cas %0,r2,r0\n" \ +" mfs r10,%1" \ + : "=r" ((USItype) (ph)), \ + "=r" ((USItype) (pl)) \ + : "%r" (__m0), \ + "r" (__m1) \ + : "r2"); \ + (ph) += ((((SItype) __m0 >> 31) & __m1) \ + + (((SItype) __m1 >> 31) & __m0)); \ + } while (0) +#define UMUL_TIME 20 +#define UDIV_TIME 200 +#define count_leading_zeros(count, x) \ + do { \ + if ((x) >= 0x10000) \ + __asm__ ("clz %0,%1" \ + : "=r" ((USItype) (count)) \ + : "r" ((USItype) (x) >> 16)); \ + else \ + { \ + __asm__ ("clz %0,%1" \ + : "=r" ((USItype) (count)) \ + : "r" ((USItype) (x))); \ + (count) += 16; \ + } \ + } while (0) +#endif + +#if defined(__sh__) && !__SHMEDIA__ && W_TYPE_SIZE == 32 +#ifndef __sh1__ +#define umul_ppmm(w1, w0, u, v) \ + __asm__ ( \ + "dmulu.l %2,%3\n\tsts%M1 macl,%1\n\tsts%M0 mach,%0" \ + : "=r<" ((USItype)(w1)), \ + "=r<" ((USItype)(w0)) \ + : "r" ((USItype)(u)), \ + "r" ((USItype)(v)) \ + : "macl", "mach") +#define UMUL_TIME 5 +#endif + +/* This is the same algorithm as __udiv_qrnnd_c. */ +#define UDIV_NEEDS_NORMALIZATION 1 + +#define udiv_qrnnd(q, r, n1, n0, d) \ + do { \ + extern UWtype __udiv_qrnnd_16 (UWtype, UWtype) \ + __attribute__ ((visibility ("hidden"))); \ + /* r0: rn r1: qn */ /* r0: n1 r4: n0 r5: d r6: d1 */ /* r2: __m */ \ + __asm__ ( \ + "mov%M4 %4,r5\n" \ +" swap.w %3,r4\n" \ +" swap.w r5,r6\n" \ +" jsr @%5\n" \ +" shll16 r6\n" \ +" swap.w r4,r4\n" \ +" jsr @%5\n" \ +" swap.w r1,%0\n" \ +" or r1,%0" \ + : "=r" (q), "=&z" (r) \ + : "1" (n1), "r" (n0), "rm" (d), "r" (&__udiv_qrnnd_16) \ + : "r1", "r2", "r4", "r5", "r6", "pr", "t"); \ + } while (0) + +#define UDIV_TIME 80 + +#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ + __asm__ ("clrt;subc %5,%1; subc %4,%0" \ + : "=r" (sh), "=r" (sl) \ + : "0" (ah), "1" (al), "r" (bh), "r" (bl) : "t") + +#endif /* __sh__ */ + +#if defined (__SH5__) && __SHMEDIA__ && W_TYPE_SIZE == 32 +#define __umulsidi3(u,v) ((UDItype)(USItype)u*(USItype)v) +#define count_leading_zeros(count, x) \ + do \ + { \ + UDItype x_ = (USItype)(x); \ + SItype c_; \ + \ + __asm__ ("nsb %1, %0" : "=r" (c_) : "r" (x_)); \ + (count) = c_ - 31; \ + } \ + while (0) +#define COUNT_LEADING_ZEROS_0 32 +#endif + +#if defined (__sparc__) && !defined (__arch64__) && !defined (__sparcv9) \ + && W_TYPE_SIZE == 32 +#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ + __asm__ ("addcc %r4,%5,%1\n\taddx %r2,%3,%0" \ + : "=r" ((USItype) (sh)), \ + "=&r" ((USItype) (sl)) \ + : "%rJ" ((USItype) (ah)), \ + "rI" ((USItype) (bh)), \ + "%rJ" ((USItype) (al)), \ + "rI" ((USItype) (bl)) \ + __CLOBBER_CC) +#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ + __asm__ ("subcc %r4,%5,%1\n\tsubx %r2,%3,%0" \ + : "=r" ((USItype) (sh)), \ + "=&r" ((USItype) (sl)) \ + : "rJ" ((USItype) (ah)), \ + "rI" ((USItype) (bh)), \ + "rJ" ((USItype) (al)), \ + "rI" ((USItype) (bl)) \ + __CLOBBER_CC) +#if defined (__sparc_v9__) +#define umul_ppmm(w1, w0, u, v) \ + do { \ + register USItype __g1 asm ("g1"); \ + __asm__ ("umul\t%2,%3,%1\n\t" \ + "srlx\t%1, 32, %0" \ + : "=r" ((USItype) (w1)), \ + "=r" (__g1) \ + : "r" ((USItype) (u)), \ + "r" ((USItype) (v))); \ + (w0) = __g1; \ + } while (0) +#define udiv_qrnnd(__q, __r, __n1, __n0, __d) \ + __asm__ ("mov\t%2,%%y\n\t" \ + "udiv\t%3,%4,%0\n\t" \ + "umul\t%0,%4,%1\n\t" \ + "sub\t%3,%1,%1" \ + : "=&r" ((USItype) (__q)), \ + "=&r" ((USItype) (__r)) \ + : "r" ((USItype) (__n1)), \ + "r" ((USItype) (__n0)), \ + "r" ((USItype) (__d))) +#else +#if defined (__sparc_v8__) +#define umul_ppmm(w1, w0, u, v) \ + __asm__ ("umul %2,%3,%1;rd %%y,%0" \ + : "=r" ((USItype) (w1)), \ + "=r" ((USItype) (w0)) \ + : "r" ((USItype) (u)), \ + "r" ((USItype) (v))) +#define udiv_qrnnd(__q, __r, __n1, __n0, __d) \ + __asm__ ("mov %2,%%y;nop;nop;nop;udiv %3,%4,%0;umul %0,%4,%1;sub %3,%1,%1"\ + : "=&r" ((USItype) (__q)), \ + "=&r" ((USItype) (__r)) \ + : "r" ((USItype) (__n1)), \ + "r" ((USItype) (__n0)), \ + "r" ((USItype) (__d))) +#else +#if defined (__sparclite__) +/* This has hardware multiply but not divide. It also has two additional + instructions scan (ffs from high bit) and divscc. */ +#define umul_ppmm(w1, w0, u, v) \ + __asm__ ("umul %2,%3,%1;rd %%y,%0" \ + : "=r" ((USItype) (w1)), \ + "=r" ((USItype) (w0)) \ + : "r" ((USItype) (u)), \ + "r" ((USItype) (v))) +#define udiv_qrnnd(q, r, n1, n0, d) \ + __asm__ ("! Inlined udiv_qrnnd\n" \ +" wr %%g0,%2,%%y ! Not a delayed write for sparclite\n" \ +" tst %%g0\n" \ +" divscc %3,%4,%%g1\n" \ +" divscc %%g1,%4,%%g1\n" \ +" divscc %%g1,%4,%%g1\n" \ +" divscc %%g1,%4,%%g1\n" \ +" divscc %%g1,%4,%%g1\n" \ +" divscc %%g1,%4,%%g1\n" \ +" divscc %%g1,%4,%%g1\n" \ +" divscc %%g1,%4,%%g1\n" \ +" divscc %%g1,%4,%%g1\n" \ +" divscc %%g1,%4,%%g1\n" \ +" divscc %%g1,%4,%%g1\n" \ +" divscc %%g1,%4,%%g1\n" \ +" divscc %%g1,%4,%%g1\n" \ +" divscc %%g1,%4,%%g1\n" \ +" divscc %%g1,%4,%%g1\n" \ +" divscc %%g1,%4,%%g1\n" \ +" divscc %%g1,%4,%%g1\n" \ +" divscc %%g1,%4,%%g1\n" \ +" divscc %%g1,%4,%%g1\n" \ +" divscc %%g1,%4,%%g1\n" \ +" divscc %%g1,%4,%%g1\n" \ +" divscc %%g1,%4,%%g1\n" \ +" divscc %%g1,%4,%%g1\n" \ +" divscc %%g1,%4,%%g1\n" \ +" divscc %%g1,%4,%%g1\n" \ +" divscc %%g1,%4,%%g1\n" \ +" divscc %%g1,%4,%%g1\n" \ +" divscc %%g1,%4,%%g1\n" \ +" divscc %%g1,%4,%%g1\n" \ +" divscc %%g1,%4,%%g1\n" \ +" divscc %%g1,%4,%%g1\n" \ +" divscc %%g1,%4,%0\n" \ +" rd %%y,%1\n" \ +" bl,a 1f\n" \ +" add %1,%4,%1\n" \ +"1: ! End of inline udiv_qrnnd" \ + : "=r" ((USItype) (q)), \ + "=r" ((USItype) (r)) \ + : "r" ((USItype) (n1)), \ + "r" ((USItype) (n0)), \ + "rI" ((USItype) (d)) \ + : "g1" __AND_CLOBBER_CC) +#define UDIV_TIME 37 +#define count_leading_zeros(count, x) \ + do { \ + __asm__ ("scan %1,1,%0" \ + : "=r" ((USItype) (count)) \ + : "r" ((USItype) (x))); \ + } while (0) +/* Early sparclites return 63 for an argument of 0, but they warn that future + implementations might change this. Therefore, leave COUNT_LEADING_ZEROS_0 + undefined. */ +#else +/* SPARC without integer multiplication and divide instructions. + (i.e. at least Sun4/20,40,60,65,75,110,260,280,330,360,380,470,490) */ +#define umul_ppmm(w1, w0, u, v) \ + __asm__ ("! Inlined umul_ppmm\n" \ +" wr %%g0,%2,%%y ! SPARC has 0-3 delay insn after a wr\n"\ +" sra %3,31,%%o5 ! Don't move this insn\n" \ +" and %2,%%o5,%%o5 ! Don't move this insn\n" \ +" andcc %%g0,0,%%g1 ! Don't move this insn\n" \ +" mulscc %%g1,%3,%%g1\n" \ +" mulscc %%g1,%3,%%g1\n" \ +" mulscc %%g1,%3,%%g1\n" \ +" mulscc %%g1,%3,%%g1\n" \ +" mulscc %%g1,%3,%%g1\n" \ +" mulscc %%g1,%3,%%g1\n" \ +" mulscc %%g1,%3,%%g1\n" \ +" mulscc %%g1,%3,%%g1\n" \ +" mulscc %%g1,%3,%%g1\n" \ +" mulscc %%g1,%3,%%g1\n" \ +" mulscc %%g1,%3,%%g1\n" \ +" mulscc %%g1,%3,%%g1\n" \ +" mulscc %%g1,%3,%%g1\n" \ +" mulscc %%g1,%3,%%g1\n" \ +" mulscc %%g1,%3,%%g1\n" \ +" mulscc %%g1,%3,%%g1\n" \ +" mulscc %%g1,%3,%%g1\n" \ +" mulscc %%g1,%3,%%g1\n" \ +" mulscc %%g1,%3,%%g1\n" \ +" mulscc %%g1,%3,%%g1\n" \ +" mulscc %%g1,%3,%%g1\n" \ +" mulscc %%g1,%3,%%g1\n" \ +" mulscc %%g1,%3,%%g1\n" \ +" mulscc %%g1,%3,%%g1\n" \ +" mulscc %%g1,%3,%%g1\n" \ +" mulscc %%g1,%3,%%g1\n" \ +" mulscc %%g1,%3,%%g1\n" \ +" mulscc %%g1,%3,%%g1\n" \ +" mulscc %%g1,%3,%%g1\n" \ +" mulscc %%g1,%3,%%g1\n" \ +" mulscc %%g1,%3,%%g1\n" \ +" mulscc %%g1,%3,%%g1\n" \ +" mulscc %%g1,0,%%g1\n" \ +" add %%g1,%%o5,%0\n" \ +" rd %%y,%1" \ + : "=r" ((USItype) (w1)), \ + "=r" ((USItype) (w0)) \ + : "%rI" ((USItype) (u)), \ + "r" ((USItype) (v)) \ + : "g1", "o5" __AND_CLOBBER_CC) +#define UMUL_TIME 39 /* 39 instructions */ +/* It's quite necessary to add this much assembler for the sparc. + The default udiv_qrnnd (in C) is more than 10 times slower! */ +#define udiv_qrnnd(__q, __r, __n1, __n0, __d) \ + __asm__ ("! Inlined udiv_qrnnd\n" \ +" mov 32,%%g1\n" \ +" subcc %1,%2,%%g0\n" \ +"1: bcs 5f\n" \ +" addxcc %0,%0,%0 ! shift n1n0 and a q-bit in lsb\n" \ +" sub %1,%2,%1 ! this kills msb of n\n" \ +" addx %1,%1,%1 ! so this can't give carry\n" \ +" subcc %%g1,1,%%g1\n" \ +"2: bne 1b\n" \ +" subcc %1,%2,%%g0\n" \ +" bcs 3f\n" \ +" addxcc %0,%0,%0 ! shift n1n0 and a q-bit in lsb\n" \ +" b 3f\n" \ +" sub %1,%2,%1 ! this kills msb of n\n" \ +"4: sub %1,%2,%1\n" \ +"5: addxcc %1,%1,%1\n" \ +" bcc 2b\n" \ +" subcc %%g1,1,%%g1\n" \ +"! Got carry from n. Subtract next step to cancel this carry.\n" \ +" bne 4b\n" \ +" addcc %0,%0,%0 ! shift n1n0 and a 0-bit in lsb\n" \ +" sub %1,%2,%1\n" \ +"3: xnor %0,0,%0\n" \ +" ! End of inline udiv_qrnnd" \ + : "=&r" ((USItype) (__q)), \ + "=&r" ((USItype) (__r)) \ + : "r" ((USItype) (__d)), \ + "1" ((USItype) (__n1)), \ + "0" ((USItype) (__n0)) : "g1" __AND_CLOBBER_CC) +#define UDIV_TIME (3+7*32) /* 7 instructions/iteration. 32 iterations. */ +#endif /* __sparclite__ */ +#endif /* __sparc_v8__ */ +#endif /* __sparc_v9__ */ +#endif /* sparc32 */ + +#if ((defined (__sparc__) && defined (__arch64__)) || defined (__sparcv9)) \ + && W_TYPE_SIZE == 64 +#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ + do { \ + UDItype __carry = 0; \ + __asm__ ("addcc\t%r5,%6,%1\n\t" \ + "add\t%r3,%4,%0\n\t" \ + "movcs\t%%xcc, 1, %2\n\t" \ + "add\t%0, %2, %0" \ + : "=r" ((UDItype)(sh)), \ + "=&r" ((UDItype)(sl)), \ + "+r" (__carry) \ + : "%rJ" ((UDItype)(ah)), \ + "rI" ((UDItype)(bh)), \ + "%rJ" ((UDItype)(al)), \ + "rI" ((UDItype)(bl)) \ + __CLOBBER_CC); \ + } while (0) + +#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ + do { \ + UDItype __carry = 0; \ + __asm__ ("subcc\t%r5,%6,%1\n\t" \ + "sub\t%r3,%4,%0\n\t" \ + "movcs\t%%xcc, 1, %2\n\t" \ + "sub\t%0, %2, %0" \ + : "=r" ((UDItype)(sh)), \ + "=&r" ((UDItype)(sl)), \ + "+r" (__carry) \ + : "%rJ" ((UDItype)(ah)), \ + "rI" ((UDItype)(bh)), \ + "%rJ" ((UDItype)(al)), \ + "rI" ((UDItype)(bl)) \ + __CLOBBER_CC); \ + } while (0) + +#define umul_ppmm(wh, wl, u, v) \ + do { \ + UDItype tmp1, tmp2, tmp3, tmp4; \ + __asm__ __volatile__ ( \ + "srl %7,0,%3\n\t" \ + "mulx %3,%6,%1\n\t" \ + "srlx %6,32,%2\n\t" \ + "mulx %2,%3,%4\n\t" \ + "sllx %4,32,%5\n\t" \ + "srl %6,0,%3\n\t" \ + "sub %1,%5,%5\n\t" \ + "srlx %5,32,%5\n\t" \ + "addcc %4,%5,%4\n\t" \ + "srlx %7,32,%5\n\t" \ + "mulx %3,%5,%3\n\t" \ + "mulx %2,%5,%5\n\t" \ + "sethi %%hi(0x80000000),%2\n\t" \ + "addcc %4,%3,%4\n\t" \ + "srlx %4,32,%4\n\t" \ + "add %2,%2,%2\n\t" \ + "movcc %%xcc,%%g0,%2\n\t" \ + "addcc %5,%4,%5\n\t" \ + "sllx %3,32,%3\n\t" \ + "add %1,%3,%1\n\t" \ + "add %5,%2,%0" \ + : "=r" ((UDItype)(wh)), \ + "=&r" ((UDItype)(wl)), \ + "=&r" (tmp1), "=&r" (tmp2), "=&r" (tmp3), "=&r" (tmp4) \ + : "r" ((UDItype)(u)), \ + "r" ((UDItype)(v)) \ + __CLOBBER_CC); \ + } while (0) +#define UMUL_TIME 96 +#define UDIV_TIME 230 +#endif /* sparc64 */ + +#if defined (__vax__) && W_TYPE_SIZE == 32 +#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ + __asm__ ("addl2 %5,%1\n\tadwc %3,%0" \ + : "=g" ((USItype) (sh)), \ + "=&g" ((USItype) (sl)) \ + : "%0" ((USItype) (ah)), \ + "g" ((USItype) (bh)), \ + "%1" ((USItype) (al)), \ + "g" ((USItype) (bl))) +#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ + __asm__ ("subl2 %5,%1\n\tsbwc %3,%0" \ + : "=g" ((USItype) (sh)), \ + "=&g" ((USItype) (sl)) \ + : "0" ((USItype) (ah)), \ + "g" ((USItype) (bh)), \ + "1" ((USItype) (al)), \ + "g" ((USItype) (bl))) +#define umul_ppmm(xh, xl, m0, m1) \ + do { \ + union { \ + UDItype __ll; \ + struct {USItype __l, __h;} __i; \ + } __xx; \ + USItype __m0 = (m0), __m1 = (m1); \ + __asm__ ("emul %1,%2,$0,%0" \ + : "=r" (__xx.__ll) \ + : "g" (__m0), \ + "g" (__m1)); \ + (xh) = __xx.__i.__h; \ + (xl) = __xx.__i.__l; \ + (xh) += ((((SItype) __m0 >> 31) & __m1) \ + + (((SItype) __m1 >> 31) & __m0)); \ + } while (0) +#define sdiv_qrnnd(q, r, n1, n0, d) \ + do { \ + union {DItype __ll; \ + struct {SItype __l, __h;} __i; \ + } __xx; \ + __xx.__i.__h = n1; __xx.__i.__l = n0; \ + __asm__ ("ediv %3,%2,%0,%1" \ + : "=g" (q), "=g" (r) \ + : "g" (__xx.__ll), "g" (d)); \ + } while (0) +#endif /* __vax__ */ + +#ifdef _TMS320C6X +#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ + do \ + { \ + UDItype __ll; \ + __asm__ ("addu .l1 %1, %2, %0" \ + : "=a" (__ll) : "a" (al), "a" (bl)); \ + (sl) = (USItype)__ll; \ + (sh) = ((USItype)(__ll >> 32)) + (ah) + (bh); \ + } \ + while (0) + +#ifdef _TMS320C6400_PLUS +#define __umulsidi3(u,v) ((UDItype)(USItype)u*(USItype)v) +#define umul_ppmm(w1, w0, u, v) \ + do { \ + UDItype __x = (UDItype) (USItype) (u) * (USItype) (v); \ + (w1) = (USItype) (__x >> 32); \ + (w0) = (USItype) (__x); \ + } while (0) +#endif /* _TMS320C6400_PLUS */ + +#define count_leading_zeros(count, x) ((count) = __builtin_clz (x)) +#ifdef _TMS320C6400 +#define count_trailing_zeros(count, x) ((count) = __builtin_ctz (x)) +#endif +#define UMUL_TIME 4 +#define UDIV_TIME 40 +#endif /* _TMS320C6X */ + +#if defined (__xtensa__) && W_TYPE_SIZE == 32 +/* This code is not Xtensa-configuration-specific, so rely on the compiler + to expand builtin functions depending on what configuration features + are available. This avoids library calls when the operation can be + performed in-line. */ +#define umul_ppmm(w1, w0, u, v) \ + do { \ + DWunion __w; \ + __w.ll = __builtin_umulsidi3 (u, v); \ + w1 = __w.s.high; \ + w0 = __w.s.low; \ + } while (0) +#define __umulsidi3(u, v) __builtin_umulsidi3 (u, v) +#define count_leading_zeros(COUNT, X) ((COUNT) = __builtin_clz (X)) +#define count_trailing_zeros(COUNT, X) ((COUNT) = __builtin_ctz (X)) +#endif /* __xtensa__ */ + +#if defined xstormy16 +extern UHItype __stormy16_count_leading_zeros (UHItype); +#define count_leading_zeros(count, x) \ + do \ + { \ + UHItype size; \ + \ + /* We assume that W_TYPE_SIZE is a multiple of 16... */ \ + for ((count) = 0, size = W_TYPE_SIZE; size; size -= 16) \ + { \ + UHItype c; \ + \ + c = __clzhi2 ((x) >> (size - 16)); \ + (count) += c; \ + if (c != 16) \ + break; \ + } \ + } \ + while (0) +#define COUNT_LEADING_ZEROS_0 W_TYPE_SIZE +#endif + +#if defined (__z8000__) && W_TYPE_SIZE == 16 +#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ + __asm__ ("add %H1,%H5\n\tadc %H0,%H3" \ + : "=r" ((unsigned int)(sh)), \ + "=&r" ((unsigned int)(sl)) \ + : "%0" ((unsigned int)(ah)), \ + "r" ((unsigned int)(bh)), \ + "%1" ((unsigned int)(al)), \ + "rQR" ((unsigned int)(bl))) +#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ + __asm__ ("sub %H1,%H5\n\tsbc %H0,%H3" \ + : "=r" ((unsigned int)(sh)), \ + "=&r" ((unsigned int)(sl)) \ + : "0" ((unsigned int)(ah)), \ + "r" ((unsigned int)(bh)), \ + "1" ((unsigned int)(al)), \ + "rQR" ((unsigned int)(bl))) +#define umul_ppmm(xh, xl, m0, m1) \ + do { \ + union {long int __ll; \ + struct {unsigned int __h, __l;} __i; \ + } __xx; \ + unsigned int __m0 = (m0), __m1 = (m1); \ + __asm__ ("mult %S0,%H3" \ + : "=r" (__xx.__i.__h), \ + "=r" (__xx.__i.__l) \ + : "%1" (__m0), \ + "rQR" (__m1)); \ + (xh) = __xx.__i.__h; (xl) = __xx.__i.__l; \ + (xh) += ((((signed int) __m0 >> 15) & __m1) \ + + (((signed int) __m1 >> 15) & __m0)); \ + } while (0) +#endif /* __z8000__ */ + +#endif /* __GNUC__ */ + +/* If this machine has no inline assembler, use C macros. */ + +#if !defined (add_ssaaaa) +#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ + do { \ + UWtype __x; \ + __x = (al) + (bl); \ + (sh) = (ah) + (bh) + (__x < (al)); \ + (sl) = __x; \ + } while (0) +#endif + +#if !defined (sub_ddmmss) +#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ + do { \ + UWtype __x; \ + __x = (al) - (bl); \ + (sh) = (ah) - (bh) - (__x > (al)); \ + (sl) = __x; \ + } while (0) +#endif + +/* If we lack umul_ppmm but have smul_ppmm, define umul_ppmm in terms of + smul_ppmm. */ +#if !defined (umul_ppmm) && defined (smul_ppmm) +#define umul_ppmm(w1, w0, u, v) \ + do { \ + UWtype __w1; \ + UWtype __xm0 = (u), __xm1 = (v); \ + smul_ppmm (__w1, w0, __xm0, __xm1); \ + (w1) = __w1 + (-(__xm0 >> (W_TYPE_SIZE - 1)) & __xm1) \ + + (-(__xm1 >> (W_TYPE_SIZE - 1)) & __xm0); \ + } while (0) +#endif + +/* If we still don't have umul_ppmm, define it using plain C. */ +#if !defined (umul_ppmm) +#define umul_ppmm(w1, w0, u, v) \ + do { \ + UWtype __x0, __x1, __x2, __x3; \ + UHWtype __ul, __vl, __uh, __vh; \ + \ + __ul = __ll_lowpart (u); \ + __uh = __ll_highpart (u); \ + __vl = __ll_lowpart (v); \ + __vh = __ll_highpart (v); \ + \ + __x0 = (UWtype) __ul * __vl; \ + __x1 = (UWtype) __ul * __vh; \ + __x2 = (UWtype) __uh * __vl; \ + __x3 = (UWtype) __uh * __vh; \ + \ + __x1 += __ll_highpart (__x0);/* this can't give carry */ \ + __x1 += __x2; /* but this indeed can */ \ + if (__x1 < __x2) /* did we get it? */ \ + __x3 += __ll_B; /* yes, add it in the proper pos. */ \ + \ + (w1) = __x3 + __ll_highpart (__x1); \ + (w0) = __ll_lowpart (__x1) * __ll_B + __ll_lowpart (__x0); \ + } while (0) +#endif + +#if !defined (__umulsidi3) +#define __umulsidi3(u, v) \ + ({DWunion __w; \ + umul_ppmm (__w.s.high, __w.s.low, u, v); \ + __w.ll; }) +#endif + +/* Define this unconditionally, so it can be used for debugging. */ +#define __udiv_qrnnd_c(q, r, n1, n0, d) \ + do { \ + UWtype __d1, __d0, __q1, __q0; \ + UWtype __r1, __r0, __m; \ + __d1 = __ll_highpart (d); \ + __d0 = __ll_lowpart (d); \ + \ + __r1 = (n1) % __d1; \ + __q1 = (n1) / __d1; \ + __m = (UWtype) __q1 * __d0; \ + __r1 = __r1 * __ll_B | __ll_highpart (n0); \ + if (__r1 < __m) \ + { \ + __q1--, __r1 += (d); \ + if (__r1 >= (d)) /* i.e. we didn't get carry when adding to __r1 */\ + if (__r1 < __m) \ + __q1--, __r1 += (d); \ + } \ + __r1 -= __m; \ + \ + __r0 = __r1 % __d1; \ + __q0 = __r1 / __d1; \ + __m = (UWtype) __q0 * __d0; \ + __r0 = __r0 * __ll_B | __ll_lowpart (n0); \ + if (__r0 < __m) \ + { \ + __q0--, __r0 += (d); \ + if (__r0 >= (d)) \ + if (__r0 < __m) \ + __q0--, __r0 += (d); \ + } \ + __r0 -= __m; \ + \ + (q) = (UWtype) __q1 * __ll_B | __q0; \ + (r) = __r0; \ + } while (0) + +/* If the processor has no udiv_qrnnd but sdiv_qrnnd, go through + __udiv_w_sdiv (defined in libgcc or elsewhere). */ +#if !defined (udiv_qrnnd) && defined (sdiv_qrnnd) +#define udiv_qrnnd(q, r, nh, nl, d) \ + do { \ + USItype __r; \ + (q) = __udiv_w_sdiv (&__r, nh, nl, d); \ + (r) = __r; \ + } while (0) +#endif + +/* If udiv_qrnnd was not defined for this processor, use __udiv_qrnnd_c. */ +#if !defined (udiv_qrnnd) +#define UDIV_NEEDS_NORMALIZATION 1 +#define udiv_qrnnd __udiv_qrnnd_c +#endif + +#if !defined (count_leading_zeros) +#define count_leading_zeros(count, x) \ + do { \ + UWtype __xr = (x); \ + UWtype __a; \ + \ + if (W_TYPE_SIZE <= 32) \ + { \ + __a = __xr < ((UWtype)1<<2*__BITS4) \ + ? (__xr < ((UWtype)1<<__BITS4) ? 0 : __BITS4) \ + : (__xr < ((UWtype)1<<3*__BITS4) ? 2*__BITS4 : 3*__BITS4); \ + } \ + else \ + { \ + for (__a = W_TYPE_SIZE - 8; __a > 0; __a -= 8) \ + if (((__xr >> __a) & 0xff) != 0) \ + break; \ + } \ + \ + (count) = W_TYPE_SIZE - (__clz_tab[__xr >> __a] + __a); \ + } while (0) +#define COUNT_LEADING_ZEROS_0 W_TYPE_SIZE +#endif + +#if !defined (count_trailing_zeros) +/* Define count_trailing_zeros using count_leading_zeros. The latter might be + defined in asm, but if it is not, the C version above is good enough. */ +#define count_trailing_zeros(count, x) \ + do { \ + UWtype __ctz_x = (x); \ + UWtype __ctz_c; \ + count_leading_zeros (__ctz_c, __ctz_x & -__ctz_x); \ + (count) = W_TYPE_SIZE - 1 - __ctz_c; \ + } while (0) +#endif + +#ifndef UDIV_NEEDS_NORMALIZATION +#define UDIV_NEEDS_NORMALIZATION 0 +#endif diff --git a/include/vtv-change-permission.h b/include/vtv-change-permission.h new file mode 100644 index 0000000..1adcb97 --- /dev/null +++ b/include/vtv-change-permission.h @@ -0,0 +1,55 @@ +/* Copyright (C) 2013 + Free Software Foundation + + This file is part of GCC. + + modify it under the terms of the GNU Library General Public License + as published by the Free Software Foundation; either version 2, or + (at your option) any later version. + + In addition to the permissions in the GNU Library General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file into + combinations with other programs, and to distribute those + combinations without any restriction coming from the use of this + file. (The Library Public License restrictions do apply in other + respects; for example, they cover modification of the file, and + distribution when not linked into a combined executable.) + + 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ + + +#ifndef __VTV_H__ +#define __VTV_H__ + +/* We could have used an enumeration here but it just makes it more + difficult for the compiler to generate a call to this. These are + used as arguments to the function __VLTChangePermission, declared + below. */ +#define __VLTP_READ_ONLY 0 +#define __VLTP_READ_WRITE 1 + +#ifdef __cplusplus +extern "C" void __VLTChangePermission (int); +#else +extern void __VLTChangePermission (int); +#endif + +#ifdef BIG_PAGE_SIZE +/* TODO - Replace '4096' below with correct big page size. */ +#define VTV_PAGE_SIZE 4096 +#else +#define VTV_PAGE_SIZE 4096 +#endif + + + +#endif /* __VTV_H__ */ diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 73b5c29..d9a208b 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,198 @@ +2014-04-17 Jakub Jelinek + + PR sanitizer/56781 + * maint-tool: Also emit rule for noasan/ subdirectory. + * configure.ac (NOASANFLAG): Set and substitute. + * Makefile.in: Regenerated. + (NOASANFLAG): Set. + (all, $(TARGETLIB), mostlyclean): Handle noasan subdir like pic + subdir. + (stamp-noasandir): New goal. + * configure: Regenerated. + +2014-04-01 Richard Biener + + * simple-object.c (simple_object_internal_write): Handle + EINTR and short writes. + +2014-03-28 Richard Biener + + * simple-object.c (simple_object_internal_read): Handle + EINTR and short reads. + +2014-03-13 Uros Bizjak + + * regex.c (bzero) [!_LIBC]: Define without coma expression. + (regerror): Cast the call to memcpy to (void) to avoid unused + value warnings. + +2014-01-28 Thomas Schwinge + + * cp-demangle.c (d_demangle_callback): Put an abort call in place, + to help the compiler. + +2014-01-21 Tom Tromey + + * _doprint.c (checkit): Use stdarg, not VA_* macros. + * asprintf.c (asprintf): Use stdarg, not VA_* macros. + * concat.c (concat_length, concat_copy, concat_copy2, concat) + (reconcat): Use stdarg, not VA_* macros. + * snprintf.c (snprintf): Use stdarg, not VA_* macros. + * vasprintf.c (checkit): Use stdarg, not VA_* macros. + * vsnprintf.c (checkit): Use stdarg, not VA_* macros. + +2014-01-06 Mike Frysinger + + PR other/56780 + * configure.ac: Delete target_header_dir assignment. + * configure: Regenerated. + +2014-01-06 Gary Benson + + * cp-demangle.c (struct d_print_info): New fields + next_saved_scope, copy_templates, next_copy_template and + num_copy_templates. + (d_count_templates): New function. + (d_print_init): New parameter "dc". + Estimate numbers of templates and scopes required. + (d_print_free): Removed function. + (cplus_demangle_print_callback): Allocate stack for + templates and scopes. Removed call to d_print_free. + (d_copy_templates): Removed function. + (d_save_scope): New function. + (d_get_saved_scope): Likewise. + (d_print_comp): Replace state saving/restoring code with + calls to d_save_scope and d_get_saved_scope. + +2013-12-23 Bill Maddox + + * cp-demangle.c (cplus_demangle_fill_ctor,cplus_demangle_fill_dtor): + Handle unified ctor/dtor. + (d_ctor_dtor_name): Handle unified ctor/dtor. + +2013-11-22 Cary Coutant + + PR other/59195 + * cp-demangle.c (struct d_info_checkpoint): New struct. + (struct d_print_info): Add current_template field. + (d_operator_name): Set flag when processing a conversion + operator. + (cplus_demangle_type): When processing for + a conversion operator, backtrack if necessary. + (d_expression_1): Renamed from d_expression. + (d_expression): New wrapper around d_expression_1. + (d_checkpoint): New function. + (d_backtrack): New function. + (d_print_init): Initialize current_template. + (d_print_comp): Set current_template. + (d_print_cast): Put current_template in scope for + printing conversion operator name. + (cplus_demangle_init_info): Initialize is_expression and + is_conversion. + * cp-demangle.h (struct d_info): Add is_expression and + is_conversion fields. + * testsuite/demangle-expected: New test cases. + +2013-11-15 Andreas Schwab + + * configure: Regenerate. + +2013-11-12 Uros Bizjak + + * cp-demangle.c (d_copy_templates): Cast result of malloc + to (struct d_print_template *). + (d_print_comp): Cast result of realloc to (struct d_saved scope *). + +2013-10-29 Marc Glisse + + PR tree-optimization/58689 + * concat.c: Remove note about xmalloc. + +2013-10-27 Gerald Pfeifer + + * testsuite/test-demangle.c: Include unistd.h. + +2013-10-25 Gary Benson + + * cp-demangle.c (struct d_saved_scope): New structure. + (struct d_print_info): New fields saved_scopes and + num_saved_scopes. + (d_print_init): Initialize the above. + (d_print_free): New function. + (cplus_demangle_print_callback): Call the above. + (d_copy_templates): New function. + (d_print_comp): New variables saved_templates and + need_template_restore. + [DEMANGLE_COMPONENT_REFERENCE, DEMANGLE_COMPONENT_RVALUE_REFERENCE]: + Capture scope the first time the component is traversed, and use the + captured scope for subsequent traversals. + * testsuite/demangle-expected: Add regression test. + +2013-10-23 Gerald Pfeifer + + * testsuite/test-expandargv.c: Include unistd.h. + +2013-10-15 David Malcolm + + * configure.ac: If --enable-host-shared, use -fPIC. + * configure: Regenerate. + +2013-10-11 Paul Pluzhnikov + + * cp-demangle.c (d_name): Demangle local-source-names. + * testsuite/demangle-expected: New test. + +2013-09-10 Paolo Carlini + + PR bootstrap/58386 + Revert: + + 2013-09-10 Gary Benson + + * cp-demangle.c: Include hashtab.h. + (struct d_print_info): New field saved_scopes. + (d_print_init): Initialize the above. + (d_print_free): New function. + (cplus_demangle_print_callback): Call the above. + (struct d_saved_scope): New structure. + (d_store_scope): New function. + (d_free_scope) Likewise. + (d_restore_scope) Likewise. + (d_hash_saved_scope) Likewise. + (d_equal_saved_scope) Likewise. + (d_print_comp): New variable saved_scope. + [DEMANGLE_COMPONENT_REFERENCE, + DEMANGLE_COMPONENT_RVALUE_REFERENCE]: Capture scope the first + time the component is traversed, and use the captured scope for + subsequent traversals. + * testsuite/demangle-expected: Add regression test. + +2013-09-10 Gary Benson + + * cp-demangle.c: Include hashtab.h. + (struct d_print_info): New field saved_scopes. + (d_print_init): Initialize the above. + (d_print_free): New function. + (cplus_demangle_print_callback): Call the above. + (struct d_saved_scope): New structure. + (d_store_scope): New function. + (d_free_scope) Likewise. + (d_restore_scope) Likewise. + (d_hash_saved_scope) Likewise. + (d_equal_saved_scope) Likewise. + (d_print_comp): New variable saved_scope. + [DEMANGLE_COMPONENT_REFERENCE, + DEMANGLE_COMPONENT_RVALUE_REFERENCE]: Capture scope the first + time the component is traversed, and use the captured scope for + subsequent traversals. + * testsuite/demangle-expected: Add regression test. + +2013-08-20 Alan Modra + + * floatformat.c (floatformat_ibm_long_double): Rename to.. + (floatformat_ibm_long_double_big): ..this. + (floatformat_ibm_long_double_little): New. + 2013-07-09 Tristan Gingold * makefile.vms (OBJS): Add dwarfnames.obj @@ -22,7 +217,7 @@ * hashtab.c (hash_pointer): Remove conditional and avoid unexecuted shift equal to wordsize. -2013-04-22 Andi Kleen +2013-04-22 Andi Kleen * hashtab.c (hash_pointer): Move to end of file and reimplement. @@ -596,12 +791,12 @@ * aclocal.m4 (AC_LANG_FUNC_LINK_TRY(C)): Delete. * configure: Regenerate. -2010-10-07 Andi Kleen +2010-10-07 Andi Kleen * configure: Regenerate. * configure.ac: Turn PR_SET_NAME check into link check. -2010-10-06 Andi Kleen +2010-10-06 Andi Kleen * Makefile.in (CFILES): Add setproctitle. (CONFIGURED_OFILES): Add setproctitle. diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in index 75ff82d..44e340f 100644 --- a/libiberty/Makefile.in +++ b/libiberty/Makefile.in @@ -2,8 +2,8 @@ # Originally written by K. Richard Pixley . # # Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, -# 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 -# Free Software Foundation +# 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, +# 2012, 2014 Free Software Foundation # # This file is part of the libiberty library. # Libiberty is free software; you can redistribute it and/or @@ -62,6 +62,7 @@ MAKEINFO = @MAKEINFO@ PERL = @PERL@ PICFLAG = @PICFLAG@ +NOASANFLAG = @NOASANFLAG@ MAKEOVERRIDES = @@ -101,7 +102,7 @@ FLAGS_TO_PASS = \ SUBDIRS = testsuite # FIXME: add @BUILD_INFO@ once we're sure it works for everyone. -all: stamp-picdir $(TARGETLIB) required-list all-subdir +all: stamp-picdir stamp-noasandir $(TARGETLIB) required-list all-subdir @: $(MAKE) ; $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all .PHONY: check installcheck @@ -241,7 +242,7 @@ INSTALLED_HEADERS = \ $(INCDIR)/timeval-utils.h $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS) - -rm -f $(TARGETLIB) pic/$(TARGETLIB) + -rm -f $(TARGETLIB) pic/$(TARGETLIB) noasan/$(TARGETLIB) $(AR) $(AR_FLAGS) $(TARGETLIB) \ $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS) $(RANLIB) $(TARGETLIB) @@ -251,6 +252,13 @@ $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS) $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \ $(RANLIB) $(TARGETLIB); \ cd ..; \ + else true; fi; \ + if [ x"$(NOASANFLAG)" != x ]; then \ + cd noasan; \ + $(AR) $(AR_FLAGS) $(TARGETLIB) \ + $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \ + $(RANLIB) $(TARGETLIB); \ + cd ..; \ else true; fi $(TESTLIB): $(REQUIRED_OFILES) $(CONFIGURED_OFILES) @@ -389,6 +397,12 @@ stamp-picdir: else true; fi touch stamp-picdir +stamp-noasandir: + if [ x"$(NOASANFLAG)" != x ] && [ ! -d noasan ]; then \ + mkdir noasan; \ + else true; fi + touch stamp-noasandir + .PHONY: all etags tags ls clean stage1 stage2 etags tags: TAGS etags-subdir @@ -426,9 +440,9 @@ maint-deps : # Cleaning has to be done carefully to ensure that we don't clean our SUBDIRS # multiple times, hence our explicit recursion with an empty SUBDIRS. mostlyclean: mostlyclean-subdir - -rm -rf *.$(objext) pic core errs \#* *.E a.out + -rm -rf *.$(objext) pic noasan core errs \#* *.E a.out -rm -f errors dummy config.h stamp-* - -rm -f $(CONFIG_H) stamp-picdir + -rm -f $(CONFIG_H) stamp-picdir stamp-noasandir -rm -f libiberty.aux libiberty.cp libiberty.cps libiberty.fn libiberty.ky -rm -f libiberty.log libiberty.tmp libiberty.tps libiberty.pg -rm -f libiberty.pgs libiberty.toc libiberty.tp libiberty.tpl libiberty.vr @@ -485,8 +499,8 @@ maintainer-clean-subdir: config.h cd $$dir && $(MAKE) $(FLAGS_TO_PASS) $$target; \ done -$(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS): stamp-picdir -$(CONFIGURED_OFILES): stamp-picdir +$(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS): stamp-picdir stamp-noasandir +$(CONFIGURED_OFILES): stamp-picdir stamp-noasandir # Don't export variables to the environment, in order to not confuse # configure. @@ -500,6 +514,9 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/_doprnt.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/_doprnt.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/_doprnt.c $(OUTPUT_OPTION) ./alloca.$(objext): $(srcdir)/alloca.c config.h $(INCDIR)/ansidecl.h \ @@ -507,6 +524,9 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/alloca.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/alloca.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/alloca.c $(OUTPUT_OPTION) ./argv.$(objext): $(srcdir)/argv.c config.h $(INCDIR)/ansidecl.h \ @@ -514,6 +534,9 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/argv.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/argv.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/argv.c $(OUTPUT_OPTION) ./asprintf.$(objext): $(srcdir)/asprintf.c config.h $(INCDIR)/ansidecl.h \ @@ -521,12 +544,18 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/asprintf.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/asprintf.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/asprintf.c $(OUTPUT_OPTION) ./atexit.$(objext): $(srcdir)/atexit.c config.h if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/atexit.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/atexit.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/atexit.c $(OUTPUT_OPTION) ./basename.$(objext): $(srcdir)/basename.c config.h $(INCDIR)/ansidecl.h \ @@ -534,36 +563,54 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/basename.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/basename.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/basename.c $(OUTPUT_OPTION) ./bcmp.$(objext): $(srcdir)/bcmp.c if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/bcmp.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/bcmp.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/bcmp.c $(OUTPUT_OPTION) ./bcopy.$(objext): $(srcdir)/bcopy.c if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/bcopy.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/bcopy.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/bcopy.c $(OUTPUT_OPTION) ./bsearch.$(objext): $(srcdir)/bsearch.c config.h $(INCDIR)/ansidecl.h if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/bsearch.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/bsearch.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/bsearch.c $(OUTPUT_OPTION) ./bzero.$(objext): $(srcdir)/bzero.c if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/bzero.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/bzero.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/bzero.c $(OUTPUT_OPTION) ./calloc.$(objext): $(srcdir)/calloc.c $(INCDIR)/ansidecl.h if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/calloc.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/calloc.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/calloc.c $(OUTPUT_OPTION) ./choose-temp.$(objext): $(srcdir)/choose-temp.c config.h $(INCDIR)/ansidecl.h \ @@ -571,12 +618,18 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/choose-temp.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/choose-temp.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/choose-temp.c $(OUTPUT_OPTION) ./clock.$(objext): $(srcdir)/clock.c config.h if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/clock.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/clock.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/clock.c $(OUTPUT_OPTION) ./concat.$(objext): $(srcdir)/concat.c config.h $(INCDIR)/ansidecl.h \ @@ -584,12 +637,18 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/concat.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/concat.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/concat.c $(OUTPUT_OPTION) ./copysign.$(objext): $(srcdir)/copysign.c $(INCDIR)/ansidecl.h if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/copysign.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/copysign.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/copysign.c $(OUTPUT_OPTION) ./cp-demangle.$(objext): $(srcdir)/cp-demangle.c config.h $(INCDIR)/ansidecl.h \ @@ -598,6 +657,9 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/cp-demangle.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/cp-demangle.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/cp-demangle.c $(OUTPUT_OPTION) ./cp-demint.$(objext): $(srcdir)/cp-demint.c config.h $(INCDIR)/ansidecl.h \ @@ -606,6 +668,9 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/cp-demint.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/cp-demint.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/cp-demint.c $(OUTPUT_OPTION) ./cplus-dem.$(objext): $(srcdir)/cplus-dem.c config.h $(INCDIR)/ansidecl.h \ @@ -614,6 +679,9 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/cplus-dem.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/cplus-dem.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/cplus-dem.c $(OUTPUT_OPTION) ./crc32.$(objext): $(srcdir)/crc32.c config.h $(INCDIR)/ansidecl.h \ @@ -621,6 +689,9 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/crc32.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/crc32.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/crc32.c $(OUTPUT_OPTION) ./dwarfnames.$(objext): $(srcdir)/dwarfnames.c $(INCDIR)/dwarf2.def \ @@ -628,6 +699,9 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/dwarfnames.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/dwarfnames.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/dwarfnames.c $(OUTPUT_OPTION) ./dyn-string.$(objext): $(srcdir)/dyn-string.c config.h $(INCDIR)/ansidecl.h \ @@ -635,6 +709,9 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/dyn-string.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/dyn-string.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/dyn-string.c $(OUTPUT_OPTION) ./fdmatch.$(objext): $(srcdir)/fdmatch.c config.h $(INCDIR)/ansidecl.h \ @@ -642,12 +719,18 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/fdmatch.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/fdmatch.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/fdmatch.c $(OUTPUT_OPTION) ./ffs.$(objext): $(srcdir)/ffs.c if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/ffs.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/ffs.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/ffs.c $(OUTPUT_OPTION) ./fibheap.$(objext): $(srcdir)/fibheap.c config.h $(INCDIR)/ansidecl.h \ @@ -655,6 +738,9 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/fibheap.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/fibheap.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/fibheap.c $(OUTPUT_OPTION) ./filename_cmp.$(objext): $(srcdir)/filename_cmp.c config.h $(INCDIR)/ansidecl.h \ @@ -663,6 +749,9 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/filename_cmp.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/filename_cmp.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/filename_cmp.c $(OUTPUT_OPTION) ./floatformat.$(objext): $(srcdir)/floatformat.c config.h $(INCDIR)/ansidecl.h \ @@ -670,6 +759,9 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/floatformat.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/floatformat.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/floatformat.c $(OUTPUT_OPTION) ./fnmatch.$(objext): $(srcdir)/fnmatch.c config.h $(INCDIR)/fnmatch.h \ @@ -677,6 +769,9 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/fnmatch.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/fnmatch.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/fnmatch.c $(OUTPUT_OPTION) ./fopen_unlocked.$(objext): $(srcdir)/fopen_unlocked.c config.h \ @@ -684,12 +779,18 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/fopen_unlocked.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/fopen_unlocked.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/fopen_unlocked.c $(OUTPUT_OPTION) ./getcwd.$(objext): $(srcdir)/getcwd.c config.h if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/getcwd.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/getcwd.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/getcwd.c $(OUTPUT_OPTION) ./getopt.$(objext): $(srcdir)/getopt.c config.h $(INCDIR)/ansidecl.h \ @@ -697,18 +798,27 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/getopt.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/getopt.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/getopt.c $(OUTPUT_OPTION) ./getopt1.$(objext): $(srcdir)/getopt1.c config.h $(INCDIR)/getopt.h if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/getopt1.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/getopt1.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/getopt1.c $(OUTPUT_OPTION) ./getpagesize.$(objext): $(srcdir)/getpagesize.c config.h if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/getpagesize.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/getpagesize.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/getpagesize.c $(OUTPUT_OPTION) ./getpwd.$(objext): $(srcdir)/getpwd.c config.h $(INCDIR)/ansidecl.h \ @@ -716,6 +826,9 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/getpwd.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/getpwd.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/getpwd.c $(OUTPUT_OPTION) ./getruntime.$(objext): $(srcdir)/getruntime.c config.h $(INCDIR)/ansidecl.h \ @@ -723,6 +836,9 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/getruntime.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/getruntime.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/getruntime.c $(OUTPUT_OPTION) ./gettimeofday.$(objext): $(srcdir)/gettimeofday.c config.h $(INCDIR)/ansidecl.h \ @@ -730,6 +846,9 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/gettimeofday.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/gettimeofday.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/gettimeofday.c $(OUTPUT_OPTION) ./hashtab.$(objext): $(srcdir)/hashtab.c config.h $(INCDIR)/ansidecl.h \ @@ -737,6 +856,9 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/hashtab.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/hashtab.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/hashtab.c $(OUTPUT_OPTION) ./hex.$(objext): $(srcdir)/hex.c config.h $(INCDIR)/ansidecl.h \ @@ -744,18 +866,27 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/hex.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/hex.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/hex.c $(OUTPUT_OPTION) ./index.$(objext): $(srcdir)/index.c if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/index.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/index.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/index.c $(OUTPUT_OPTION) ./insque.$(objext): $(srcdir)/insque.c if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/insque.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/insque.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/insque.c $(OUTPUT_OPTION) ./lbasename.$(objext): $(srcdir)/lbasename.c config.h $(INCDIR)/ansidecl.h \ @@ -764,6 +895,9 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/lbasename.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/lbasename.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/lbasename.c $(OUTPUT_OPTION) ./lrealpath.$(objext): $(srcdir)/lrealpath.c config.h $(INCDIR)/ansidecl.h \ @@ -771,6 +905,9 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/lrealpath.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/lrealpath.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/lrealpath.c $(OUTPUT_OPTION) ./make-relative-prefix.$(objext): $(srcdir)/make-relative-prefix.c config.h \ @@ -778,6 +915,9 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/make-relative-prefix.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/make-relative-prefix.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/make-relative-prefix.c $(OUTPUT_OPTION) ./make-temp-file.$(objext): $(srcdir)/make-temp-file.c config.h \ @@ -785,66 +925,99 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/make-temp-file.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/make-temp-file.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/make-temp-file.c $(OUTPUT_OPTION) ./md5.$(objext): $(srcdir)/md5.c config.h $(INCDIR)/ansidecl.h $(INCDIR)/md5.h if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/md5.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/md5.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/md5.c $(OUTPUT_OPTION) ./memchr.$(objext): $(srcdir)/memchr.c $(INCDIR)/ansidecl.h if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/memchr.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/memchr.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/memchr.c $(OUTPUT_OPTION) ./memcmp.$(objext): $(srcdir)/memcmp.c $(INCDIR)/ansidecl.h if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/memcmp.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/memcmp.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/memcmp.c $(OUTPUT_OPTION) ./memcpy.$(objext): $(srcdir)/memcpy.c $(INCDIR)/ansidecl.h if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/memcpy.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/memcpy.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/memcpy.c $(OUTPUT_OPTION) ./memmem.$(objext): $(srcdir)/memmem.c config.h if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/memmem.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/memmem.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/memmem.c $(OUTPUT_OPTION) ./memmove.$(objext): $(srcdir)/memmove.c $(INCDIR)/ansidecl.h if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/memmove.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/memmove.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/memmove.c $(OUTPUT_OPTION) ./mempcpy.$(objext): $(srcdir)/mempcpy.c $(INCDIR)/ansidecl.h if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/mempcpy.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/mempcpy.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/mempcpy.c $(OUTPUT_OPTION) ./memset.$(objext): $(srcdir)/memset.c $(INCDIR)/ansidecl.h if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/memset.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/memset.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/memset.c $(OUTPUT_OPTION) ./mkstemps.$(objext): $(srcdir)/mkstemps.c config.h $(INCDIR)/ansidecl.h if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/mkstemps.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/mkstemps.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/mkstemps.c $(OUTPUT_OPTION) ./msdos.$(objext): $(srcdir)/msdos.c if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/msdos.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/msdos.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/msdos.c $(OUTPUT_OPTION) ./objalloc.$(objext): $(srcdir)/objalloc.c config.h $(INCDIR)/ansidecl.h \ @@ -852,12 +1025,18 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/objalloc.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/objalloc.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/objalloc.c $(OUTPUT_OPTION) ./obstack.$(objext): $(srcdir)/obstack.c config.h $(INCDIR)/obstack.h if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/obstack.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/obstack.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/obstack.c $(OUTPUT_OPTION) ./partition.$(objext): $(srcdir)/partition.c config.h $(INCDIR)/ansidecl.h \ @@ -865,6 +1044,9 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/partition.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/partition.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/partition.c $(OUTPUT_OPTION) ./pex-common.$(objext): $(srcdir)/pex-common.c config.h $(INCDIR)/ansidecl.h \ @@ -872,6 +1054,9 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/pex-common.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/pex-common.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/pex-common.c $(OUTPUT_OPTION) ./pex-djgpp.$(objext): $(srcdir)/pex-djgpp.c config.h $(INCDIR)/ansidecl.h \ @@ -879,6 +1064,9 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/pex-djgpp.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/pex-djgpp.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/pex-djgpp.c $(OUTPUT_OPTION) ./pex-msdos.$(objext): $(srcdir)/pex-msdos.c config.h $(INCDIR)/ansidecl.h \ @@ -887,6 +1075,9 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/pex-msdos.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/pex-msdos.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/pex-msdos.c $(OUTPUT_OPTION) ./pex-one.$(objext): $(srcdir)/pex-one.c config.h $(INCDIR)/ansidecl.h \ @@ -894,6 +1085,9 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/pex-one.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/pex-one.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/pex-one.c $(OUTPUT_OPTION) ./pex-unix.$(objext): $(srcdir)/pex-unix.c config.h $(INCDIR)/ansidecl.h \ @@ -901,6 +1095,9 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/pex-unix.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/pex-unix.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/pex-unix.c $(OUTPUT_OPTION) ./pex-win32.$(objext): $(srcdir)/pex-win32.c config.h $(INCDIR)/ansidecl.h \ @@ -908,6 +1105,9 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/pex-win32.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/pex-win32.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/pex-win32.c $(OUTPUT_OPTION) ./pexecute.$(objext): $(srcdir)/pexecute.c config.h $(INCDIR)/ansidecl.h \ @@ -915,6 +1115,9 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/pexecute.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/pexecute.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/pexecute.c $(OUTPUT_OPTION) ./physmem.$(objext): $(srcdir)/physmem.c config.h $(INCDIR)/ansidecl.h \ @@ -922,18 +1125,27 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/physmem.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/physmem.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/physmem.c $(OUTPUT_OPTION) ./putenv.$(objext): $(srcdir)/putenv.c config.h $(INCDIR)/ansidecl.h if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/putenv.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/putenv.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/putenv.c $(OUTPUT_OPTION) ./random.$(objext): $(srcdir)/random.c $(INCDIR)/ansidecl.h if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/random.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/random.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/random.c $(OUTPUT_OPTION) ./regex.$(objext): $(srcdir)/regex.c config.h $(INCDIR)/ansidecl.h \ @@ -941,18 +1153,27 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/regex.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/regex.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/regex.c $(OUTPUT_OPTION) ./rename.$(objext): $(srcdir)/rename.c config.h $(INCDIR)/ansidecl.h if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/rename.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/rename.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/rename.c $(OUTPUT_OPTION) ./rindex.$(objext): $(srcdir)/rindex.c if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/rindex.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/rindex.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/rindex.c $(OUTPUT_OPTION) ./safe-ctype.$(objext): $(srcdir)/safe-ctype.c $(INCDIR)/ansidecl.h \ @@ -960,30 +1181,45 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/safe-ctype.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/safe-ctype.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/safe-ctype.c $(OUTPUT_OPTION) ./setenv.$(objext): $(srcdir)/setenv.c config.h $(INCDIR)/ansidecl.h if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/setenv.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/setenv.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/setenv.c $(OUTPUT_OPTION) ./setproctitle.$(objext): $(srcdir)/setproctitle.c config.h $(INCDIR)/ansidecl.h if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/setproctitle.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/setproctitle.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/setproctitle.c $(OUTPUT_OPTION) ./sha1.$(objext): $(srcdir)/sha1.c config.h $(INCDIR)/ansidecl.h $(INCDIR)/sha1.h if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/sha1.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/sha1.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/sha1.c $(OUTPUT_OPTION) ./sigsetmask.$(objext): $(srcdir)/sigsetmask.c $(INCDIR)/ansidecl.h if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/sigsetmask.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/sigsetmask.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/sigsetmask.c $(OUTPUT_OPTION) ./simple-object-coff.$(objext): $(srcdir)/simple-object-coff.c config.h \ @@ -992,6 +1228,9 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/simple-object-coff.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/simple-object-coff.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/simple-object-coff.c $(OUTPUT_OPTION) ./simple-object-elf.$(objext): $(srcdir)/simple-object-elf.c config.h \ @@ -1000,6 +1239,9 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/simple-object-elf.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/simple-object-elf.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/simple-object-elf.c $(OUTPUT_OPTION) ./simple-object-mach-o.$(objext): $(srcdir)/simple-object-mach-o.c config.h \ @@ -1008,6 +1250,9 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/simple-object-mach-o.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/simple-object-mach-o.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/simple-object-mach-o.c $(OUTPUT_OPTION) ./simple-object-xcoff.$(objext): $(srcdir)/simple-object-xcoff.c config.h \ @@ -1016,6 +1261,9 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/simple-object-xcoff.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/simple-object-xcoff.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/simple-object-xcoff.c $(OUTPUT_OPTION) ./simple-object.$(objext): $(srcdir)/simple-object.c config.h \ @@ -1024,12 +1272,18 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/simple-object.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/simple-object.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/simple-object.c $(OUTPUT_OPTION) ./snprintf.$(objext): $(srcdir)/snprintf.c $(INCDIR)/ansidecl.h if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/snprintf.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/snprintf.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/snprintf.c $(OUTPUT_OPTION) ./sort.$(objext): $(srcdir)/sort.c config.h $(INCDIR)/ansidecl.h \ @@ -1037,6 +1291,9 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/sort.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/sort.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/sort.c $(OUTPUT_OPTION) ./spaces.$(objext): $(srcdir)/spaces.c config.h $(INCDIR)/ansidecl.h \ @@ -1044,6 +1301,9 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/spaces.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/spaces.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/spaces.c $(OUTPUT_OPTION) ./splay-tree.$(objext): $(srcdir)/splay-tree.c config.h $(INCDIR)/ansidecl.h \ @@ -1051,42 +1311,63 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/splay-tree.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/splay-tree.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/splay-tree.c $(OUTPUT_OPTION) ./stack-limit.$(objext): $(srcdir)/stack-limit.c config.h $(INCDIR)/ansidecl.h if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/stack-limit.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/stack-limit.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/stack-limit.c $(OUTPUT_OPTION) ./stpcpy.$(objext): $(srcdir)/stpcpy.c $(INCDIR)/ansidecl.h if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/stpcpy.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/stpcpy.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/stpcpy.c $(OUTPUT_OPTION) ./stpncpy.$(objext): $(srcdir)/stpncpy.c $(INCDIR)/ansidecl.h if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/stpncpy.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/stpncpy.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/stpncpy.c $(OUTPUT_OPTION) ./strcasecmp.$(objext): $(srcdir)/strcasecmp.c $(INCDIR)/ansidecl.h if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/strcasecmp.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/strcasecmp.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/strcasecmp.c $(OUTPUT_OPTION) ./strchr.$(objext): $(srcdir)/strchr.c $(INCDIR)/ansidecl.h if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/strchr.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/strchr.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/strchr.c $(OUTPUT_OPTION) ./strdup.$(objext): $(srcdir)/strdup.c $(INCDIR)/ansidecl.h if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/strdup.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/strdup.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/strdup.c $(OUTPUT_OPTION) ./strerror.$(objext): $(srcdir)/strerror.c config.h $(INCDIR)/ansidecl.h \ @@ -1094,36 +1375,54 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/strerror.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/strerror.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/strerror.c $(OUTPUT_OPTION) ./strncasecmp.$(objext): $(srcdir)/strncasecmp.c $(INCDIR)/ansidecl.h if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/strncasecmp.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/strncasecmp.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/strncasecmp.c $(OUTPUT_OPTION) ./strncmp.$(objext): $(srcdir)/strncmp.c $(INCDIR)/ansidecl.h if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/strncmp.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/strncmp.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/strncmp.c $(OUTPUT_OPTION) ./strndup.$(objext): $(srcdir)/strndup.c $(INCDIR)/ansidecl.h if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/strndup.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/strndup.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/strndup.c $(OUTPUT_OPTION) ./strnlen.$(objext): $(srcdir)/strnlen.c config.h if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/strnlen.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/strnlen.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/strnlen.c $(OUTPUT_OPTION) ./strrchr.$(objext): $(srcdir)/strrchr.c $(INCDIR)/ansidecl.h if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/strrchr.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/strrchr.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/strrchr.c $(OUTPUT_OPTION) ./strsignal.$(objext): $(srcdir)/strsignal.c config.h $(INCDIR)/ansidecl.h \ @@ -1131,12 +1430,18 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/strsignal.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/strsignal.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/strsignal.c $(OUTPUT_OPTION) ./strstr.$(objext): $(srcdir)/strstr.c if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/strstr.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/strstr.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/strstr.c $(OUTPUT_OPTION) ./strtod.$(objext): $(srcdir)/strtod.c $(INCDIR)/ansidecl.h \ @@ -1144,12 +1449,18 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/strtod.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/strtod.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/strtod.c $(OUTPUT_OPTION) ./strtol.$(objext): $(srcdir)/strtol.c config.h $(INCDIR)/safe-ctype.h if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/strtol.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/strtol.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/strtol.c $(OUTPUT_OPTION) ./strtoul.$(objext): $(srcdir)/strtoul.c config.h $(INCDIR)/ansidecl.h \ @@ -1157,6 +1468,9 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/strtoul.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/strtoul.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/strtoul.c $(OUTPUT_OPTION) ./strverscmp.$(objext): $(srcdir)/strverscmp.c $(INCDIR)/ansidecl.h \ @@ -1164,6 +1478,9 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/strverscmp.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/strverscmp.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/strverscmp.c $(OUTPUT_OPTION) ./timeval-utils.$(objext): $(srcdir)/timeval-utils.c config.h \ @@ -1171,12 +1488,18 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/timeval-utils.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/timeval-utils.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/timeval-utils.c $(OUTPUT_OPTION) ./tmpnam.$(objext): $(srcdir)/tmpnam.c if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/tmpnam.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/tmpnam.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/tmpnam.c $(OUTPUT_OPTION) ./unlink-if-ordinary.$(objext): $(srcdir)/unlink-if-ordinary.c config.h \ @@ -1184,6 +1507,9 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/unlink-if-ordinary.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/unlink-if-ordinary.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/unlink-if-ordinary.c $(OUTPUT_OPTION) ./vasprintf.$(objext): $(srcdir)/vasprintf.c config.h $(INCDIR)/ansidecl.h \ @@ -1191,24 +1517,36 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/vasprintf.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/vasprintf.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/vasprintf.c $(OUTPUT_OPTION) ./vfork.$(objext): $(srcdir)/vfork.c $(INCDIR)/ansidecl.h if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/vfork.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/vfork.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/vfork.c $(OUTPUT_OPTION) ./vfprintf.$(objext): $(srcdir)/vfprintf.c $(INCDIR)/ansidecl.h if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/vfprintf.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/vfprintf.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/vfprintf.c $(OUTPUT_OPTION) ./vprintf.$(objext): $(srcdir)/vprintf.c $(INCDIR)/ansidecl.h if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/vprintf.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/vprintf.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/vprintf.c $(OUTPUT_OPTION) ./vsnprintf.$(objext): $(srcdir)/vsnprintf.c config.h $(INCDIR)/ansidecl.h \ @@ -1216,18 +1554,27 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/vsnprintf.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/vsnprintf.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/vsnprintf.c $(OUTPUT_OPTION) ./vsprintf.$(objext): $(srcdir)/vsprintf.c $(INCDIR)/ansidecl.h if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/vsprintf.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/vsprintf.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/vsprintf.c $(OUTPUT_OPTION) ./waitpid.$(objext): $(srcdir)/waitpid.c config.h $(INCDIR)/ansidecl.h if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/waitpid.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/waitpid.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/waitpid.c $(OUTPUT_OPTION) ./xatexit.$(objext): $(srcdir)/xatexit.c config.h $(INCDIR)/ansidecl.h \ @@ -1235,6 +1582,9 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/xatexit.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/xatexit.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/xatexit.c $(OUTPUT_OPTION) ./xexit.$(objext): $(srcdir)/xexit.c config.h $(INCDIR)/ansidecl.h \ @@ -1242,6 +1592,9 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/xexit.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/xexit.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/xexit.c $(OUTPUT_OPTION) ./xmalloc.$(objext): $(srcdir)/xmalloc.c config.h $(INCDIR)/ansidecl.h \ @@ -1249,6 +1602,9 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/xmalloc.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/xmalloc.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/xmalloc.c $(OUTPUT_OPTION) ./xmemdup.$(objext): $(srcdir)/xmemdup.c config.h $(INCDIR)/ansidecl.h \ @@ -1256,6 +1612,9 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/xmemdup.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/xmemdup.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/xmemdup.c $(OUTPUT_OPTION) ./xstrdup.$(objext): $(srcdir)/xstrdup.c config.h $(INCDIR)/ansidecl.h \ @@ -1263,6 +1622,9 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/xstrdup.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/xstrdup.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/xstrdup.c $(OUTPUT_OPTION) ./xstrerror.$(objext): $(srcdir)/xstrerror.c config.h $(INCDIR)/ansidecl.h \ @@ -1270,6 +1632,9 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/xstrerror.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/xstrerror.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/xstrerror.c $(OUTPUT_OPTION) ./xstrndup.$(objext): $(srcdir)/xstrndup.c config.h $(INCDIR)/ansidecl.h \ @@ -1277,5 +1642,8 @@ $(CONFIGURED_OFILES): stamp-picdir if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/xstrndup.c -o pic/$@; \ else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/xstrndup.c -o noasan/$@; \ + else true; fi $(COMPILE.c) $(srcdir)/xstrndup.c $(OUTPUT_OPTION) diff --git a/libiberty/_doprnt.c b/libiberty/_doprnt.c index ca97bc8..9723f32 100644 --- a/libiberty/_doprnt.c +++ b/libiberty/_doprnt.c @@ -222,11 +222,11 @@ static int checkit (const char* format, ...) { int result; - VA_OPEN (args, format); - VA_FIXEDARG (args, char *, format); + va_list args; + va_start (args, format); result = _doprnt (format, args, stdout); - VA_CLOSE (args); + va_end (args); return result; } diff --git a/libiberty/asprintf.c b/libiberty/asprintf.c index 3cf5052..961ad4d 100644 --- a/libiberty/asprintf.c +++ b/libiberty/asprintf.c @@ -1,6 +1,6 @@ /* Like sprintf but provides a pointer to malloc'd storage, which must be freed by the caller. - Copyright (C) 1997, 2003 Free Software Foundation, Inc. + Copyright (C) 1997, 2003, 2013 Free Software Foundation, Inc. Contributed by Cygnus Solutions. This file is part of the libiberty library. @@ -47,10 +47,9 @@ int asprintf (char **buf, const char *fmt, ...) { int status; - VA_OPEN (ap, fmt); - VA_FIXEDARG (ap, char **, buf); - VA_FIXEDARG (ap, const char *, fmt); + va_list ap; + va_start (ap, fmt); status = vasprintf (buf, fmt, ap); - VA_CLOSE (ap); + va_end (ap); return status; } diff --git a/libiberty/concat.c b/libiberty/concat.c index 9779d56..7846a19 100644 --- a/libiberty/concat.c +++ b/libiberty/concat.c @@ -1,5 +1,5 @@ /* Concatenate variable number of strings. - Copyright (C) 1991, 1994, 2001, 2011 Free Software Foundation, Inc. + Copyright (C) 1991, 1994, 2001, 2011, 2013 Free Software Foundation, Inc. Written by Fred Fish @ Cygnus Support This file is part of the libiberty library. @@ -25,23 +25,11 @@ Boston, MA 02110-1301, USA. */ @dots{}, @code{NULL}) Concatenate zero or more of strings and return the result in freshly -@code{xmalloc}ed memory. Returns @code{NULL} if insufficient memory is -available. The argument list is terminated by the first @code{NULL} -pointer encountered. Pointers to empty strings are ignored. +@code{xmalloc}ed memory. The argument list is terminated by the first +@code{NULL} pointer encountered. Pointers to empty strings are ignored. @end deftypefn -NOTES - - This function uses xmalloc() which is expected to be a front end - function to malloc() that deals with low memory situations. In - typical use, if malloc() returns NULL then xmalloc() diverts to an - error handler routine which never returns, and thus xmalloc will - never return a NULL pointer. If the client application wishes to - deal with low memory situations itself, it should supply an xmalloc - that just directly invokes malloc and blindly returns whatever - malloc returns. - */ @@ -102,11 +90,11 @@ unsigned long concat_length (const char *first, ...) { unsigned long length; + va_list args; - VA_OPEN (args, first); - VA_FIXEDARG (args, const char *, first); + va_start (args, first); length = vconcat_length (first, args); - VA_CLOSE (args); + va_end (args); return length; } @@ -117,13 +105,12 @@ char * concat_copy (char *dst, const char *first, ...) { char *save_dst; + va_list args; - VA_OPEN (args, first); - VA_FIXEDARG (args, char *, dst); - VA_FIXEDARG (args, const char *, first); + va_start (args, first); vconcat_copy (dst, first, args); save_dst = dst; /* With K&R C, dst goes out of scope here. */ - VA_CLOSE (args); + va_end (args); return save_dst; } @@ -141,10 +128,10 @@ char *libiberty_concat_ptr; char * concat_copy2 (const char *first, ...) { - VA_OPEN (args, first); - VA_FIXEDARG (args, const char *, first); + va_list args; + va_start (args, first); vconcat_copy (libiberty_concat_ptr, first, args); - VA_CLOSE (args); + va_end (args); return libiberty_concat_ptr; } @@ -153,18 +140,17 @@ char * concat (const char *first, ...) { char *newstr; + va_list args; /* First compute the size of the result and get sufficient memory. */ - VA_OPEN (args, first); - VA_FIXEDARG (args, const char *, first); + va_start (args, first); newstr = XNEWVEC (char, vconcat_length (first, args) + 1); - VA_CLOSE (args); + va_end (args); /* Now copy the individual pieces to the result string. */ - VA_OPEN (args, first); - VA_FIXEDARG (args, const char *, first); + va_start (args, first); vconcat_copy (newstr, first, args); - VA_CLOSE (args); + va_end (args); return newstr; } @@ -191,22 +177,19 @@ char * reconcat (char *optr, const char *first, ...) { char *newstr; + va_list args; /* First compute the size of the result and get sufficient memory. */ - VA_OPEN (args, first); - VA_FIXEDARG (args, char *, optr); - VA_FIXEDARG (args, const char *, first); + va_start (args, first); newstr = XNEWVEC (char, vconcat_length (first, args) + 1); - VA_CLOSE (args); + va_end (args); /* Now copy the individual pieces to the result string. */ - VA_OPEN (args, first); - VA_FIXEDARG (args, char *, optr); - VA_FIXEDARG (args, const char *, first); + va_start (args, first); vconcat_copy (newstr, first, args); if (optr) /* Done before VA_CLOSE so optr stays in scope for K&R C. */ free (optr); - VA_CLOSE (args); + va_end (args); return newstr; } diff --git a/libiberty/configure b/libiberty/configure index e601ccd..96feaed 100755 --- a/libiberty/configure +++ b/libiberty/configure @@ -594,6 +594,7 @@ pexecute target_header_dir CHECK LIBOBJS +NOASANFLAG PICFLAG INSTALL_DATA INSTALL_SCRIPT @@ -4927,9 +4928,6 @@ case "${host}" in i[34567]86-*-* | x86_64-*-*) PICFLAG=-fpic ;; - m68k-*-*) - PICFLAG=-fpic - ;; # FIXME: Override -fPIC default in libgcc only? sh-*-linux* | sh[2346lbe]*-*-linux*) PICFLAG=-fpic @@ -4963,11 +4961,23 @@ case "${enable_shared}" in "") shared=no ;; *) shared=yes ;; esac + +# ...unless --enable-host-shared was passed from top-level config: +if [ "${enable_host_shared}" = "yes" ]; then + shared=yes +fi + if [ "${shared}" != "yes" ]; then PICFLAG= fi +NOASANFLAG= +case " ${CFLAGS} " in + *\ -fsanitize=address\ *) NOASANFLAG=-fno-sanitize=address ;; +esac + + echo "# Warning: this fragment is automatically generated" > temp-frag if [ -n "${frag}" ] && [ -f "${frag}" ]; then @@ -5507,7 +5517,6 @@ fi setobjs= CHECK= -target_header_dir= if test -n "${with_target_subdir}"; then # We are being configured as a target library. AC_REPLACE_FUNCS diff --git a/libiberty/configure.ac b/libiberty/configure.ac index fcea46f..3380819 100644 --- a/libiberty/configure.ac +++ b/libiberty/configure.ac @@ -225,11 +225,23 @@ case "${enable_shared}" in "") shared=no ;; *) shared=yes ;; esac + +# ...unless --enable-host-shared was passed from top-level config: +if [[ "${enable_host_shared}" = "yes" ]]; then + shared=yes +fi + if [[ "${shared}" != "yes" ]]; then PICFLAG= fi AC_SUBST(PICFLAG) +NOASANFLAG= +case " ${CFLAGS} " in + *\ -fsanitize=address\ *) NOASANFLAG=-fno-sanitize=address ;; +esac +AC_SUBST(NOASANFLAG) + echo "# Warning: this fragment is automatically generated" > temp-frag if [[ -n "${frag}" ]] && [[ -f "${frag}" ]]; then @@ -405,7 +417,6 @@ fi setobjs= CHECK= -target_header_dir= if test -n "${with_target_subdir}"; then # We are being configured as a target library. AC_REPLACE_FUNCS diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c index 70f5438..3d5d33e 100644 --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -1,5 +1,5 @@ /* Demangler for g++ V3 ABI. - Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 + Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2014 Free Software Foundation, Inc. Written by Ian Lance Taylor . @@ -275,6 +275,31 @@ struct d_growable_string int allocation_failure; }; +/* A demangle component and some scope captured when it was first + traversed. */ + +struct d_saved_scope +{ + /* The component whose scope this is. */ + const struct demangle_component *container; + /* The list of templates, if any, that was current when this + scope was captured. */ + struct d_print_template *templates; +}; + +/* Checkpoint structure to allow backtracking. This holds copies + of the fields of struct d_info that need to be restored + if a trial parse needs to be backtracked over. */ + +struct d_info_checkpoint +{ + const char *n; + int next_comp; + int next_sub; + int did_subs; + int expansion; +}; + enum { D_PRINT_BUFFER_LENGTH = 256 }; struct d_print_info { @@ -302,6 +327,20 @@ struct d_print_info int pack_index; /* Number of d_print_flush calls so far. */ unsigned long int flush_count; + /* Array of saved scopes for evaluating substitutions. */ + struct d_saved_scope *saved_scopes; + /* Index of the next unused saved scope in the above array. */ + int next_saved_scope; + /* Number of saved scopes in the above array. */ + int num_saved_scopes; + /* Array of templates for saving into scopes. */ + struct d_print_template *copy_templates; + /* Index of the next unused copy template in the above array. */ + int next_copy_template; + /* Number of copy templates in the above array. */ + int num_copy_templates; + /* The nearest enclosing template, if any. */ + const struct demangle_component *current_template; }; #ifdef CP_DEMANGLE_DEBUG @@ -428,6 +467,10 @@ d_add_substitution (struct d_info *, struct demangle_component *); static struct demangle_component *d_substitution (struct d_info *, int); +static void d_checkpoint (struct d_info *, struct d_info_checkpoint *); + +static void d_backtrack (struct d_info *, struct d_info_checkpoint *); + static void d_growable_string_init (struct d_growable_string *, size_t); static inline void @@ -440,7 +483,8 @@ static void d_growable_string_callback_adapter (const char *, size_t, void *); static void -d_print_init (struct d_print_info *, demangle_callbackref, void *); +d_print_init (struct d_print_info *, demangle_callbackref, void *, + const struct demangle_component *); static inline void d_print_error (struct d_print_info *); @@ -1276,7 +1320,6 @@ d_name (struct d_info *di) case 'Z': return d_local_name (di); - case 'L': case 'U': return d_unqualified_name (di); @@ -1323,6 +1366,7 @@ d_name (struct d_info *di) return dc; } + case 'L': default: dc = d_unqualified_name (di); if (d_peek_char (di) == 'I') @@ -1718,8 +1762,15 @@ d_operator_name (struct d_info *di) if (c1 == 'v' && IS_DIGIT (c2)) return d_make_extended_operator (di, c2 - '0', d_source_name (di)); else if (c1 == 'c' && c2 == 'v') - return d_make_comp (di, DEMANGLE_COMPONENT_CAST, - cplus_demangle_type (di), NULL); + { + struct demangle_component *type; + int was_conversion = di->is_conversion; + + di->is_conversion = ! di->is_expression; + type = cplus_demangle_type (di); + di->is_conversion = was_conversion; + return d_make_comp (di, DEMANGLE_COMPONENT_CAST, type, NULL); + } else { /* LOW is the inclusive lower bound. */ @@ -2065,6 +2116,9 @@ d_ctor_dtor_name (struct d_info *di) case '3': kind = gnu_v3_complete_object_allocating_ctor; break; + case '4': + kind = gnu_v3_unified_ctor; + break; case '5': kind = gnu_v3_object_ctor_group; break; @@ -2090,6 +2144,10 @@ d_ctor_dtor_name (struct d_info *di) case '2': kind = gnu_v3_base_object_dtor; break; + /* digit '3' is not used */ + case '4': + kind = gnu_v3_unified_dtor; + break; case '5': kind = gnu_v3_object_dtor_group; break; @@ -2268,13 +2326,61 @@ cplus_demangle_type (struct d_info *di) ret = d_template_param (di); if (d_peek_char (di) == 'I') { - /* This is . The - part is a substitution + /* This may be . + If this is the type for a conversion operator, we can + have a here only by following + a derivation like this: + + + -> + -> + -> + -> + -> + -> cv + -> cv + + where the is followed by another. + Otherwise, we must have a derivation like this: + + + -> + -> + -> + -> + -> + -> cv + -> cv + + where we need to leave the to be processed + by d_prefix (following the ). + + The part is a substitution candidate. */ - if (! d_add_substitution (di, ret)) - return NULL; - ret = d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE, ret, - d_template_args (di)); + if (! di->is_conversion) + { + if (! d_add_substitution (di, ret)) + return NULL; + ret = d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE, ret, + d_template_args (di)); + } + else + { + struct demangle_component *args; + struct d_info_checkpoint checkpoint; + + d_checkpoint (di, &checkpoint); + args = d_template_args (di); + if (d_peek_char (di) == 'I') + { + if (! d_add_substitution (di, ret)) + return NULL; + ret = d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE, ret, + args); + } + else + d_backtrack (di, &checkpoint); + } } break; @@ -2960,8 +3066,8 @@ op_is_new_cast (struct demangle_component *op) ::= */ -static struct demangle_component * -d_expression (struct d_info *di) +static inline struct demangle_component * +d_expression_1 (struct d_info *di) { char peek; @@ -2989,7 +3095,7 @@ d_expression (struct d_info *di) { d_advance (di, 2); return d_make_comp (di, DEMANGLE_COMPONENT_PACK_EXPANSION, - d_expression (di), NULL); + d_expression_1 (di), NULL); } else if (peek == 'f' && d_peek_next_char (di) == 'p') { @@ -3094,7 +3200,7 @@ d_expression (struct d_info *di) && d_check_char (di, '_')) operand = d_exprlist (di, 'E'); else - operand = d_expression (di); + operand = d_expression_1 (di); if (suffix) /* Indicate the suffix variant for d_print_comp. */ @@ -3114,7 +3220,7 @@ d_expression (struct d_info *di) if (op_is_new_cast (op)) left = cplus_demangle_type (di); else - left = d_expression (di); + left = d_expression_1 (di); if (!strcmp (code, "cl")) right = d_exprlist (di, 'E'); else if (!strcmp (code, "dt") || !strcmp (code, "pt")) @@ -3125,7 +3231,7 @@ d_expression (struct d_info *di) right, d_template_args (di)); } else - right = d_expression (di); + right = d_expression_1 (di); return d_make_comp (di, DEMANGLE_COMPONENT_BINARY, op, d_make_comp (di, @@ -3141,9 +3247,9 @@ d_expression (struct d_info *di) if (!strcmp (code, "qu")) { /* ?: expression. */ - first = d_expression (di); - second = d_expression (di); - third = d_expression (di); + first = d_expression_1 (di); + second = d_expression_1 (di); + third = d_expression_1 (di); } else if (code[0] == 'n') { @@ -3167,7 +3273,7 @@ d_expression (struct d_info *di) else if (d_peek_char (di) == 'i' && d_peek_next_char (di) == 'l') /* initializer-list. */ - third = d_expression (di); + third = d_expression_1 (di); else return NULL; } @@ -3187,6 +3293,18 @@ d_expression (struct d_info *di) } } +static struct demangle_component * +d_expression (struct d_info *di) +{ + struct demangle_component *ret; + int was_expression = di->is_expression; + + di->is_expression = 1; + ret = d_expression_1 (di); + di->is_expression = was_expression; + return ret; +} + /* ::= L <(value) number> E ::= L <(value) float> E ::= L E @@ -3572,6 +3690,26 @@ d_substitution (struct d_info *di, int prefix) } } +static void +d_checkpoint (struct d_info *di, struct d_info_checkpoint *checkpoint) +{ + checkpoint->n = di->n; + checkpoint->next_comp = di->next_comp; + checkpoint->next_sub = di->next_sub; + checkpoint->did_subs = di->did_subs; + checkpoint->expansion = di->expansion; +} + +static void +d_backtrack (struct d_info *di, struct d_info_checkpoint *checkpoint) +{ + di->n = checkpoint->n; + di->next_comp = checkpoint->next_comp; + di->next_sub = checkpoint->next_sub; + di->did_subs = checkpoint->did_subs; + di->expansion = checkpoint->expansion; +} + /* Initialize a growable string. */ static void @@ -3648,11 +3786,141 @@ d_growable_string_callback_adapter (const char *s, size_t l, void *opaque) d_growable_string_append_buffer (dgs, s, l); } +/* Walk the tree, counting the number of templates encountered, and + the number of times a scope might be saved. These counts will be + used to allocate data structures for d_print_comp, so the logic + here must mirror the logic d_print_comp will use. It is not + important that the resulting numbers are exact, so long as they + are larger than the actual numbers encountered. */ + +static void +d_count_templates_scopes (int *num_templates, int *num_scopes, + const struct demangle_component *dc) +{ + if (dc == NULL) + return; + + switch (dc->type) + { + case DEMANGLE_COMPONENT_NAME: + case DEMANGLE_COMPONENT_TEMPLATE_PARAM: + case DEMANGLE_COMPONENT_FUNCTION_PARAM: + case DEMANGLE_COMPONENT_SUB_STD: + case DEMANGLE_COMPONENT_BUILTIN_TYPE: + case DEMANGLE_COMPONENT_OPERATOR: + case DEMANGLE_COMPONENT_CHARACTER: + case DEMANGLE_COMPONENT_NUMBER: + case DEMANGLE_COMPONENT_UNNAMED_TYPE: + break; + + case DEMANGLE_COMPONENT_TEMPLATE: + (*num_templates)++; + goto recurse_left_right; + + case DEMANGLE_COMPONENT_REFERENCE: + case DEMANGLE_COMPONENT_RVALUE_REFERENCE: + if (d_left (dc)->type == DEMANGLE_COMPONENT_TEMPLATE_PARAM) + (*num_scopes)++; + goto recurse_left_right; + + case DEMANGLE_COMPONENT_QUAL_NAME: + case DEMANGLE_COMPONENT_LOCAL_NAME: + case DEMANGLE_COMPONENT_TYPED_NAME: + case DEMANGLE_COMPONENT_VTABLE: + case DEMANGLE_COMPONENT_VTT: + case DEMANGLE_COMPONENT_CONSTRUCTION_VTABLE: + case DEMANGLE_COMPONENT_TYPEINFO: + case DEMANGLE_COMPONENT_TYPEINFO_NAME: + case DEMANGLE_COMPONENT_TYPEINFO_FN: + case DEMANGLE_COMPONENT_THUNK: + case DEMANGLE_COMPONENT_VIRTUAL_THUNK: + case DEMANGLE_COMPONENT_COVARIANT_THUNK: + case DEMANGLE_COMPONENT_JAVA_CLASS: + case DEMANGLE_COMPONENT_GUARD: + case DEMANGLE_COMPONENT_TLS_INIT: + case DEMANGLE_COMPONENT_TLS_WRAPPER: + case DEMANGLE_COMPONENT_REFTEMP: + case DEMANGLE_COMPONENT_HIDDEN_ALIAS: + case DEMANGLE_COMPONENT_RESTRICT: + case DEMANGLE_COMPONENT_VOLATILE: + case DEMANGLE_COMPONENT_CONST: + case DEMANGLE_COMPONENT_RESTRICT_THIS: + case DEMANGLE_COMPONENT_VOLATILE_THIS: + case DEMANGLE_COMPONENT_CONST_THIS: + case DEMANGLE_COMPONENT_REFERENCE_THIS: + case DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS: + case DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL: + case DEMANGLE_COMPONENT_POINTER: + case DEMANGLE_COMPONENT_COMPLEX: + case DEMANGLE_COMPONENT_IMAGINARY: + case DEMANGLE_COMPONENT_VENDOR_TYPE: + case DEMANGLE_COMPONENT_FUNCTION_TYPE: + case DEMANGLE_COMPONENT_ARRAY_TYPE: + case DEMANGLE_COMPONENT_PTRMEM_TYPE: + case DEMANGLE_COMPONENT_FIXED_TYPE: + case DEMANGLE_COMPONENT_VECTOR_TYPE: + case DEMANGLE_COMPONENT_ARGLIST: + case DEMANGLE_COMPONENT_TEMPLATE_ARGLIST: + case DEMANGLE_COMPONENT_INITIALIZER_LIST: + case DEMANGLE_COMPONENT_CAST: + case DEMANGLE_COMPONENT_NULLARY: + case DEMANGLE_COMPONENT_UNARY: + case DEMANGLE_COMPONENT_BINARY: + case DEMANGLE_COMPONENT_BINARY_ARGS: + case DEMANGLE_COMPONENT_TRINARY: + case DEMANGLE_COMPONENT_TRINARY_ARG1: + case DEMANGLE_COMPONENT_TRINARY_ARG2: + case DEMANGLE_COMPONENT_LITERAL: + case DEMANGLE_COMPONENT_LITERAL_NEG: + case DEMANGLE_COMPONENT_JAVA_RESOURCE: + case DEMANGLE_COMPONENT_COMPOUND_NAME: + case DEMANGLE_COMPONENT_DECLTYPE: + case DEMANGLE_COMPONENT_TRANSACTION_CLONE: + case DEMANGLE_COMPONENT_NONTRANSACTION_CLONE: + case DEMANGLE_COMPONENT_PACK_EXPANSION: + case DEMANGLE_COMPONENT_TAGGED_NAME: + case DEMANGLE_COMPONENT_CLONE: + recurse_left_right: + d_count_templates_scopes (num_templates, num_scopes, + d_left (dc)); + d_count_templates_scopes (num_templates, num_scopes, + d_right (dc)); + break; + + case DEMANGLE_COMPONENT_CTOR: + d_count_templates_scopes (num_templates, num_scopes, + dc->u.s_ctor.name); + break; + + case DEMANGLE_COMPONENT_DTOR: + d_count_templates_scopes (num_templates, num_scopes, + dc->u.s_dtor.name); + break; + + case DEMANGLE_COMPONENT_EXTENDED_OPERATOR: + d_count_templates_scopes (num_templates, num_scopes, + dc->u.s_extended_operator.name); + break; + + case DEMANGLE_COMPONENT_GLOBAL_CONSTRUCTORS: + case DEMANGLE_COMPONENT_GLOBAL_DESTRUCTORS: + d_count_templates_scopes (num_templates, num_scopes, + d_left (dc)); + break; + + case DEMANGLE_COMPONENT_LAMBDA: + case DEMANGLE_COMPONENT_DEFAULT_ARG: + d_count_templates_scopes (num_templates, num_scopes, + dc->u.s_unary_num.sub); + break; + } +} + /* Initialize a print information structure. */ static void d_print_init (struct d_print_info *dpi, demangle_callbackref callback, - void *opaque) + void *opaque, const struct demangle_component *dc) { dpi->len = 0; dpi->last_char = '\0'; @@ -3665,6 +3933,20 @@ d_print_init (struct d_print_info *dpi, demangle_callbackref callback, dpi->opaque = opaque; dpi->demangle_failure = 0; + + dpi->saved_scopes = NULL; + dpi->next_saved_scope = 0; + dpi->num_saved_scopes = 0; + + dpi->copy_templates = NULL; + dpi->next_copy_template = 0; + dpi->num_copy_templates = 0; + + d_count_templates_scopes (&dpi->num_copy_templates, + &dpi->num_saved_scopes, dc); + dpi->num_copy_templates *= dpi->num_saved_scopes; + + dpi->current_template = NULL; } /* Indicate that an error occurred during printing, and test for error. */ @@ -3750,9 +4032,24 @@ cplus_demangle_print_callback (int options, { struct d_print_info dpi; - d_print_init (&dpi, callback, opaque); + d_print_init (&dpi, callback, opaque, dc); - d_print_comp (&dpi, options, dc); + { +#ifdef CP_DYNAMIC_ARRAYS + __extension__ struct d_saved_scope scopes[dpi.num_saved_scopes]; + __extension__ struct d_print_template temps[dpi.num_copy_templates]; + + dpi.saved_scopes = scopes; + dpi.copy_templates = temps; +#else + dpi.saved_scopes = alloca (dpi.num_saved_scopes + * sizeof (*dpi.saved_scopes)); + dpi.copy_templates = alloca (dpi.num_copy_templates + * sizeof (*dpi.copy_templates)); +#endif + + d_print_comp (&dpi, options, dc); + } d_print_flush (&dpi); @@ -3913,6 +4210,62 @@ d_print_subexpr (struct d_print_info *dpi, int options, d_append_char (dpi, ')'); } +/* Save the current scope. */ + +static void +d_save_scope (struct d_print_info *dpi, + const struct demangle_component *container) +{ + struct d_saved_scope *scope; + struct d_print_template *src, **link; + + if (dpi->next_saved_scope >= dpi->num_saved_scopes) + { + d_print_error (dpi); + return; + } + scope = &dpi->saved_scopes[dpi->next_saved_scope]; + dpi->next_saved_scope++; + + scope->container = container; + link = &scope->templates; + + for (src = dpi->templates; src != NULL; src = src->next) + { + struct d_print_template *dst; + + if (dpi->next_copy_template >= dpi->num_copy_templates) + { + d_print_error (dpi); + return; + } + dst = &dpi->copy_templates[dpi->next_copy_template]; + dpi->next_copy_template++; + + dst->template_decl = src->template_decl; + *link = dst; + link = &dst->next; + } + + *link = NULL; +} + +/* Attempt to locate a previously saved scope. Returns NULL if no + corresponding saved scope was found. */ + +static struct d_saved_scope * +d_get_saved_scope (struct d_print_info *dpi, + const struct demangle_component *container) +{ + int i; + + for (i = 0; i < dpi->next_saved_scope; i++) + if (dpi->saved_scopes[i].container == container) + return &dpi->saved_scopes[i]; + + return NULL; +} + /* Subroutine to handle components. */ static void @@ -3923,6 +4276,13 @@ d_print_comp (struct d_print_info *dpi, int options, without needing to modify *dc. */ const struct demangle_component *mod_inner = NULL; + /* Variable used to store the current templates while a previously + captured scope is used. */ + struct d_print_template *saved_templates; + + /* Nonzero if templates have been stored in the above variable. */ + int need_template_restore = 0; + if (dc == NULL) { d_print_error (dpi); @@ -4085,6 +4445,12 @@ d_print_comp (struct d_print_info *dpi, int options, { struct d_print_mod *hold_dpm; struct demangle_component *dcl; + const struct demangle_component *hold_current; + + /* This template may need to be referenced by a cast operator + contained in its subtree. */ + hold_current = dpi->current_template; + dpi->current_template = dc; /* Don't push modifiers into a template definition. Doing so could give the wrong definition for a template argument. @@ -4121,6 +4487,7 @@ d_print_comp (struct d_print_info *dpi, int options, } dpi->modifiers = hold_dpm; + dpi->current_template = hold_current; return; } @@ -4291,12 +4658,37 @@ d_print_comp (struct d_print_info *dpi, int options, const struct demangle_component *sub = d_left (dc); if (sub->type == DEMANGLE_COMPONENT_TEMPLATE_PARAM) { - struct demangle_component *a = d_lookup_template_argument (dpi, sub); + struct d_saved_scope *scope = d_get_saved_scope (dpi, sub); + struct demangle_component *a; + + if (scope == NULL) + { + /* This is the first time SUB has been traversed. + We need to capture the current templates so + they can be restored if SUB is reentered as a + substitution. */ + d_save_scope (dpi, sub); + if (d_print_saw_error (dpi)) + return; + } + else + { + /* This traversal is reentering SUB as a substition. + Restore the original templates temporarily. */ + saved_templates = dpi->templates; + dpi->templates = scope->templates; + need_template_restore = 1; + } + + a = d_lookup_template_argument (dpi, sub); if (a && a->type == DEMANGLE_COMPONENT_TEMPLATE_ARGLIST) a = d_index_template_argument (a, dpi->pack_index); if (a == NULL) { + if (need_template_restore) + dpi->templates = saved_templates; + d_print_error (dpi); return; } @@ -4344,6 +4736,9 @@ d_print_comp (struct d_print_info *dpi, int options, dpi->modifiers = dpm.next; + if (need_template_restore) + dpi->templates = saved_templates; + return; } @@ -5289,28 +5684,32 @@ static void d_print_cast (struct d_print_info *dpi, int options, const struct demangle_component *dc) { - if (d_left (dc)->type != DEMANGLE_COMPONENT_TEMPLATE) - d_print_comp (dpi, options, d_left (dc)); - else - { - struct d_print_mod *hold_dpm; - struct d_print_template dpt; - - /* It appears that for a templated cast operator, we need to put - the template parameters in scope for the operator name, but - not for the parameters. The effect is that we need to handle - the template printing here. */ - - hold_dpm = dpi->modifiers; - dpi->modifiers = NULL; + struct d_print_template dpt; + /* For a cast operator, we need the template parameters from + the enclosing template in scope for processing the type. */ + if (dpi->current_template != NULL) + { dpt.next = dpi->templates; dpi->templates = &dpt; - dpt.template_decl = d_left (dc); + dpt.template_decl = dpi->current_template; + } + if (d_left (dc)->type != DEMANGLE_COMPONENT_TEMPLATE) + { + d_print_comp (dpi, options, d_left (dc)); + if (dpi->current_template != NULL) + dpi->templates = dpt.next; + } + else + { d_print_comp (dpi, options, d_left (d_left (dc))); - dpi->templates = dpt.next; + /* For a templated cast operator, we need to remove the template + parameters from scope after printing the operator name, + so we need to handle the template printing here. */ + if (dpi->current_template != NULL) + dpi->templates = dpt.next; if (d_last_char (dpi) == '<') d_append_char (dpi, ' '); @@ -5321,8 +5720,6 @@ d_print_cast (struct d_print_info *dpi, int options, if (d_last_char (dpi) == '>') d_append_char (dpi, ' '); d_append_char (dpi, '>'); - - dpi->modifiers = hold_dpm; } } @@ -5355,6 +5752,8 @@ cplus_demangle_init_info (const char *mangled, int options, size_t len, di->last_name = NULL; di->expansion = 0; + di->is_expression = 0; + di->is_conversion = 0; } /* Internal implementation for the demangler. If MANGLED is a g++ v3 ABI @@ -5425,6 +5824,8 @@ d_demangle_callback (const char *mangled, int options, NULL); d_advance (&di, strlen (d_str (&di))); break; + default: + abort (); /* We have listed all the cases. */ } /* If DMGL_PARAMS is set, then if we didn't consume the entire diff --git a/libiberty/cp-demangle.h b/libiberty/cp-demangle.h index ae635be..6fce025 100644 --- a/libiberty/cp-demangle.h +++ b/libiberty/cp-demangle.h @@ -122,6 +122,11 @@ struct d_info mangled name to the demangled name, such as standard substitutions and builtin types. */ int expansion; + /* Non-zero if we are parsing an expression. */ + int is_expression; + /* Non-zero if we are parsing the type operand of a conversion + operator, but not when in an expression. */ + int is_conversion; }; /* To avoid running past the ending '\0', don't: diff --git a/libiberty/floatformat.c b/libiberty/floatformat.c index c58ab01..789fa05 100644 --- a/libiberty/floatformat.c +++ b/libiberty/floatformat.c @@ -371,14 +371,23 @@ floatformat_ibm_long_double_is_valid (const struct floatformat *fmt, } } -const struct floatformat floatformat_ibm_long_double = +const struct floatformat floatformat_ibm_long_double_big = { floatformat_big, 128, 0, 1, 11, 1023, 2047, 12, 52, floatformat_intbit_no, - "floatformat_ibm_long_double", + "floatformat_ibm_long_double_big", floatformat_ibm_long_double_is_valid, &floatformat_ieee_double_big }; + +const struct floatformat floatformat_ibm_long_double_little = +{ + floatformat_little, 128, 0, 1, 11, 1023, 2047, 12, 52, + floatformat_intbit_no, + "floatformat_ibm_long_double_little", + floatformat_ibm_long_double_is_valid, + &floatformat_ieee_double_little +}; #ifndef min diff --git a/libiberty/maint-tool b/libiberty/maint-tool index d50f895..1c94cdc 100644 --- a/libiberty/maint-tool +++ b/libiberty/maint-tool @@ -1,7 +1,7 @@ #!/usr/bin/perl # -*- perl -*- -# Copyright (C) 2001, 2007, 2010 +# Copyright (C) 2001, 2007, 2010, 2014 # Free Software Foundation # # This file is part of the libiberty library. @@ -215,6 +215,9 @@ sub deps { $crule = "\tif [ x\"\$(PICFLAG)\" != x ]; then \\\n"; $crule .= "\t \$(COMPILE.c) \$(PICFLAG) \$< -o pic/\$@; \\\n"; $crule .= "\telse true; fi\n"; + $crule .= "\tif [ x\"\$(NOASANFLAG)\" != x ]; then \\\n"; + $crule .= "\t \$(COMPILE.c) \$(PICFLAG) \$(NOASANFLAG) \$< -o noasan/\$@; \\\n"; + $crule .= "\telse true; fi\n"; $crule .= "\t\$(COMPILE.c) \$< \$(OUTPUT_OPTION)\n"; $crule .= "\n"; diff --git a/libiberty/regex.c b/libiberty/regex.c index c11f330..16338cb 100644 --- a/libiberty/regex.c +++ b/libiberty/regex.c @@ -151,7 +151,7 @@ char *realloc (); # include # ifndef bzero # ifndef _LIBC -# define bzero(s, n) (memset (s, '\0', n), (s)) +# define bzero(s, n) ((void) memset (s, '\0', n)) # else # define bzero(s, n) __bzero (s, n) # endif @@ -8093,12 +8093,12 @@ regerror (int errcode, const regex_t *preg ATTRIBUTE_UNUSED, #if defined HAVE_MEMPCPY || defined _LIBC *((char *) mempcpy (errbuf, msg, errbuf_size - 1)) = '\0'; #else - memcpy (errbuf, msg, errbuf_size - 1); + (void) memcpy (errbuf, msg, errbuf_size - 1); errbuf[errbuf_size - 1] = 0; #endif } else - memcpy (errbuf, msg, msg_size); + (void) memcpy (errbuf, msg, msg_size); } return msg_size; diff --git a/libiberty/simple-object.c b/libiberty/simple-object.c index fde3454..5d379d0 100644 --- a/libiberty/simple-object.c +++ b/libiberty/simple-object.c @@ -63,8 +63,6 @@ simple_object_internal_read (int descriptor, off_t offset, unsigned char *buffer, size_t size, const char **errmsg, int *err) { - ssize_t got; - if (lseek (descriptor, offset, SEEK_SET) < 0) { *errmsg = "lseek"; @@ -72,15 +70,26 @@ simple_object_internal_read (int descriptor, off_t offset, return 0; } - got = read (descriptor, buffer, size); - if (got < 0) + do { - *errmsg = "read"; - *err = errno; - return 0; + ssize_t got = read (descriptor, buffer, size); + if (got == 0) + break; + else if (got > 0) + { + buffer += got; + size -= got; + } + else if (errno != EINTR) + { + *errmsg = "read"; + *err = errno; + return 0; + } } + while (size > 0); - if ((size_t) got < size) + if (size > 0) { *errmsg = "file too short"; *err = 0; @@ -98,8 +107,6 @@ simple_object_internal_write (int descriptor, off_t offset, const unsigned char *buffer, size_t size, const char **errmsg, int *err) { - ssize_t wrote; - if (lseek (descriptor, offset, SEEK_SET) < 0) { *errmsg = "lseek"; @@ -107,15 +114,26 @@ simple_object_internal_write (int descriptor, off_t offset, return 0; } - wrote = write (descriptor, buffer, size); - if (wrote < 0) + do { - *errmsg = "write"; - *err = errno; - return 0; + ssize_t wrote = write (descriptor, buffer, size); + if (wrote == 0) + break; + else if (wrote > 0) + { + buffer += wrote; + size -= wrote; + } + else if (errno != EINTR) + { + *errmsg = "write"; + *err = errno; + return 0; + } } + while (size > 0); - if ((size_t) wrote < size) + if (size > 0) { *errmsg = "short write"; *err = 0; diff --git a/libiberty/snprintf.c b/libiberty/snprintf.c index 1e3b038..49bcd83 100644 --- a/libiberty/snprintf.c +++ b/libiberty/snprintf.c @@ -1,5 +1,5 @@ /* Implement the snprintf function. - Copyright (C) 2003, 2011 Free Software Foundation, Inc. + Copyright (C) 2003, 2011, 2013 Free Software Foundation, Inc. Written by Kaveh R. Ghazi . This file is part of the libiberty library. This library is free @@ -53,11 +53,9 @@ int snprintf (char *s, size_t n, const char *format, ...) { int result; - VA_OPEN (ap, format); - VA_FIXEDARG (ap, char *, s); - VA_FIXEDARG (ap, size_t, n); - VA_FIXEDARG (ap, const char *, format); + va_list ap; + va_start (ap, format); result = vsnprintf (s, n, format, ap); - VA_CLOSE (ap); + va_end (ap); return result; } diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected index 1259e4a..3ff08e6 100644 --- a/libiberty/testsuite/demangle-expected +++ b/libiberty/testsuite/demangle-expected @@ -4291,3 +4291,29 @@ void m(void (A::*)() &&) --format=gnu-v3 _Z1nIM1AKFvvREEvT_ void n(void (A::*)() const &) +--format=gnu-v3 +_ZL1fIiEvv +void f() +--format=gnu-v3 +_ZSt7forwardIRN1x14refobjiteratorINS0_3refINS0_4mime30multipart_section_processorObjIZ15get_body_parserIZZN14mime_processor21make_section_iteratorERKNS2_INS3_10sectionObjENS0_10ptrrefBaseEEEbENKUlvE_clEvEUlSB_bE_ZZNS6_21make_section_iteratorESB_bENKSC_clEvEUlSB_E0_ENS1_INS2_INS0_20outputrefiteratorObjIiEES8_EEEERKSsSB_OT_OT0_EUlmE_NS3_32make_multipart_default_discarderISP_EEEES8_EEEEEOT_RNSt16remove_referenceISW_E4typeE +x::refobjiterator, x::ptrrefBase> > get_body_parser const&, bool)::{lambda()#1}::operator()() const::{lambda(x::ref const&, bool)#1}, mime_processor::make_section_iterator(x::ref const&, bool)::{lambda()#1}::operator()() const::{lambda(x::ref const&)#2}>(std::string const&, x::ref const&, mime_processor::make_section_iterator(x::ref const&, bool)::{lambda()#1}::operator()() const::{lambda(x::ref const&, bool)#1}&&, mime_processor::make_section_iterator(x::ref const&, bool)::{lambda()#1}::operator()() const::{lambda(x::ref const&)#2}&&)::{lambda(unsigned long)#1}, x::mime::make_multipart_default_discarder const&, bool)::{lambda()#1}::operator()() const::{lambda(x::ref const&, bool)#1}&&> >, x::ptrrefBase> >& std::forward, x::ptrrefBase> > get_body_parser const&, bool)::{lambda()#1}::operator()() const::{lambda(x::ref const&, bool)#1}, mime_processor::make_section_iterator(x::ref const&, bool)::{lambda()#1}::operator()() const::{lambda(x::ref const&)#2}>(std::string const&, x::ref const&, mime_processor::make_section_iterator(x::ref const&, bool)::{lambda()#1}::operator()() const::{lambda(x::ref const&, bool)#1}&&, mime_processor::make_section_iterator(x::ref const&, bool)::{lambda()#1}::operator()() const::{lambda(x::ref const&)#2}&&)::{lambda(unsigned long)#1}, x::mime::make_multipart_default_discarder const&, bool)::{lambda()#1}::operator()() const::{lambda(x::ref const&, bool)#1}&&> >, x::ptrrefBase> >&>(std::remove_reference, x::ptrrefBase> > get_body_parser const&, bool)::{lambda()#1}::operator()() const::{lambda(x::ref const&, bool)#1}, mime_processor::make_section_iterator(x::ref const&, bool)::{lambda()#1}::operator()() const::{lambda(x::ref const&)#2}>(std::string const&, x::ref const&, mime_processor::make_section_iterator(x::ref const&, bool)::{lambda()#1}::operator()() const::{lambda(x::ref const&, bool)#1}&&, mime_processor::make_section_iterator(x::ref const&, bool)::{lambda()#1}::operator()() const::{lambda(x::ref const&)#2}&&)::{lambda(unsigned long)#1}, x::mime::make_multipart_default_discarder const&, bool)::{lambda()#1}::operator()() const::{lambda(x::ref const&, bool)#1}&&> > >::type&) +# +--format=gnu-v3 --no-params +_ZNK7strings8internal8SplitterINS_9delimiter5AnyOfENS_9SkipEmptyEEcvT_ISt6vectorI12basic_stringIcSt11char_traitsIcESaIcEESaISD_EEvEEv +strings::internal::Splitter::operator std::vector, std::allocator >, std::allocator, std::allocator > > >, std::allocator >, std::allocator, std::allocator > > >, void>() const +strings::internal::Splitter::operator std::vector, std::allocator >, std::allocator, std::allocator > > >, std::allocator >, std::allocator, std::allocator > > >, void> +# +--format=gnu-v3 --no-params +_ZN1AcvT_I1CEEv +A::operator C() +A::operator C +# +--format=gnu-v3 --no-params +_ZN1AcvPT_I1CEEv +A::operator C*() +A::operator C* +# +--format=gnu-v3 --no-params +_ZN1AcvT_IiEI1CEEv +A::operator C() +A::operator C diff --git a/libiberty/testsuite/test-demangle.c b/libiberty/testsuite/test-demangle.c index 11d9729..4406247 100644 --- a/libiberty/testsuite/test-demangle.c +++ b/libiberty/testsuite/test-demangle.c @@ -32,6 +32,9 @@ #if HAVE_STDLIB_H # include #endif +#ifdef HAVE_UNISTD_H +#include +#endif struct line { diff --git a/libiberty/testsuite/test-expandargv.c b/libiberty/testsuite/test-expandargv.c index dff20d4..0edd751 100644 --- a/libiberty/testsuite/test-expandargv.c +++ b/libiberty/testsuite/test-expandargv.c @@ -40,6 +40,9 @@ #ifdef HAVE_STRING_H #include #endif +#ifdef HAVE_UNISTD_H +#include +#endif #ifndef EXIT_SUCCESS #define EXIT_SUCCESS 0 diff --git a/libiberty/vasprintf.c b/libiberty/vasprintf.c index 85de542..4925060 100644 --- a/libiberty/vasprintf.c +++ b/libiberty/vasprintf.c @@ -1,6 +1,6 @@ /* Like vsprintf but provides a pointer to malloc'd storage, which must be freed by the caller. - Copyright (C) 1994, 2003, 2011 Free Software Foundation, Inc. + Copyright (C) 1994, 2003, 2011, 2013 Free Software Foundation, Inc. This file is part of the libiberty library. Libiberty is free software; you can redistribute it and/or @@ -165,10 +165,10 @@ static void ATTRIBUTE_PRINTF_1 checkit (const char *format, ...) { char *result; - VA_OPEN (args, format); - VA_FIXEDARG (args, const char *, format); + va_list args; + va_start (args, format); vasprintf (&result, format, args); - VA_CLOSE (args); + va_end (args); if (strlen (result) < (size_t) global_total_width) printf ("PASS: "); diff --git a/libiberty/vsnprintf.c b/libiberty/vsnprintf.c index 6c0afa6..2c441a7 100644 --- a/libiberty/vsnprintf.c +++ b/libiberty/vsnprintf.c @@ -1,5 +1,5 @@ /* Implement the vsnprintf function. - Copyright (C) 2003, 2004, 2005, 2011 Free Software Foundation, Inc. + Copyright (C) 2003, 2004, 2005, 2011, 2013 Free Software Foundation, Inc. Written by Kaveh R. Ghazi . This file is part of the libiberty library. This library is free @@ -95,12 +95,10 @@ static int ATTRIBUTE_PRINTF_3 checkit (char *s, size_t n, const char *format, ...) { int result; - VA_OPEN (ap, format); - VA_FIXEDARG (ap, char *, s); - VA_FIXEDARG (ap, size_t, n); - VA_FIXEDARG (ap, const char *, format); + va_list ap; + va_start (ap, format); result = vsnprintf (s, n, format, ap); - VA_CLOSE (ap); + va_end (ap); return result; }