From fe508576ef1f815b22177d7597796886b91ea0c8 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 22 Mar 2016 10:25:20 +0100 Subject: Sync toplevel with upstream GCC. Signed-off-by: Corinna Vinschen --- include/ChangeLog | 165 +++++++- include/ChangeLog-9103 | 6 - include/ChangeLog.jit | 11 + include/ansidecl.h | 13 +- include/demangle.h | 15 +- include/dwarf2.def | 11 +- include/dwarf2.h | 4 +- include/dyn-string.h | 3 +- include/environ.h | 33 ++ include/fibheap.h | 3 +- include/filenames.h | 2 +- include/floatformat.h | 3 +- include/fnmatch.h | 2 +- include/gcc-c-fe.def | 2 +- include/gcc-c-interface.h | 2 +- include/gcc-interface.h | 2 +- include/gdb/gdb-index.h | 2 +- include/getopt.h | 3 +- include/gomp-constants.h | 149 ++++++- include/hashtab.h | 3 +- include/leb128.h | 2 +- include/libiberty.h | 8 +- include/longlong.h | 34 +- include/lto-symtab.h | 2 +- include/md5.h | 2 +- include/objalloc.h | 2 +- include/obstack.h | 914 ++++++++++++++++++++-------------------- include/partition.h | 6 +- include/plugin-api.h | 29 +- include/safe-ctype.h | 2 +- include/sha1.h | 3 +- include/simple-object.h | 2 +- include/sort.h | 2 +- include/splay-tree.h | 3 +- include/symcat.h | 2 +- include/timeval-utils.h | 2 +- include/vtv-change-permission.h | 7 +- include/xregex2.h | 3 +- include/xtensa-config.h | 3 +- 39 files changed, 923 insertions(+), 539 deletions(-) create mode 100644 include/ChangeLog.jit create mode 100644 include/environ.h (limited to 'include') diff --git a/include/ChangeLog b/include/ChangeLog index c22539a1c..e2f4df69c 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,155 @@ +2016-03-17 Thomas Schwinge + + * gomp-constants.h (enum gomp_map_kind): Rename + GOMP_MAP_FORCE_DEALLOC to GOMP_MAP_DELETE. Adjust all users. + +2016-03-03 Than McIntosh + + * plugin-api.h: Add new hooks to the plugin transfer vector to + to support querying section alignment and section size. + (ld_plugin_get_input_section_alignment): New hook. + (ld_plugin_get_input_section_size): New hook. + (ld_plugin_tag): Add LDPT_GET_INPUT_SECTION_ALIGNMENT + and LDPT_GET_INPUT_SECTION_SIZE. + (ld_plugin_tv): Add tv_get_input_section_alignment and + tv_get_input_section_size. + +2016-03-03 Evgenii Stepanov + + * plugin-api.h (enum ld_plugin_tag): Add LDPT_GET_SYMBOLS_V3. + +2016-01-19 Martin Jambor + + * gomp-constants.h (GOMP_DEVICE_HSA): New macro. + (GOMP_VERSION_HSA): Likewise. + (GOMP_TARGET_ARG_DEVICE_MASK): Likewise. + (GOMP_TARGET_ARG_DEVICE_ALL): Likewise. + (GOMP_TARGET_ARG_SUBSEQUENT_PARAM): Likewise. + (GOMP_TARGET_ARG_ID_MASK): Likewise. + (GOMP_TARGET_ARG_NUM_TEAMS): Likewise. + (GOMP_TARGET_ARG_THREAD_LIMIT): Likewise. + (GOMP_TARGET_ARG_VALUE_SHIFT): Likewise. + (GOMP_TARGET_ARG_HSA_KERNEL_ATTRIBUTES): Likewise. + +2016-01-07 Mike Frysinger + + * longlong.h: Change !__SHMEDIA__ to + (!defined (__SHMEDIA__) || !__SHMEDIA__). + Change __SHMEDIA__ to defined (__SHMEDIA__) && __SHMEDIA__. + +2016-01-05 Mike Frysinger + + * libiberty.h (dupargv): Change arg to char * const *. + (writeargv, countargv): Likewise. + +2015-11-25 Rainer Orth + + * vtv-change-permission.h (VTV_PAGE_SIZE) [__sun__ && __svr4__ && + __sparc__]: Define. + +2015-11-12 James Norris + Joseph Myers + + * gomp-constants.h (enum gomp_map_kind): Add GOMP_MAP_DEVICE_RESIDENT + and GOMP_MAP_LINK. + +2015-11-09 Alan Modra + + PR gdb/17133 + * obstack.h (__attribute_pure__): Expand _GL_ATTRIBUTE_PURE. + +2015-11-09 Alan Modra + + PR gdb/17133 + * obstack.h: Import current gnulib file. + +2015-11-05 Jakub Jelinek + Ilya Verbin + + * gomp-constants.h (GOMP_MAP_FLAG_SPECIAL_2): Define. + (GOMP_MAP_FLAG_ALWAYS): Remove. + (enum gomp_map_kind): Use GOMP_MAP_FLAG_SPECIAL_2 instead of + GOMP_MAP_FLAG_ALWAYS for GOMP_MAP_ALWAYS_TO, GOMP_MAP_ALWAYS_FROM, + GOMP_MAP_ALWAYS_TOFROM, GOMP_MAP_STRUCT, GOMP_MAP_RELEASE. + Add GOMP_MAP_ALWAYS_POINTER and GOMP_MAP_FIRSTPRIVATE_REFERENCE. + (GOMP_MAP_ALWAYS_P): Define. + (GOMP_TARGET_FLAG_NOWAIT): Adjust comment. + +2015-10-27 Daniel Jacobowitz + Joseph Myers + Mark Shinwell + Andrew Stubbs + Rich Felker + + * longlong.h (udiv_qrnnd): Add FDPIC compatible version for SH. + +2015-10-18 Roland McGrath + + PR other/63758 + * environ.h: New file. + +2015-10-13 Jakub Jelinek + Ilya Verbin + + * gomp-constants.h (GOMP_MAP_FLAG_ALWAYS): Define. + (enum gomp_map_kind): Add GOMP_MAP_FIRSTPRIVATE, + GOMP_MAP_FIRSTPRIVATE_INT, GOMP_MAP_USE_DEVICE_PTR, + GOMP_MAP_ZERO_LEN_ARRAY_SECTION, GOMP_MAP_ALWAYS_TO, + GOMP_MAP_ALWAYS_FROM, GOMP_MAP_ALWAYS_TOFROM, GOMP_MAP_STRUCT, + GOMP_MAP_DELETE_ZERO_LEN_ARRAY_SECTION, GOMP_MAP_DELETE, + GOMP_MAP_RELEASE, GOMP_MAP_FIRSTPRIVATE_POINTER. + (GOMP_MAP_ALWAYS_TO_P, GOMP_MAP_ALWAYS_FROM_P): Define. + (GOMP_TASK_FLAG_UNTIED, GOMP_TASK_FLAG_FINAL, GOMP_TASK_FLAG_MERGEABLE, + GOMP_TASK_FLAG_DEPEND, GOMP_TASK_FLAG_PRIORITY, GOMP_TASK_FLAG_UP, + GOMP_TASK_FLAG_GRAINSIZE, GOMP_TASK_FLAG_IF, GOMP_TASK_FLAG_NOGROUP, + GOMP_TARGET_FLAG_NOWAIT, GOMP_TARGET_FLAG_EXIT_DATA, + GOMP_TARGET_FLAG_UPDATE): Define. + +2015-09-28 Nathan Sidwell + + * gomp-constants.h (GOMP_VERSION_NVIDIA_PTX): Increment. + (GOMP_DIM_GANG, GOMP_DIM_WORKER, GOMP_DIM_VECTOR, GOMP_DIM_MAX, + GOMP_DIM_MASK): New. + (GOMP_LAUNCH_DIM, GOMP_LAUNCH_ASYNC, GOMP_LAUNCH_WAIT): New. + (GOMP_LAUNCH_CODE_SHIFT, GOMP_LAUNCH_DEVICE_SHIFT, + GOMP_LAUNCH_OP_SHIFT): New. + (GOMP_LAUNCH_PACK, GOMP_LAUNCH_CODE, GOMP_LAUNCH_DEVICE, + GOMP_LAUNCH_OP): New. + (GOMP_LAUNCH_OP_MAX): New. + +2015-08-24 Nathan Sidwell + + * gomp-constants.h (GOMP_VERSION, GOMP_VERSION_NVIDIA_PTX, + GOMP_VERSION_INTEL_MIC): New. + (GOMP_VERSION_PACK, GOMP_VERSION_LIB, GOMP_VERSION_DEV): New. + +2015-08-14 Pierre-Marie de Rodat + + * dwarf2.def (DW_AT_GNU_bias): New attribute. + +2015-08-14 Pierre-Marie de Rodat + + * dwarf2.def (DW_AT_GNU_numerator, DW_AT_GNU_denominator): New + attributes. + +2015-08-11 Trevor Saunders + + * ansidecl.h (GCC_FINAL): New macro. + +2015-08-10 Thomas Schwinge + + * gomp-constants.c (GOMP_DEVICE_HOST_NONSHM): Remove. + +2015-05-22 Yunlian Jiang + + * libiberty.h (asprintf): Don't declare if HAVE_DECL_ASPRINTF is + not defined. + +2015-03-19 Richard Biener + + * partition.h (struct partition_elem): Re-order elements to + avoid padding. + 2015-03-02 Markus Trippelsdorf PR target/65261 @@ -18,7 +170,7 @@ * gomp-constants.h: New file. -2015-12-14 Jan-Benedict Glaw +2014-12-14 Jan-Benedict Glaw * libiberty.h: Merge Copyright year update from Binutils. @@ -62,15 +214,16 @@ (DW_AT_APPLE_property_attribute, DW_AT_APPLE_objc_complete_type) (DW_AT_APPLE_property): New macros. -2014-11-11 David Malcolm - - * ChangeLog.jit: New. - -2014-11-05 Anthony Brandon +2014-11-11 Anthony Brandon + Manuel López-Ibáñez PR driver/36312 * filenames.h: Add prototype for canonical_filename_eq. +2014-11-11 David Malcolm + + * ChangeLog.jit: New. + 2014-10-28 Richard Henderson * longlong.h [__alpha] (umul_ppmm): Disable for c++. diff --git a/include/ChangeLog-9103 b/include/ChangeLog-9103 index bac53022b..3eeb77c1b 100644 --- a/include/ChangeLog-9103 +++ b/include/ChangeLog-9103 @@ -2674,12 +2674,6 @@ Wed Aug 21 20:32:13 1991 John Gilmore (gnu at cygint.cygnus.com) to reflect reality as I know it. -Copyright (C) 1993-2003 Free Software Foundation, Inc. - -Copying and distribution of this file, with or without modification, -are permitted in any medium without royalty provided the copyright -notice and this notice are preserved. - Local Variables: mode: change-log left-margin: 8 diff --git a/include/ChangeLog.jit b/include/ChangeLog.jit new file mode 100644 index 000000000..84acd3314 --- /dev/null +++ b/include/ChangeLog.jit @@ -0,0 +1,11 @@ +2014-09-25 David Malcolm + + * libiberty.h (choose_tmpdir): New prototype. + * ChangeLog.jit: New. + + +Copyright (C) 2014 Free Software Foundation, Inc. + +Copying and distribution of this file, with or without modification, +are permitted in any medium without royalty provided the copyright +notice and this notice are preserved. diff --git a/include/ansidecl.h b/include/ansidecl.h index 04d75c33f..6e4bfc21f 100644 --- a/include/ansidecl.h +++ b/include/ansidecl.h @@ -1,7 +1,5 @@ /* 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, 2013 - Free Software Foundation, Inc. + Copyright (C) 1991-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software; you can redistribute it and/or modify @@ -313,6 +311,15 @@ So instead we use the macro below and test it against specific values. */ #define ENUM_BITFIELD(TYPE) __extension__ enum TYPE #else #define ENUM_BITFIELD(TYPE) unsigned int +#endif + + /* This is used to mark a class or virtual function as final. */ +#if __cplusplus >= 201103L +#define GCC_FINAL final +#elif GCC_VERSION >= 4007 +#define GCC_FINAL __final +#else +#define GCC_FINAL #endif #ifdef __cplusplus diff --git a/include/demangle.h b/include/demangle.h index d2a6731a9..1d7cadf4b 100644 --- a/include/demangle.h +++ b/include/demangle.h @@ -1,7 +1,6 @@ /* Defs for interface to demanglers. - Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002, - 2003, 2004, 2005, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. - + Copyright (C) 1992-2015 Free Software Foundation, Inc. + This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2, or @@ -144,10 +143,10 @@ cplus_mangle_opname (const char *opname, int options); extern void set_cplus_marker_for_demangling (int ch); -extern enum demangling_styles +extern enum demangling_styles cplus_demangle_set_style (enum demangling_styles style); -extern enum demangling_styles +extern enum demangling_styles cplus_demangle_name_to_style (const char *name); /* Callback typedef for allocation-less demangler interfaces. */ @@ -380,6 +379,10 @@ enum demangle_component_type /* A typecast, represented as a unary operator. The one subtree is the type to which the argument should be cast. */ DEMANGLE_COMPONENT_CAST, + /* A conversion operator, represented as a unary operator. The one + subtree is the type to which the argument should be converted + to. */ + DEMANGLE_COMPONENT_CONVERSION, /* A nullary expression. The left subtree is the operator. */ DEMANGLE_COMPONENT_NULLARY, /* A unary expression. The left subtree is the operator, and the @@ -443,6 +446,8 @@ enum demangle_component_type DEMANGLE_COMPONENT_PACK_EXPANSION, /* A name with an ABI tag. */ DEMANGLE_COMPONENT_TAGGED_NAME, + /* A transaction-safe function type. */ + DEMANGLE_COMPONENT_TRANSACTION_SAFE, /* A cloned function. */ DEMANGLE_COMPONENT_CLONE }; diff --git a/include/dwarf2.def b/include/dwarf2.def index ea8127c8b..2dfee5666 100644 --- a/include/dwarf2.def +++ b/include/dwarf2.def @@ -1,9 +1,7 @@ /* -*- c -*- Declarations and definitions of codes relating to the DWARF2 and DWARF3 symbolic debugging information formats. - Copyright (C) 1992, 1993, 1995, 1996, 1997, 1999, 2000, 2001, 2002, - 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 - Free Software Foundation, Inc. + Copyright (C) 1992-2015 Free Software Foundation, Inc. Written by Gary Funck (gary@intrepid.com) The Ada Joint Program Office (AJPO), Florida State University and Silicon Graphics Inc. @@ -406,6 +404,13 @@ DW_AT (DW_AT_VMS_rtnbeg_pd_address, 0x2201) See http://gcc.gnu.org/wiki/DW_AT_GNAT_descriptive_type . */ DW_AT (DW_AT_use_GNAT_descriptive_type, 0x2301) DW_AT (DW_AT_GNAT_descriptive_type, 0x2302) +/* Rational constant extension. + See https://gcc.gnu.org/wiki/DW_AT_GNU_numerator_denominator . */ +DW_TAG (DW_AT_GNU_numerator, 0x2303) +DW_TAG (DW_AT_GNU_denominator, 0x2304) +/* Biased integer extension. + See https://gcc.gnu.org/wiki/DW_AT_GNU_bias . */ +DW_TAG (DW_AT_GNU_bias, 0x2305) /* UPC extension. */ DW_AT (DW_AT_upc_threads_scaled, 0x3210) /* PGI (STMicroelectronics) extensions. */ diff --git a/include/dwarf2.h b/include/dwarf2.h index e05955cad..4ada87162 100644 --- a/include/dwarf2.h +++ b/include/dwarf2.h @@ -1,8 +1,6 @@ /* Declarations and definitions of codes relating to the DWARF2 and DWARF3 symbolic debugging information formats. - Copyright (C) 1992, 1993, 1995, 1996, 1997, 1999, 2000, 2001, 2002, - 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 - Free Software Foundation, Inc. + Copyright (C) 1992-2015 Free Software Foundation, Inc. Written by Gary Funck (gary@intrepid.com) The Ada Joint Program Office (AJPO), Florida State University and Silicon Graphics Inc. diff --git a/include/dyn-string.h b/include/dyn-string.h index 2b147271e..7c3684b7c 100644 --- a/include/dyn-string.h +++ b/include/dyn-string.h @@ -1,6 +1,5 @@ /* An abstract string datatype. - Copyright (C) 1998, 1999, 2000, 2002, 2004, 2005, 2009 - Free Software Foundation, Inc. + Copyright (C) 1998-2015 Free Software Foundation, Inc. Contributed by Mark Mitchell (mark@markmitchell.com). This file is part of GCC. diff --git a/include/environ.h b/include/environ.h new file mode 100644 index 000000000..c18902ba5 --- /dev/null +++ b/include/environ.h @@ -0,0 +1,33 @@ +/* Declare the environ system variable. + Copyright (C) 2015 Free Software Foundation, Inc. + +This file is part of the libiberty library. +Libiberty is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +Libiberty 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 libiberty; see the file COPYING.LIB. If not, +write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, +Boston, MA 02110-1301, USA. */ + +/* On OSX, the environ variable can be used directly in the code of an + executable, but cannot be used in the code of a shared library (such as + GCC's liblto_plugin, which links in libiberty code). Instead, the + function _NSGetEnviron can be called to get the address of environ. */ + +#ifndef HAVE_ENVIRON_DECL +# ifdef __APPLE__ +# include +# define environ (*_NSGetEnviron ()) +# else +extern char **environ; +# endif +# define HAVE_ENVIRON_DECL +#endif diff --git a/include/fibheap.h b/include/fibheap.h index a3d09dd9d..85b10c58b 100644 --- a/include/fibheap.h +++ b/include/fibheap.h @@ -1,6 +1,5 @@ /* A Fibonacci heap datatype. - Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2009 - Free Software Foundation, Inc. + Copyright (C) 1998-2015 Free Software Foundation, Inc. Contributed by Daniel Berlin (dan@cgsoftware.com). This file is part of GCC. diff --git a/include/filenames.h b/include/filenames.h index 470c5e091..1161daaa4 100644 --- a/include/filenames.h +++ b/include/filenames.h @@ -5,7 +5,7 @@ use forward- and back-slash in path names interchangeably, and some of them have case-insensitive file names. - Copyright 2000, 2001, 2007, 2010 Free Software Foundation, Inc. + Copyright (C) 2000-2015 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. diff --git a/include/floatformat.h b/include/floatformat.h index e15e07c22..af4d09cb8 100644 --- a/include/floatformat.h +++ b/include/floatformat.h @@ -1,6 +1,5 @@ /* IEEE floating point support declarations, for GDB, the GNU Debugger. - Copyright 1991, 1994, 1995, 1997, 2000, 2003, 2005, 2010 - Free Software Foundation, Inc. + Copyright (C) 1991-2015 Free Software Foundation, Inc. This file is part of GDB. diff --git a/include/fnmatch.h b/include/fnmatch.h index 5b9953ca3..0789fc146 100644 --- a/include/fnmatch.h +++ b/include/fnmatch.h @@ -1,4 +1,4 @@ -/* Copyright 1991, 1992, 1993, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1991-2015 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu. diff --git a/include/gcc-c-fe.def b/include/gcc-c-fe.def index 19cb8674d..25ace1c85 100644 --- a/include/gcc-c-fe.def +++ b/include/gcc-c-fe.def @@ -1,6 +1,6 @@ /* Interface between GCC C FE and GDB -*- c -*- - Copyright (C) 2014 Free Software Foundation, Inc. + Copyright (C) 2014-2015 Free Software Foundation, Inc. This file is part of GCC. diff --git a/include/gcc-c-interface.h b/include/gcc-c-interface.h index 25ef62f6e..95d0fc94e 100644 --- a/include/gcc-c-interface.h +++ b/include/gcc-c-interface.h @@ -1,6 +1,6 @@ /* Interface between GCC C FE and GDB - Copyright (C) 2014 Free Software Foundation, Inc. + Copyright (C) 2014-2015 Free Software Foundation, Inc. This file is part of GCC. diff --git a/include/gcc-interface.h b/include/gcc-interface.h index 34010f247..df7db6ec1 100644 --- a/include/gcc-interface.h +++ b/include/gcc-interface.h @@ -1,6 +1,6 @@ /* Generic interface between GCC and GDB - Copyright (C) 2014 Free Software Foundation, Inc. + Copyright (C) 2014-2015 Free Software Foundation, Inc. This file is part of GCC. diff --git a/include/gdb/gdb-index.h b/include/gdb/gdb-index.h index b43c68f9e..4e3d0a754 100644 --- a/include/gdb/gdb-index.h +++ b/include/gdb/gdb-index.h @@ -1,5 +1,5 @@ /* Public attributes of the .gdb_index section. - Copyright 2012 Free Software Foundation, Inc. + Copyright (C) 2012-2015 Free Software Foundation, Inc. This file is part of GDB. diff --git a/include/getopt.h b/include/getopt.h index 5421cabed..6f496b113 100644 --- a/include/getopt.h +++ b/include/getopt.h @@ -1,6 +1,5 @@ /* Declarations for getopt. - Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997, 1998, 2000, - 2002 Free Software Foundation, Inc. + Copyright (C) 1989-2015 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@gnu.org. diff --git a/include/gomp-constants.h b/include/gomp-constants.h index e3d2820d7..e31c2e003 100644 --- a/include/gomp-constants.h +++ b/include/gomp-constants.h @@ -39,6 +39,7 @@ /* Special map kinds, enumerated starting here. */ #define GOMP_MAP_FLAG_SPECIAL_0 (1 << 2) #define GOMP_MAP_FLAG_SPECIAL_1 (1 << 3) +#define GOMP_MAP_FLAG_SPECIAL_2 (1 << 4) #define GOMP_MAP_FLAG_SPECIAL (GOMP_MAP_FLAG_SPECIAL_1 \ | GOMP_MAP_FLAG_SPECIAL_0) /* Flag to force a specific behavior (or else, trigger a run-time error). */ @@ -66,10 +67,28 @@ enum gomp_map_kind /* Must already be present. */ GOMP_MAP_FORCE_PRESENT = (GOMP_MAP_FLAG_SPECIAL_0 | 2), /* Deallocate a mapping, without copying from device. */ - GOMP_MAP_FORCE_DEALLOC = (GOMP_MAP_FLAG_SPECIAL_0 | 3), + GOMP_MAP_DELETE = (GOMP_MAP_FLAG_SPECIAL_0 | 3), /* Is a device pointer. OMP_CLAUSE_SIZE for these is unused; is implicitly POINTER_SIZE_UNITS. */ GOMP_MAP_FORCE_DEVICEPTR = (GOMP_MAP_FLAG_SPECIAL_1 | 0), + /* Do not map, copy bits for firstprivate instead. */ + /* OpenACC device_resident. */ + GOMP_MAP_DEVICE_RESIDENT = (GOMP_MAP_FLAG_SPECIAL_1 | 1), + /* OpenACC link. */ + GOMP_MAP_LINK = (GOMP_MAP_FLAG_SPECIAL_1 | 2), + /* Allocate. */ + GOMP_MAP_FIRSTPRIVATE = (GOMP_MAP_FLAG_SPECIAL | 0), + /* Similarly, but store the value in the pointer rather than + pointed by the pointer. */ + GOMP_MAP_FIRSTPRIVATE_INT = (GOMP_MAP_FLAG_SPECIAL | 1), + /* Pointer translate host address into device address and copy that + back to host. */ + GOMP_MAP_USE_DEVICE_PTR = (GOMP_MAP_FLAG_SPECIAL | 2), + /* Allocate a zero length array section. Prefer next non-zero length + mapping over previous non-zero length mapping over zero length mapping + at the address. If not already mapped, do nothing (and pointer translate + to NULL). */ + GOMP_MAP_ZERO_LEN_ARRAY_SECTION = (GOMP_MAP_FLAG_SPECIAL | 3), /* Allocate. */ GOMP_MAP_FORCE_ALLOC = (GOMP_MAP_FLAG_FORCE | GOMP_MAP_ALLOC), /* ..., and copy to device. */ @@ -77,7 +96,44 @@ enum gomp_map_kind /* ..., and copy from device. */ GOMP_MAP_FORCE_FROM = (GOMP_MAP_FLAG_FORCE | GOMP_MAP_FROM), /* ..., and copy to and from device. */ - GOMP_MAP_FORCE_TOFROM = (GOMP_MAP_FLAG_FORCE | GOMP_MAP_TOFROM) + GOMP_MAP_FORCE_TOFROM = (GOMP_MAP_FLAG_FORCE | GOMP_MAP_TOFROM), + /* If not already present, allocate. And unconditionally copy to + device. */ + GOMP_MAP_ALWAYS_TO = (GOMP_MAP_FLAG_SPECIAL_2 | GOMP_MAP_TO), + /* If not already present, allocate. And unconditionally copy from + device. */ + GOMP_MAP_ALWAYS_FROM = (GOMP_MAP_FLAG_SPECIAL_2 + | GOMP_MAP_FROM), + /* If not already present, allocate. And unconditionally copy to and from + device. */ + GOMP_MAP_ALWAYS_TOFROM = (GOMP_MAP_FLAG_SPECIAL_2 + | GOMP_MAP_TOFROM), + /* Map a sparse struct; the address is the base of the structure, alignment + it's required alignment, and size is the number of adjacent entries + that belong to the struct. The adjacent entries should be sorted by + increasing address, so it is easy to determine lowest needed address + (address of the first adjacent entry) and highest needed address + (address of the last adjacent entry plus its size). */ + GOMP_MAP_STRUCT = (GOMP_MAP_FLAG_SPECIAL_2 + | GOMP_MAP_FLAG_SPECIAL | 0), + /* On a location of a pointer/reference that is assumed to be already mapped + earlier, store the translated address of the preceeding mapping. + No refcount is bumped by this, and the store is done unconditionally. */ + GOMP_MAP_ALWAYS_POINTER = (GOMP_MAP_FLAG_SPECIAL_2 + | GOMP_MAP_FLAG_SPECIAL | 1), + /* Forced deallocation of zero length array section. */ + GOMP_MAP_DELETE_ZERO_LEN_ARRAY_SECTION + = (GOMP_MAP_FLAG_SPECIAL_2 + | GOMP_MAP_FLAG_SPECIAL | 3), + /* Decrement usage count and deallocate if zero. */ + GOMP_MAP_RELEASE = (GOMP_MAP_FLAG_SPECIAL_2 + | GOMP_MAP_DELETE), + + /* Internal to GCC, not used in libgomp. */ + /* Do not map, but pointer assign a pointer instead. */ + GOMP_MAP_FIRSTPRIVATE_POINTER = (GOMP_MAP_LAST | 1), + /* Do not map, but pointer assign a reference instead. */ + GOMP_MAP_FIRSTPRIVATE_REFERENCE = (GOMP_MAP_LAST | 2) }; #define GOMP_MAP_COPY_TO_P(X) \ @@ -91,6 +147,15 @@ enum gomp_map_kind #define GOMP_MAP_POINTER_P(X) \ ((X) == GOMP_MAP_POINTER) +#define GOMP_MAP_ALWAYS_TO_P(X) \ + (((X) == GOMP_MAP_ALWAYS_TO) || ((X) == GOMP_MAP_ALWAYS_TOFROM)) + +#define GOMP_MAP_ALWAYS_FROM_P(X) \ + (((X) == GOMP_MAP_ALWAYS_FROM) || ((X) == GOMP_MAP_ALWAYS_TOFROM)) + +#define GOMP_MAP_ALWAYS_P(X) \ + (GOMP_MAP_ALWAYS_TO_P (X) || ((X) == GOMP_MAP_ALWAYS_FROM)) + /* Asynchronous behavior. Keep in sync with libgomp/{openacc.h,openacc.f90,openacc_lib.h}:acc_async_t. */ @@ -101,16 +166,92 @@ enum gomp_map_kind /* Device codes. Keep in sync with libgomp/{openacc.h,openacc.f90,openacc_lib.h}:acc_device_t as well as - libgomp/libgomp_target.h. */ + libgomp/libgomp-plugin.h. */ #define GOMP_DEVICE_NONE 0 #define GOMP_DEVICE_DEFAULT 1 #define GOMP_DEVICE_HOST 2 -#define GOMP_DEVICE_HOST_NONSHM 3 +/* #define GOMP_DEVICE_HOST_NONSHM 3 removed. */ #define GOMP_DEVICE_NOT_HOST 4 #define GOMP_DEVICE_NVIDIA_PTX 5 #define GOMP_DEVICE_INTEL_MIC 6 +#define GOMP_DEVICE_HSA 7 #define GOMP_DEVICE_ICV -1 #define GOMP_DEVICE_HOST_FALLBACK -2 +/* GOMP_task/GOMP_taskloop* flags argument. */ +#define GOMP_TASK_FLAG_UNTIED (1 << 0) +#define GOMP_TASK_FLAG_FINAL (1 << 1) +#define GOMP_TASK_FLAG_MERGEABLE (1 << 2) +#define GOMP_TASK_FLAG_DEPEND (1 << 3) +#define GOMP_TASK_FLAG_PRIORITY (1 << 4) +#define GOMP_TASK_FLAG_UP (1 << 8) +#define GOMP_TASK_FLAG_GRAINSIZE (1 << 9) +#define GOMP_TASK_FLAG_IF (1 << 10) +#define GOMP_TASK_FLAG_NOGROUP (1 << 11) + +/* GOMP_target{_ext,update_ext,enter_exit_data} flags argument. */ +#define GOMP_TARGET_FLAG_NOWAIT (1 << 0) +#define GOMP_TARGET_FLAG_EXIT_DATA (1 << 1) +/* Internal to libgomp. */ +#define GOMP_TARGET_FLAG_UPDATE (1U << 31) + +/* Versions of libgomp and device-specific plugins. */ +#define GOMP_VERSION 0 +#define GOMP_VERSION_NVIDIA_PTX 1 +#define GOMP_VERSION_INTEL_MIC 0 +#define GOMP_VERSION_HSA 0 + +#define GOMP_VERSION_PACK(LIB, DEV) (((LIB) << 16) | (DEV)) +#define GOMP_VERSION_LIB(PACK) (((PACK) >> 16) & 0xffff) +#define GOMP_VERSION_DEV(PACK) ((PACK) & 0xffff) + +#define GOMP_DIM_GANG 0 +#define GOMP_DIM_WORKER 1 +#define GOMP_DIM_VECTOR 2 +#define GOMP_DIM_MAX 3 +#define GOMP_DIM_MASK(X) (1u << (X)) + +/* Varadic launch arguments. End of list is marked by a zero. */ +#define GOMP_LAUNCH_DIM 1 /* Launch dimensions, op = mask */ +#define GOMP_LAUNCH_ASYNC 2 /* Async, op = cst val if not MAX */ +#define GOMP_LAUNCH_WAIT 3 /* Waits, op = num waits. */ +#define GOMP_LAUNCH_CODE_SHIFT 28 +#define GOMP_LAUNCH_DEVICE_SHIFT 16 +#define GOMP_LAUNCH_OP_SHIFT 0 +#define GOMP_LAUNCH_PACK(CODE,DEVICE,OP) \ + (((CODE) << GOMP_LAUNCH_CODE_SHIFT) \ + | ((DEVICE) << GOMP_LAUNCH_DEVICE_SHIFT) \ + | ((OP) << GOMP_LAUNCH_OP_SHIFT)) +#define GOMP_LAUNCH_CODE(X) (((X) >> GOMP_LAUNCH_CODE_SHIFT) & 0xf) +#define GOMP_LAUNCH_DEVICE(X) (((X) >> GOMP_LAUNCH_DEVICE_SHIFT) & 0xfff) +#define GOMP_LAUNCH_OP(X) (((X) >> GOMP_LAUNCH_OP_SHIFT) & 0xffff) +#define GOMP_LAUNCH_OP_MAX 0xffff + +/* Bitmask to apply in order to find out the intended device of a target + argument. */ +#define GOMP_TARGET_ARG_DEVICE_MASK ((1 << 7) - 1) +/* The target argument is significant for all devices. */ +#define GOMP_TARGET_ARG_DEVICE_ALL 0 + +/* Flag set when the subsequent element in the device-specific argument + values. */ +#define GOMP_TARGET_ARG_SUBSEQUENT_PARAM (1 << 7) + +/* Bitmask to apply to a target argument to find out the value identifier. */ +#define GOMP_TARGET_ARG_ID_MASK (((1 << 8) - 1) << 8) +/* Target argument index of NUM_TEAMS. */ +#define GOMP_TARGET_ARG_NUM_TEAMS (1 << 8) +/* Target argument index of THREAD_LIMIT. */ +#define GOMP_TARGET_ARG_THREAD_LIMIT (2 << 8) + +/* If the value is directly embeded in target argument, it should be a 16-bit + at most and shifted by this many bits. */ +#define GOMP_TARGET_ARG_VALUE_SHIFT 16 + +/* HSA specific data structures. */ + +/* Identifiers of device-specific target arguments. */ +#define GOMP_TARGET_ARG_HSA_KERNEL_ATTRIBUTES (1 << 8) + #endif diff --git a/include/hashtab.h b/include/hashtab.h index 188b8494d..b1b5877aa 100644 --- a/include/hashtab.h +++ b/include/hashtab.h @@ -1,6 +1,5 @@ /* An expandable hash tables datatype. - Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005, 2009, 2010 - Free Software Foundation, Inc. + Copyright (C) 1999-2015 Free Software Foundation, Inc. Contributed by Vladimir Makarov (vmakarov@cygnus.com). This program is free software; you can redistribute it and/or modify diff --git a/include/leb128.h b/include/leb128.h index f584f72e5..56016b0f7 100644 --- a/include/leb128.h +++ b/include/leb128.h @@ -1,5 +1,5 @@ /* Utilities for reading leb128 values. - Copyright (C) 2012 Free Software Foundation, Inc. + Copyright (C) 2012-2015 Free Software Foundation, Inc. This file is part of the libiberty library. Libiberty is free software; you can redistribute it and/or diff --git a/include/libiberty.h b/include/libiberty.h index b33dd6598..a9c885fc6 100644 --- a/include/libiberty.h +++ b/include/libiberty.h @@ -80,7 +80,7 @@ extern void freeargv (char **); /* Duplicate an argument vector. Allocates memory using malloc. Use freeargv to free the vector. */ -extern char **dupargv (char **) ATTRIBUTE_MALLOC; +extern char **dupargv (char * const *) ATTRIBUTE_MALLOC; /* Expand "@file" arguments in argv. */ @@ -88,11 +88,11 @@ extern void expandargv (int *, char ***); /* Write argv to an @-file, inserting necessary quoting. */ -extern int writeargv (char **, FILE *); +extern int writeargv (char * const *, FILE *); /* Return the number of elements in argv. */ -extern int countargv (char**); +extern int countargv (char * const *); /* Return the last component of a path name. Note that we can't use a prototype here because the parameter is declared inconsistently @@ -621,7 +621,7 @@ extern int pexecute (const char *, char * const *, const char *, extern int pwait (int, int *, int); -#if !HAVE_DECL_ASPRINTF +#if defined(HAVE_DECL_ASPRINTF) && !HAVE_DECL_ASPRINTF /* Like sprintf but provides a pointer to malloc'd storage, which must be freed by the caller. */ diff --git a/include/longlong.h b/include/longlong.h index 8cd2c7989..34ad9b4f5 100644 --- a/include/longlong.h +++ b/include/longlong.h @@ -1,5 +1,5 @@ /* longlong.h -- definitions for mixed size 32/64 bit arithmetic. - Copyright (C) 1991-2014 Free Software Foundation, Inc. + Copyright (C) 1991-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -1086,7 +1086,7 @@ extern UDItype __umulsidi3 (USItype, USItype); } while (0) #endif -#if defined(__sh__) && !__SHMEDIA__ && W_TYPE_SIZE == 32 +#if defined(__sh__) && (!defined (__SHMEDIA__) || !__SHMEDIA__) && W_TYPE_SIZE == 32 #ifndef __sh1__ #define umul_ppmm(w1, w0, u, v) \ __asm__ ( \ @@ -1102,6 +1102,33 @@ extern UDItype __umulsidi3 (USItype, USItype); /* This is the same algorithm as __udiv_qrnnd_c. */ #define UDIV_NEEDS_NORMALIZATION 1 +#ifdef __FDPIC__ +/* FDPIC needs a special version of the asm fragment to extract the + code address from the function descriptor. __udiv_qrnnd_16 is + assumed to be local and not to use the GOT, so loading r12 is + not needed. */ +#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" \ +" mov.l @%5,r2\n" \ +" jsr @r2\n" \ +" shll16 r6\n" \ +" swap.w r4,r4\n" \ +" mov.l @%5,r2\n" \ +" jsr @r2\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) +#else #define udiv_qrnnd(q, r, n1, n0, d) \ do { \ extern UWtype __udiv_qrnnd_16 (UWtype, UWtype) \ @@ -1121,6 +1148,7 @@ extern UDItype __umulsidi3 (USItype, USItype); : "1" (n1), "r" (n0), "rm" (d), "r" (&__udiv_qrnnd_16) \ : "r1", "r2", "r4", "r5", "r6", "pr", "t"); \ } while (0) +#endif /* __FDPIC__ */ #define UDIV_TIME 80 @@ -1131,7 +1159,7 @@ extern UDItype __umulsidi3 (USItype, USItype); #endif /* __sh__ */ -#if defined (__SH5__) && __SHMEDIA__ && W_TYPE_SIZE == 32 +#if defined (__SH5__) && defined (__SHMEDIA__) && __SHMEDIA__ && W_TYPE_SIZE == 32 #define __umulsidi3(u,v) ((UDItype)(USItype)u*(USItype)v) #define count_leading_zeros(count, x) \ do \ diff --git a/include/lto-symtab.h b/include/lto-symtab.h index 9312c5d9d..878d0502c 100644 --- a/include/lto-symtab.h +++ b/include/lto-symtab.h @@ -1,5 +1,5 @@ /* Data types used in the IL symbol table. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2015 Free Software Foundation, Inc. Contributed by Rafael Espindola This file is part of GCC. diff --git a/include/md5.h b/include/md5.h index 6da2fefe1..909f7b4df 100644 --- a/include/md5.h +++ b/include/md5.h @@ -1,6 +1,6 @@ /* md5.h - Declaration of functions and data types used for MD5 sum computing library functions. - Copyright 1995, 1996, 2000 Free Software Foundation, Inc. + Copyright (C) 1995-2015 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu. diff --git a/include/objalloc.h b/include/objalloc.h index 52857663b..2c0635090 100644 --- a/include/objalloc.h +++ b/include/objalloc.h @@ -1,5 +1,5 @@ /* objalloc.h -- routines to allocate memory for objects - Copyright 1997-2012 Free Software Foundation, Inc. + Copyright (C) 1997-2015 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Solutions. This program is free software; you can redistribute it and/or modify it diff --git a/include/obstack.h b/include/obstack.h index 23487ba4f..0d13c72d0 100644 --- a/include/obstack.h +++ b/include/obstack.h @@ -1,108 +1,102 @@ /* obstack.h - object stack macros - Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 - Free Software Foundation, Inc. + Copyright (C) 1988-2015 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. - NOTE: The canonical source of this file is maintained with the GNU C Library. - Bugs can be reported to bug-glibc@gnu.org. - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - This program is distributed in the hope that it will be useful, + 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 General Public License for more details. + 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 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. */ + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ /* Summary: -All the apparent functions defined here are macros. The idea -is that you would use these pre-tested macros to solve a -very specific set of problems, and they would run fast. -Caution: no side-effects in arguments please!! They may be -evaluated MANY times!! - -These macros operate a stack of objects. Each object starts life -small, and may grow to maturity. (Consider building a word syllable -by syllable.) An object can move while it is growing. Once it has -been "finished" it never changes address again. So the "top of the -stack" is typically an immature growing object, while the rest of the -stack is of mature, fixed size and fixed address objects. - -These routines grab large chunks of memory, using a function you -supply, called `obstack_chunk_alloc'. On occasion, they free chunks, -by calling `obstack_chunk_free'. You must define them and declare -them before using any obstack macros. - -Each independent stack is represented by a `struct obstack'. -Each of the obstack macros expects a pointer to such a structure -as the first argument. - -One motivation for this package is the problem of growing char strings -in symbol tables. Unless you are "fascist pig with a read-only mind" ---Gosper's immortal quote from HAKMEM item 154, out of context--you -would not like to put any arbitrary upper limit on the length of your -symbols. - -In practice this often means you will build many short symbols and a -few long symbols. At the time you are reading a symbol you don't know -how long it is. One traditional method is to read a symbol into a -buffer, realloc()ating the buffer every time you try to read a symbol -that is longer than the buffer. This is beaut, but you still will -want to copy the symbol from the buffer to a more permanent -symbol-table entry say about half the time. - -With obstacks, you can work differently. Use one obstack for all symbol -names. As you read a symbol, grow the name in the obstack gradually. -When the name is complete, finalize it. Then, if the symbol exists already, -free the newly read name. - -The way we do this is to take a large chunk, allocating memory from -low addresses. When you want to build a symbol in the chunk you just -add chars above the current "high water mark" in the chunk. When you -have finished adding chars, because you got to the end of the symbol, -you know how long the chars are, and you can create a new object. -Mostly the chars will not burst over the highest address of the chunk, -because you would typically expect a chunk to be (say) 100 times as -long as an average object. - -In case that isn't clear, when we have enough chars to make up -the object, THEY ARE ALREADY CONTIGUOUS IN THE CHUNK (guaranteed) -so we just point to it where it lies. No moving of chars is -needed and this is the second win: potentially long strings need -never be explicitly shuffled. Once an object is formed, it does not -change its address during its lifetime. - -When the chars burst over a chunk boundary, we allocate a larger -chunk, and then copy the partly formed object from the end of the old -chunk to the beginning of the new larger chunk. We then carry on -accreting characters to the end of the object as we normally would. - -A special macro is provided to add a single char at a time to a -growing object. This allows the use of register variables, which -break the ordinary 'growth' macro. - -Summary: - We allocate large chunks. - We carve out one object at a time from the current chunk. - Once carved, an object never moves. - We are free to append data of any size to the currently - growing object. - Exactly one object is growing in an obstack at any one time. - You can run one obstack per control block. - You may have as many control blocks as you dare. - Because of the way we do it, you can `unwind' an obstack - back to a previous state. (You may remove objects much - as you would with a stack.) -*/ + All the apparent functions defined here are macros. The idea + is that you would use these pre-tested macros to solve a + very specific set of problems, and they would run fast. + Caution: no side-effects in arguments please!! They may be + evaluated MANY times!! + + These macros operate a stack of objects. Each object starts life + small, and may grow to maturity. (Consider building a word syllable + by syllable.) An object can move while it is growing. Once it has + been "finished" it never changes address again. So the "top of the + stack" is typically an immature growing object, while the rest of the + stack is of mature, fixed size and fixed address objects. + + These routines grab large chunks of memory, using a function you + supply, called 'obstack_chunk_alloc'. On occasion, they free chunks, + by calling 'obstack_chunk_free'. You must define them and declare + them before using any obstack macros. + + Each independent stack is represented by a 'struct obstack'. + Each of the obstack macros expects a pointer to such a structure + as the first argument. + + One motivation for this package is the problem of growing char strings + in symbol tables. Unless you are "fascist pig with a read-only mind" + --Gosper's immortal quote from HAKMEM item 154, out of context--you + would not like to put any arbitrary upper limit on the length of your + symbols. + + In practice this often means you will build many short symbols and a + few long symbols. At the time you are reading a symbol you don't know + how long it is. One traditional method is to read a symbol into a + buffer, realloc()ating the buffer every time you try to read a symbol + that is longer than the buffer. This is beaut, but you still will + want to copy the symbol from the buffer to a more permanent + symbol-table entry say about half the time. + + With obstacks, you can work differently. Use one obstack for all symbol + names. As you read a symbol, grow the name in the obstack gradually. + When the name is complete, finalize it. Then, if the symbol exists already, + free the newly read name. + + The way we do this is to take a large chunk, allocating memory from + low addresses. When you want to build a symbol in the chunk you just + add chars above the current "high water mark" in the chunk. When you + have finished adding chars, because you got to the end of the symbol, + you know how long the chars are, and you can create a new object. + Mostly the chars will not burst over the highest address of the chunk, + because you would typically expect a chunk to be (say) 100 times as + long as an average object. + + In case that isn't clear, when we have enough chars to make up + the object, THEY ARE ALREADY CONTIGUOUS IN THE CHUNK (guaranteed) + so we just point to it where it lies. No moving of chars is + needed and this is the second win: potentially long strings need + never be explicitly shuffled. Once an object is formed, it does not + change its address during its lifetime. + + When the chars burst over a chunk boundary, we allocate a larger + chunk, and then copy the partly formed object from the end of the old + chunk to the beginning of the new larger chunk. We then carry on + accreting characters to the end of the object as we normally would. + + A special macro is provided to add a single char at a time to a + growing object. This allows the use of register variables, which + break the ordinary 'growth' macro. + + Summary: + We allocate large chunks. + We carve out one object at a time from the current chunk. + Once carved, an object never moves. + We are free to append data of any size to the currently + growing object. + Exactly one object is growing in an obstack at any one time. + You can run one obstack per control block. + You may have as many control blocks as you dare. + Because of the way we do it, you can "unwind" an obstack + back to a previous state. (You may remove objects much + as you would with a stack.) + */ /* Don't do the contents of this file more than once. */ @@ -110,144 +104,128 @@ Summary: #ifndef _OBSTACK_H #define _OBSTACK_H 1 -#ifdef __cplusplus -extern "C" { +#ifndef _OBSTACK_INTERFACE_VERSION +# define _OBSTACK_INTERFACE_VERSION 2 #endif - -/* We use subtraction of (char *) 0 instead of casting to int - because on word-addressable machines a simple cast to int - may ignore the byte-within-word field of the pointer. */ -#ifndef __PTR_TO_INT -# define __PTR_TO_INT(P) ((P) - (char *) 0) -#endif +#include /* For size_t and ptrdiff_t. */ +#include /* For __GNU_LIBRARY__, and memcpy. */ -#ifndef __INT_TO_PTR -# define __INT_TO_PTR(P) ((P) + (char *) 0) +#if _OBSTACK_INTERFACE_VERSION == 1 +/* For binary compatibility with obstack version 1, which used "int" + and "long" for these two types. */ +# define _OBSTACK_SIZE_T unsigned int +# define _CHUNK_SIZE_T unsigned long +# define _OBSTACK_CAST(type, expr) ((type) (expr)) +#else +/* Version 2 with sane types, especially for 64-bit hosts. */ +# define _OBSTACK_SIZE_T size_t +# define _CHUNK_SIZE_T size_t +# define _OBSTACK_CAST(type, expr) (expr) #endif -/* We need the type of the resulting object. If __PTRDIFF_TYPE__ is - defined, as with GNU C, use that; that way we don't pollute the - namespace with 's symbols. Otherwise, if is - available, include it and use ptrdiff_t. In traditional C, long is - the best that we can do. */ +/* If B is the base of an object addressed by P, return the result of + aligning P to the next multiple of A + 1. B and P must be of type + char *. A + 1 must be a power of 2. */ -#ifdef __PTRDIFF_TYPE__ -# define PTR_INT_TYPE __PTRDIFF_TYPE__ -#else -# ifdef HAVE_STDDEF_H -# include -# define PTR_INT_TYPE ptrdiff_t +#define __BPTR_ALIGN(B, P, A) ((B) + (((P) - (B) + (A)) & ~(A))) + +/* Similar to __BPTR_ALIGN (B, P, A), except optimize the common case + where pointers can be converted to integers, aligned as integers, + and converted back again. If ptrdiff_t is narrower than a + pointer (e.g., the AS/400), play it safe and compute the alignment + relative to B. Otherwise, use the faster strategy of computing the + alignment relative to 0. */ + +#define __PTR_ALIGN(B, P, A) \ + __BPTR_ALIGN (sizeof (ptrdiff_t) < sizeof (void *) ? (B) : (char *) 0, \ + P, A) + +#ifndef __attribute_pure__ +# if defined __GNUC_MINOR__ && __GNUC__ * 1000 + __GNUC_MINOR__ >= 2096 +# define __attribute_pure__ __attribute__ ((__pure__)) # else -# define PTR_INT_TYPE long +# define __attribute_pure__ # endif #endif -#if defined _LIBC || defined HAVE_STRING_H -# include -# define _obstack_memcpy(To, From, N) memcpy ((To), (From), (N)) -#else -# ifdef memcpy -# define _obstack_memcpy(To, From, N) memcpy ((To), (char *)(From), (N)) -# else -# define _obstack_memcpy(To, From, N) bcopy ((char *)(From), (To), (N)) -# endif +#ifdef __cplusplus +extern "C" { #endif -struct _obstack_chunk /* Lives at front of each chunk. */ +struct _obstack_chunk /* Lives at front of each chunk. */ { - char *limit; /* 1 past end of this chunk */ - struct _obstack_chunk *prev; /* address of prior chunk or NULL */ - char contents[4]; /* objects begin here */ + char *limit; /* 1 past end of this chunk */ + struct _obstack_chunk *prev; /* address of prior chunk or NULL */ + char contents[4]; /* objects begin here */ }; -struct obstack /* control current object in current chunk */ +struct obstack /* control current object in current chunk */ { - long chunk_size; /* preferred size to allocate chunks in */ - struct _obstack_chunk *chunk; /* address of current struct obstack_chunk */ - char *object_base; /* address of object we are building */ - char *next_free; /* where to add next char to current object */ - char *chunk_limit; /* address of char after current chunk */ - PTR_INT_TYPE temp; /* Temporary for some macros. */ - int alignment_mask; /* Mask of alignment for each object. */ - /* These prototypes vary based on `use_extra_arg', and we use - casts to the prototypeless function type in all assignments, - but having prototypes here quiets -Wstrict-prototypes. */ - struct _obstack_chunk *(*chunkfun) (void *, long); - void (*freefun) (void *, struct _obstack_chunk *); - void *extra_arg; /* first arg for chunk alloc/dealloc funcs */ - unsigned use_extra_arg:1; /* chunk alloc/dealloc funcs take extra arg */ - unsigned maybe_empty_object:1;/* There is a possibility that the current - chunk contains a zero-length object. This - prevents freeing the chunk if we allocate - a bigger chunk to replace it. */ - unsigned alloc_failed:1; /* No longer used, as we now call the failed - handler on error, but retained for binary - compatibility. */ + _CHUNK_SIZE_T chunk_size; /* preferred size to allocate chunks in */ + struct _obstack_chunk *chunk; /* address of current struct obstack_chunk */ + char *object_base; /* address of object we are building */ + char *next_free; /* where to add next char to current object */ + char *chunk_limit; /* address of char after current chunk */ + union + { + _OBSTACK_SIZE_T i; + void *p; + } temp; /* Temporary for some macros. */ + _OBSTACK_SIZE_T alignment_mask; /* Mask of alignment for each object. */ + + /* These prototypes vary based on 'use_extra_arg'. */ + union + { + void *(*plain) (size_t); + void *(*extra) (void *, size_t); + } chunkfun; + union + { + void (*plain) (void *); + void (*extra) (void *, void *); + } freefun; + + void *extra_arg; /* first arg for chunk alloc/dealloc funcs */ + unsigned use_extra_arg : 1; /* chunk alloc/dealloc funcs take extra arg */ + unsigned maybe_empty_object : 1; /* There is a possibility that the current + chunk contains a zero-length object. This + prevents freeing the chunk if we allocate + a bigger chunk to replace it. */ + unsigned alloc_failed : 1; /* No longer used, as we now call the failed + handler on error, but retained for binary + compatibility. */ }; /* Declare the external functions we use; they are in obstack.c. */ -extern void _obstack_newchunk (struct obstack *, int); +extern void _obstack_newchunk (struct obstack *, _OBSTACK_SIZE_T); extern void _obstack_free (struct obstack *, void *); -extern int _obstack_begin (struct obstack *, int, int, - void *(*) (long), void (*) (void *)); -extern int _obstack_begin_1 (struct obstack *, int, int, - void *(*) (void *, long), - void (*) (void *, void *), void *); -extern int _obstack_memory_used (struct obstack *); - -/* Do the function-declarations after the structs - but before defining the macros. */ - -void obstack_init (struct obstack *obstack); - -void * obstack_alloc (struct obstack *obstack, int size); - -void * obstack_copy (struct obstack *obstack, void *address, int size); -void * obstack_copy0 (struct obstack *obstack, void *address, int size); - -void obstack_free (struct obstack *obstack, void *block); - -void obstack_blank (struct obstack *obstack, int size); - -void obstack_grow (struct obstack *obstack, void *data, int size); -void obstack_grow0 (struct obstack *obstack, void *data, int size); - -void obstack_1grow (struct obstack *obstack, int data_char); -void obstack_ptr_grow (struct obstack *obstack, void *data); -void obstack_int_grow (struct obstack *obstack, int data); - -void * obstack_finish (struct obstack *obstack); - -int obstack_object_size (struct obstack *obstack); - -int obstack_room (struct obstack *obstack); -void obstack_make_room (struct obstack *obstack, int size); -void obstack_1grow_fast (struct obstack *obstack, int data_char); -void obstack_ptr_grow_fast (struct obstack *obstack, void *data); -void obstack_int_grow_fast (struct obstack *obstack, int data); -void obstack_blank_fast (struct obstack *obstack, int size); - -void * obstack_base (struct obstack *obstack); -void * obstack_next_free (struct obstack *obstack); -int obstack_alignment_mask (struct obstack *obstack); -int obstack_chunk_size (struct obstack *obstack); -int obstack_memory_used (struct obstack *obstack); - -/* Error handler called when `obstack_chunk_alloc' failed to allocate - more memory. This can be set to a user defined function. The - default action is to print a message and abort. */ +extern int _obstack_begin (struct obstack *, + _OBSTACK_SIZE_T, _OBSTACK_SIZE_T, + void *(*) (size_t), void (*) (void *)); +extern int _obstack_begin_1 (struct obstack *, + _OBSTACK_SIZE_T, _OBSTACK_SIZE_T, + void *(*) (void *, size_t), + void (*) (void *, void *), void *); +extern _OBSTACK_SIZE_T _obstack_memory_used (struct obstack *) + __attribute_pure__; + + +/* Error handler called when 'obstack_chunk_alloc' failed to allocate + more memory. This can be set to a user defined function which + should either abort gracefully or use longjump - but shouldn't + return. The default action is to print a message and abort. */ extern void (*obstack_alloc_failed_handler) (void); -/* Exit value used when `print_and_abort' is used. */ +/* Exit value used when 'print_and_abort' is used. */ extern int obstack_exit_failure; - + /* Pointer to beginning of object being allocated or to be allocated next. Note that this might not be the final address of the object because a new chunk might be needed to hold the final size. */ -#define obstack_base(h) ((h)->object_base) +#define obstack_base(h) ((void *) (h)->object_base) /* Size for allocating ordinary chunks. */ @@ -255,203 +233,210 @@ extern int obstack_exit_failure; /* Pointer to next byte not yet allocated in current chunk. */ -#define obstack_next_free(h) ((h)->next_free) +#define obstack_next_free(h) ((void *) (h)->next_free) /* Mask specifying low bits that should be clear in address of an object. */ #define obstack_alignment_mask(h) ((h)->alignment_mask) -/* To prevent prototype warnings provide complete argument list in - standard C version. */ -# define obstack_init(h) \ - _obstack_begin ((h), 0, 0, \ - (void *(*) (long)) obstack_chunk_alloc, (void (*) (void *)) obstack_chunk_free) +/* To prevent prototype warnings provide complete argument list. */ +#define obstack_init(h) \ + _obstack_begin ((h), 0, 0, \ + _OBSTACK_CAST (void *(*) (size_t), obstack_chunk_alloc), \ + _OBSTACK_CAST (void (*) (void *), obstack_chunk_free)) -# define obstack_begin(h, size) \ - _obstack_begin ((h), (size), 0, \ - (void *(*) (long)) obstack_chunk_alloc, (void (*) (void *)) obstack_chunk_free) +#define obstack_begin(h, size) \ + _obstack_begin ((h), (size), 0, \ + _OBSTACK_CAST (void *(*) (size_t), obstack_chunk_alloc), \ + _OBSTACK_CAST (void (*) (void *), obstack_chunk_free)) -# define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \ - _obstack_begin ((h), (size), (alignment), \ - (void *(*) (long)) (chunkfun), (void (*) (void *)) (freefun)) +#define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \ + _obstack_begin ((h), (size), (alignment), \ + _OBSTACK_CAST (void *(*) (size_t), chunkfun), \ + _OBSTACK_CAST (void (*) (void *), freefun)) -# define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \ - _obstack_begin_1 ((h), (size), (alignment), \ - (void *(*) (void *, long)) (chunkfun), \ - (void (*) (void *, void *)) (freefun), (arg)) +#define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \ + _obstack_begin_1 ((h), (size), (alignment), \ + _OBSTACK_CAST (void *(*) (void *, size_t), chunkfun), \ + _OBSTACK_CAST (void (*) (void *, void *), freefun), arg) -# define obstack_chunkfun(h, newchunkfun) \ - ((h) -> chunkfun = (struct _obstack_chunk *(*)(void *, long)) (newchunkfun)) +#define obstack_chunkfun(h, newchunkfun) \ + ((void) ((h)->chunkfun.extra = (void *(*) (void *, size_t)) (newchunkfun))) -# define obstack_freefun(h, newfreefun) \ - ((h) -> freefun = (void (*)(void *, struct _obstack_chunk *)) (newfreefun)) +#define obstack_freefun(h, newfreefun) \ + ((void) ((h)->freefun.extra = (void *(*) (void *, void *)) (newfreefun))) -#define obstack_1grow_fast(h,achar) (*((h)->next_free)++ = (achar)) +#define obstack_1grow_fast(h, achar) ((void) (*((h)->next_free)++ = (achar))) -#define obstack_blank_fast(h,n) ((h)->next_free += (n)) +#define obstack_blank_fast(h, n) ((void) ((h)->next_free += (n))) #define obstack_memory_used(h) _obstack_memory_used (h) - -#if defined __GNUC__ && defined __STDC__ && __STDC__ -/* NextStep 2.0 cc is really gcc 1.93 but it defines __GNUC__ = 2 and - does not implement __extension__. But that compiler doesn't define - __GNUC_MINOR__. */ -# if __GNUC__ < 2 || (__NeXT__ && !__GNUC_MINOR__) + +#if defined __GNUC__ +# if !defined __GNUC_MINOR__ || __GNUC__ * 1000 + __GNUC_MINOR__ < 2008 # define __extension__ # endif /* For GNU C, if not -traditional, we can define these macros to compute all args only once without using a global variable. - Also, we can avoid using the `temp' slot, to make faster code. */ - -# define obstack_object_size(OBSTACK) \ - __extension__ \ - ({ struct obstack *__o = (OBSTACK); \ - (unsigned) (__o->next_free - __o->object_base); }) - -# define obstack_room(OBSTACK) \ - __extension__ \ - ({ struct obstack *__o = (OBSTACK); \ - (unsigned) (__o->chunk_limit - __o->next_free); }) - -# define obstack_make_room(OBSTACK,length) \ -__extension__ \ -({ struct obstack *__o = (OBSTACK); \ - int __len = (length); \ - if (__o->chunk_limit - __o->next_free < __len) \ - _obstack_newchunk (__o, __len); \ - (void) 0; }) - -# define obstack_empty_p(OBSTACK) \ - __extension__ \ - ({ struct obstack *__o = (OBSTACK); \ - (__o->chunk->prev == 0 && __o->next_free - __o->chunk->contents == 0); }) - -# define obstack_grow(OBSTACK,where,length) \ -__extension__ \ -({ struct obstack *__o = (OBSTACK); \ - int __len = (length); \ - if (__o->next_free + __len > __o->chunk_limit) \ - _obstack_newchunk (__o, __len); \ - _obstack_memcpy (__o->next_free, (where), __len); \ - __o->next_free += __len; \ - (void) 0; }) - -# define obstack_grow0(OBSTACK,where,length) \ -__extension__ \ -({ struct obstack *__o = (OBSTACK); \ - int __len = (length); \ - if (__o->next_free + __len + 1 > __o->chunk_limit) \ - _obstack_newchunk (__o, __len + 1); \ - _obstack_memcpy (__o->next_free, (where), __len); \ - __o->next_free += __len; \ - *(__o->next_free)++ = 0; \ - (void) 0; }) - -# define obstack_1grow(OBSTACK,datum) \ -__extension__ \ -({ struct obstack *__o = (OBSTACK); \ - if (__o->next_free + 1 > __o->chunk_limit) \ - _obstack_newchunk (__o, 1); \ - obstack_1grow_fast (__o, datum); \ - (void) 0; }) - -/* These assume that the obstack alignment is good enough for pointers or ints, - and that the data added so far to the current object + Also, we can avoid using the 'temp' slot, to make faster code. */ + +# define obstack_object_size(OBSTACK) \ + __extension__ \ + ({ struct obstack const *__o = (OBSTACK); \ + (_OBSTACK_SIZE_T) (__o->next_free - __o->object_base); }) + +/* The local variable is named __o1 to avoid a shadowed variable + warning when invoked from other obstack macros. */ +# define obstack_room(OBSTACK) \ + __extension__ \ + ({ struct obstack const *__o1 = (OBSTACK); \ + (_OBSTACK_SIZE_T) (__o1->chunk_limit - __o1->next_free); }) + +# define obstack_make_room(OBSTACK, length) \ + __extension__ \ + ({ struct obstack *__o = (OBSTACK); \ + _OBSTACK_SIZE_T __len = (length); \ + if (obstack_room (__o) < __len) \ + _obstack_newchunk (__o, __len); \ + (void) 0; }) + +# define obstack_empty_p(OBSTACK) \ + __extension__ \ + ({ struct obstack const *__o = (OBSTACK); \ + (__o->chunk->prev == 0 \ + && __o->next_free == __PTR_ALIGN ((char *) __o->chunk, \ + __o->chunk->contents, \ + __o->alignment_mask)); }) + +# define obstack_grow(OBSTACK, where, length) \ + __extension__ \ + ({ struct obstack *__o = (OBSTACK); \ + _OBSTACK_SIZE_T __len = (length); \ + if (obstack_room (__o) < __len) \ + _obstack_newchunk (__o, __len); \ + memcpy (__o->next_free, where, __len); \ + __o->next_free += __len; \ + (void) 0; }) + +# define obstack_grow0(OBSTACK, where, length) \ + __extension__ \ + ({ struct obstack *__o = (OBSTACK); \ + _OBSTACK_SIZE_T __len = (length); \ + if (obstack_room (__o) < __len + 1) \ + _obstack_newchunk (__o, __len + 1); \ + memcpy (__o->next_free, where, __len); \ + __o->next_free += __len; \ + *(__o->next_free)++ = 0; \ + (void) 0; }) + +# define obstack_1grow(OBSTACK, datum) \ + __extension__ \ + ({ struct obstack *__o = (OBSTACK); \ + if (obstack_room (__o) < 1) \ + _obstack_newchunk (__o, 1); \ + obstack_1grow_fast (__o, datum); }) + +/* These assume that the obstack alignment is good enough for pointers + or ints, and that the data added so far to the current object shares that much alignment. */ -# define obstack_ptr_grow(OBSTACK,datum) \ -__extension__ \ -({ struct obstack *__o = (OBSTACK); \ - if (__o->next_free + sizeof (void *) > __o->chunk_limit) \ - _obstack_newchunk (__o, sizeof (void *)); \ - obstack_ptr_grow_fast (__o, datum); }) - -# define obstack_int_grow(OBSTACK,datum) \ -__extension__ \ -({ struct obstack *__o = (OBSTACK); \ - if (__o->next_free + sizeof (int) > __o->chunk_limit) \ - _obstack_newchunk (__o, sizeof (int)); \ - obstack_int_grow_fast (__o, datum); }) - -# define obstack_ptr_grow_fast(OBSTACK,aptr) \ -__extension__ \ -({ struct obstack *__o1 = (OBSTACK); \ - *(const void **) __o1->next_free = (aptr); \ - __o1->next_free += sizeof (const void *); \ - (void) 0; }) - -# define obstack_int_grow_fast(OBSTACK,aint) \ -__extension__ \ -({ struct obstack *__o1 = (OBSTACK); \ - *(int *) __o1->next_free = (aint); \ - __o1->next_free += sizeof (int); \ - (void) 0; }) - -# define obstack_blank(OBSTACK,length) \ -__extension__ \ -({ struct obstack *__o = (OBSTACK); \ - int __len = (length); \ - if (__o->chunk_limit - __o->next_free < __len) \ - _obstack_newchunk (__o, __len); \ - obstack_blank_fast (__o, __len); \ - (void) 0; }) - -# define obstack_alloc(OBSTACK,length) \ -__extension__ \ -({ struct obstack *__h = (OBSTACK); \ - obstack_blank (__h, (length)); \ - obstack_finish (__h); }) - -# define obstack_copy(OBSTACK,where,length) \ -__extension__ \ -({ struct obstack *__h = (OBSTACK); \ - obstack_grow (__h, (where), (length)); \ - obstack_finish (__h); }) - -# define obstack_copy0(OBSTACK,where,length) \ -__extension__ \ -({ struct obstack *__h = (OBSTACK); \ - obstack_grow0 (__h, (where), (length)); \ - obstack_finish (__h); }) - -/* The local variable is named __o1 to avoid a name conflict - when obstack_blank is called. */ -# define obstack_finish(OBSTACK) \ -__extension__ \ -({ struct obstack *__o1 = (OBSTACK); \ - void *value; \ - value = (void *) __o1->object_base; \ - if (__o1->next_free == value) \ - __o1->maybe_empty_object = 1; \ - __o1->next_free \ - = __INT_TO_PTR ((__PTR_TO_INT (__o1->next_free)+__o1->alignment_mask)\ - & ~ (__o1->alignment_mask)); \ - if (__o1->next_free - (char *)__o1->chunk \ - > __o1->chunk_limit - (char *)__o1->chunk) \ - __o1->next_free = __o1->chunk_limit; \ - __o1->object_base = __o1->next_free; \ - value; }) - -# define obstack_free(OBSTACK, OBJ) \ -__extension__ \ -({ struct obstack *__o = (OBSTACK); \ - void *__obj = (void *) (OBJ); \ - if (__obj > (void *)__o->chunk && __obj < (void *)__o->chunk_limit) \ - __o->next_free = __o->object_base = (char *) __obj; \ - else (obstack_free) (__o, __obj); }) - -#else /* not __GNUC__ or not __STDC__ */ - -# define obstack_object_size(h) \ - (unsigned) ((h)->next_free - (h)->object_base) - -# define obstack_room(h) \ - (unsigned) ((h)->chunk_limit - (h)->next_free) - -# define obstack_empty_p(h) \ - ((h)->chunk->prev == 0 && (h)->next_free - (h)->chunk->contents == 0) +# define obstack_ptr_grow(OBSTACK, datum) \ + __extension__ \ + ({ struct obstack *__o = (OBSTACK); \ + if (obstack_room (__o) < sizeof (void *)) \ + _obstack_newchunk (__o, sizeof (void *)); \ + obstack_ptr_grow_fast (__o, datum); }) + +# define obstack_int_grow(OBSTACK, datum) \ + __extension__ \ + ({ struct obstack *__o = (OBSTACK); \ + if (obstack_room (__o) < sizeof (int)) \ + _obstack_newchunk (__o, sizeof (int)); \ + obstack_int_grow_fast (__o, datum); }) + +# define obstack_ptr_grow_fast(OBSTACK, aptr) \ + __extension__ \ + ({ struct obstack *__o1 = (OBSTACK); \ + void *__p1 = __o1->next_free; \ + *(const void **) __p1 = (aptr); \ + __o1->next_free += sizeof (const void *); \ + (void) 0; }) + +# define obstack_int_grow_fast(OBSTACK, aint) \ + __extension__ \ + ({ struct obstack *__o1 = (OBSTACK); \ + void *__p1 = __o1->next_free; \ + *(int *) __p1 = (aint); \ + __o1->next_free += sizeof (int); \ + (void) 0; }) + +# define obstack_blank(OBSTACK, length) \ + __extension__ \ + ({ struct obstack *__o = (OBSTACK); \ + _OBSTACK_SIZE_T __len = (length); \ + if (obstack_room (__o) < __len) \ + _obstack_newchunk (__o, __len); \ + obstack_blank_fast (__o, __len); }) + +# define obstack_alloc(OBSTACK, length) \ + __extension__ \ + ({ struct obstack *__h = (OBSTACK); \ + obstack_blank (__h, (length)); \ + obstack_finish (__h); }) + +# define obstack_copy(OBSTACK, where, length) \ + __extension__ \ + ({ struct obstack *__h = (OBSTACK); \ + obstack_grow (__h, (where), (length)); \ + obstack_finish (__h); }) + +# define obstack_copy0(OBSTACK, where, length) \ + __extension__ \ + ({ struct obstack *__h = (OBSTACK); \ + obstack_grow0 (__h, (where), (length)); \ + obstack_finish (__h); }) + +/* The local variable is named __o1 to avoid a shadowed variable + warning when invoked from other obstack macros, typically obstack_free. */ +# define obstack_finish(OBSTACK) \ + __extension__ \ + ({ struct obstack *__o1 = (OBSTACK); \ + void *__value = (void *) __o1->object_base; \ + if (__o1->next_free == __value) \ + __o1->maybe_empty_object = 1; \ + __o1->next_free \ + = __PTR_ALIGN (__o1->object_base, __o1->next_free, \ + __o1->alignment_mask); \ + if ((size_t) (__o1->next_free - (char *) __o1->chunk) \ + > (size_t) (__o1->chunk_limit - (char *) __o1->chunk)) \ + __o1->next_free = __o1->chunk_limit; \ + __o1->object_base = __o1->next_free; \ + __value; }) + +# define obstack_free(OBSTACK, OBJ) \ + __extension__ \ + ({ struct obstack *__o = (OBSTACK); \ + void *__obj = (void *) (OBJ); \ + if (__obj > (void *) __o->chunk && __obj < (void *) __o->chunk_limit) \ + __o->next_free = __o->object_base = (char *) __obj; \ + else \ + _obstack_free (__o, __obj); }) + +#else /* not __GNUC__ */ + +# define obstack_object_size(h) \ + ((_OBSTACK_SIZE_T) ((h)->next_free - (h)->object_base)) + +# define obstack_room(h) \ + ((_OBSTACK_SIZE_T) ((h)->chunk_limit - (h)->next_free)) + +# define obstack_empty_p(h) \ + ((h)->chunk->prev == 0 \ + && (h)->next_free == __PTR_ALIGN ((char *) (h)->chunk, \ + (h)->chunk->contents, \ + (h)->alignment_mask)) /* Note that the call to _obstack_newchunk is enclosed in (..., 0) so that we can avoid having void expressions @@ -459,87 +444,92 @@ __extension__ \ Casting the third operand to void was tried before, but some compilers won't accept it. */ -# define obstack_make_room(h,length) \ -( (h)->temp = (length), \ - (((h)->next_free + (h)->temp > (h)->chunk_limit) \ - ? (_obstack_newchunk ((h), (h)->temp), 0) : 0)) - -# define obstack_grow(h,where,length) \ -( (h)->temp = (length), \ - (((h)->next_free + (h)->temp > (h)->chunk_limit) \ - ? (_obstack_newchunk ((h), (h)->temp), 0) : 0), \ - _obstack_memcpy ((h)->next_free, (where), (h)->temp), \ - (h)->next_free += (h)->temp) - -# define obstack_grow0(h,where,length) \ -( (h)->temp = (length), \ - (((h)->next_free + (h)->temp + 1 > (h)->chunk_limit) \ - ? (_obstack_newchunk ((h), (h)->temp + 1), 0) : 0), \ - _obstack_memcpy ((h)->next_free, (where), (h)->temp), \ - (h)->next_free += (h)->temp, \ - *((h)->next_free)++ = 0) - -# define obstack_1grow(h,datum) \ -( (((h)->next_free + 1 > (h)->chunk_limit) \ - ? (_obstack_newchunk ((h), 1), 0) : 0), \ - obstack_1grow_fast (h, datum)) - -# define obstack_ptr_grow(h,datum) \ -( (((h)->next_free + sizeof (char *) > (h)->chunk_limit) \ - ? (_obstack_newchunk ((h), sizeof (char *)), 0) : 0), \ - obstack_ptr_grow_fast (h, datum)) - -# define obstack_int_grow(h,datum) \ -( (((h)->next_free + sizeof (int) > (h)->chunk_limit) \ - ? (_obstack_newchunk ((h), sizeof (int)), 0) : 0), \ - obstack_int_grow_fast (h, datum)) - -# define obstack_ptr_grow_fast(h,aptr) \ - (((const void **) ((h)->next_free += sizeof (void *)))[-1] = (aptr)) - -# define obstack_int_grow_fast(h,aint) \ - (((int *) ((h)->next_free += sizeof (int)))[-1] = (aptr)) - -# define obstack_blank(h,length) \ -( (h)->temp = (length), \ - (((h)->chunk_limit - (h)->next_free < (h)->temp) \ - ? (_obstack_newchunk ((h), (h)->temp), 0) : 0), \ - obstack_blank_fast (h, (h)->temp)) - -# define obstack_alloc(h,length) \ - (obstack_blank ((h), (length)), obstack_finish ((h))) - -# define obstack_copy(h,where,length) \ - (obstack_grow ((h), (where), (length)), obstack_finish ((h))) - -# define obstack_copy0(h,where,length) \ - (obstack_grow0 ((h), (where), (length)), obstack_finish ((h))) - -# define obstack_finish(h) \ -( ((h)->next_free == (h)->object_base \ - ? (((h)->maybe_empty_object = 1), 0) \ - : 0), \ - (h)->temp = __PTR_TO_INT ((h)->object_base), \ - (h)->next_free \ - = __INT_TO_PTR ((__PTR_TO_INT ((h)->next_free)+(h)->alignment_mask) \ - & ~ ((h)->alignment_mask)), \ - (((h)->next_free - (char *) (h)->chunk \ - > (h)->chunk_limit - (char *) (h)->chunk) \ - ? ((h)->next_free = (h)->chunk_limit) : 0), \ - (h)->object_base = (h)->next_free, \ - (void *) __INT_TO_PTR ((h)->temp)) - -# define obstack_free(h,obj) \ -( (h)->temp = (char *) (obj) - (char *) (h)->chunk, \ - (((h)->temp > 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\ - ? (((h)->next_free = (h)->object_base \ - = (h)->temp + (char *) (h)->chunk), 0) \ - : ((obstack_free) ((h), (h)->temp + (char *) (h)->chunk), 0))) - -#endif /* not __GNUC__ or not __STDC__ */ +# define obstack_make_room(h, length) \ + ((h)->temp.i = (length), \ + ((obstack_room (h) < (h)->temp.i) \ + ? (_obstack_newchunk (h, (h)->temp.i), 0) : 0), \ + (void) 0) + +# define obstack_grow(h, where, length) \ + ((h)->temp.i = (length), \ + ((obstack_room (h) < (h)->temp.i) \ + ? (_obstack_newchunk ((h), (h)->temp.i), 0) : 0), \ + memcpy ((h)->next_free, where, (h)->temp.i), \ + (h)->next_free += (h)->temp.i, \ + (void) 0) + +# define obstack_grow0(h, where, length) \ + ((h)->temp.i = (length), \ + ((obstack_room (h) < (h)->temp.i + 1) \ + ? (_obstack_newchunk ((h), (h)->temp.i + 1), 0) : 0), \ + memcpy ((h)->next_free, where, (h)->temp.i), \ + (h)->next_free += (h)->temp.i, \ + *((h)->next_free)++ = 0, \ + (void) 0) + +# define obstack_1grow(h, datum) \ + (((obstack_room (h) < 1) \ + ? (_obstack_newchunk ((h), 1), 0) : 0), \ + obstack_1grow_fast (h, datum)) + +# define obstack_ptr_grow(h, datum) \ + (((obstack_room (h) < sizeof (char *)) \ + ? (_obstack_newchunk ((h), sizeof (char *)), 0) : 0), \ + obstack_ptr_grow_fast (h, datum)) + +# define obstack_int_grow(h, datum) \ + (((obstack_room (h) < sizeof (int)) \ + ? (_obstack_newchunk ((h), sizeof (int)), 0) : 0), \ + obstack_int_grow_fast (h, datum)) + +# define obstack_ptr_grow_fast(h, aptr) \ + (((const void **) ((h)->next_free += sizeof (void *)))[-1] = (aptr), \ + (void) 0) + +# define obstack_int_grow_fast(h, aint) \ + (((int *) ((h)->next_free += sizeof (int)))[-1] = (aint), \ + (void) 0) + +# define obstack_blank(h, length) \ + ((h)->temp.i = (length), \ + ((obstack_room (h) < (h)->temp.i) \ + ? (_obstack_newchunk ((h), (h)->temp.i), 0) : 0), \ + obstack_blank_fast (h, (h)->temp.i)) + +# define obstack_alloc(h, length) \ + (obstack_blank ((h), (length)), obstack_finish ((h))) + +# define obstack_copy(h, where, length) \ + (obstack_grow ((h), (where), (length)), obstack_finish ((h))) + +# define obstack_copy0(h, where, length) \ + (obstack_grow0 ((h), (where), (length)), obstack_finish ((h))) + +# define obstack_finish(h) \ + (((h)->next_free == (h)->object_base \ + ? (((h)->maybe_empty_object = 1), 0) \ + : 0), \ + (h)->temp.p = (h)->object_base, \ + (h)->next_free \ + = __PTR_ALIGN ((h)->object_base, (h)->next_free, \ + (h)->alignment_mask), \ + (((size_t) ((h)->next_free - (char *) (h)->chunk) \ + > (size_t) ((h)->chunk_limit - (char *) (h)->chunk)) \ + ? ((h)->next_free = (h)->chunk_limit) : 0), \ + (h)->object_base = (h)->next_free, \ + (h)->temp.p) + +# define obstack_free(h, obj) \ + ((h)->temp.p = (void *) (obj), \ + (((h)->temp.p > (void *) (h)->chunk \ + && (h)->temp.p < (void *) (h)->chunk_limit) \ + ? (void) ((h)->next_free = (h)->object_base = (char *) (h)->temp.p) \ + : _obstack_free ((h), (h)->temp.p))) + +#endif /* not __GNUC__ */ #ifdef __cplusplus -} /* C++ */ +} /* C++ */ #endif -#endif /* obstack.h */ +#endif /* _OBSTACK_H */ diff --git a/include/partition.h b/include/partition.h index d8b554f8f..c39873b60 100644 --- a/include/partition.h +++ b/include/partition.h @@ -45,12 +45,12 @@ extern "C" { struct partition_elem { - /* The canonical element that represents the class containing this - element. */ - int class_element; /* The next element in this class. Elements in each class form a circular list. */ struct partition_elem* next; + /* The canonical element that represents the class containing this + element. */ + int class_element; /* The number of elements in this class. Valid only if this is the canonical element for its class. */ unsigned class_count; diff --git a/include/plugin-api.h b/include/plugin-api.h index 5797d4dce..a794a3704 100644 --- a/include/plugin-api.h +++ b/include/plugin-api.h @@ -1,6 +1,6 @@ /* plugin-api.h -- External linker plugin API. */ -/* Copyright 2009, 2010 Free Software Foundation, Inc. +/* Copyright (C) 2009-2016 Free Software Foundation, Inc. Written by Cary Coutant . This file is part of binutils. @@ -345,6 +345,26 @@ enum ld_plugin_status const struct ld_plugin_section * section_list, unsigned int num_sections); +/* The linker's interface for retrieving the section alignment requirement + of a specific section in an object. This interface should only be invoked in the + claim_file handler. This function sets *ADDRALIGN to the ELF sh_addralign + value of the input section. */ + +typedef +enum ld_plugin_status +(*ld_plugin_get_input_section_alignment) (const struct ld_plugin_section section, + unsigned int *addralign); + +/* The linker's interface for retrieving the section size of a specific section + in an object. This interface should only be invoked in the claim_file handler. + This function sets *SECSIZE to the ELF sh_size + value of the input section. */ + +typedef +enum ld_plugin_status +(*ld_plugin_get_input_section_size) (const struct ld_plugin_section section, + uint64_t *secsize); + enum ld_plugin_level { LDPL_INFO, @@ -384,7 +404,10 @@ enum ld_plugin_tag LDPT_ALLOW_SECTION_ORDERING = 24, LDPT_GET_SYMBOLS_V2 = 25, LDPT_ALLOW_UNIQUE_SEGMENT_FOR_SECTIONS = 26, - LDPT_UNIQUE_SEGMENT_FOR_SECTIONS = 27 + LDPT_UNIQUE_SEGMENT_FOR_SECTIONS = 27, + LDPT_GET_SYMBOLS_V3 = 28, + LDPT_GET_INPUT_SECTION_ALIGNMENT = 29, + LDPT_GET_INPUT_SECTION_SIZE = 30 }; /* The plugin transfer vector. */ @@ -416,6 +439,8 @@ struct ld_plugin_tv ld_plugin_allow_section_ordering tv_allow_section_ordering; ld_plugin_allow_unique_segment_for_sections tv_allow_unique_segment_for_sections; ld_plugin_unique_segment_for_sections tv_unique_segment_for_sections; + ld_plugin_get_input_section_alignment tv_get_input_section_alignment; + ld_plugin_get_input_section_size tv_get_input_section_size; } tv_u; }; diff --git a/include/safe-ctype.h b/include/safe-ctype.h index 0266bf1aa..a6d163e6e 100644 --- a/include/safe-ctype.h +++ b/include/safe-ctype.h @@ -1,6 +1,6 @@ /* replacement macros. - Copyright (C) 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 2000-2015 Free Software Foundation, Inc. Contributed by Zack Weinberg . This file is part of the libiberty library. diff --git a/include/sha1.h b/include/sha1.h index 4da5c37f3..24f3ab79d 100644 --- a/include/sha1.h +++ b/include/sha1.h @@ -1,7 +1,6 @@ /* Declarations of functions and data types used for SHA1 sum library functions. - Copyright (C) 2000, 2001, 2003, 2005, 2006, 2008, 2010 - Free Software Foundation, Inc. + Copyright (C) 2000-2015 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the diff --git a/include/simple-object.h b/include/simple-object.h index c4786757a..5bd3d06c1 100644 --- a/include/simple-object.h +++ b/include/simple-object.h @@ -1,5 +1,5 @@ /* simple-object.h -- simple routines to read and write object files - Copyright 2010 Free Software Foundation, Inc. + Copyright (C) 2010-2015 Free Software Foundation, Inc. Written by Ian Lance Taylor, Google. This program is free software; you can redistribute it and/or modify it diff --git a/include/sort.h b/include/sort.h index 582af8162..23025d431 100644 --- a/include/sort.h +++ b/include/sort.h @@ -1,5 +1,5 @@ /* Sorting algorithms. - Copyright (C) 2000, 2002 Free Software Foundation, Inc. + Copyright (C) 2000-2015 Free Software Foundation, Inc. Contributed by Mark Mitchell . This file is part of GCC. diff --git a/include/splay-tree.h b/include/splay-tree.h index ec48a1fa5..f71d7d7b6 100644 --- a/include/splay-tree.h +++ b/include/splay-tree.h @@ -1,6 +1,5 @@ /* A splay-tree datatype. - Copyright 1998, 1999, 2000, 2002, 2005, 2007, 2009, 2010 - Free Software Foundation, Inc. + Copyright (C) 1998-2015 Free Software Foundation, Inc. Contributed by Mark Mitchell (mark@markmitchell.com). This file is part of GCC. diff --git a/include/symcat.h b/include/symcat.h index b46128796..95fc9b2c5 100644 --- a/include/symcat.h +++ b/include/symcat.h @@ -1,6 +1,6 @@ /* Symbol concatenation utilities. - Copyright (C) 1998, 2000, 2010 Free Software Foundation, Inc. + Copyright (C) 1998-2015 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/include/timeval-utils.h b/include/timeval-utils.h index 1caf9b36d..adbe8183f 100644 --- a/include/timeval-utils.h +++ b/include/timeval-utils.h @@ -1,5 +1,5 @@ /* Basic struct timeval utilities. - Copyright (C) 2011 Free Software Foundation, Inc. + Copyright (C) 2011-2015 Free Software Foundation, Inc. This file is part of the libiberty library. Libiberty is free software; you can redistribute it and/or diff --git a/include/vtv-change-permission.h b/include/vtv-change-permission.h index 1adcb9745..04ad8c3db 100644 --- a/include/vtv-change-permission.h +++ b/include/vtv-change-permission.h @@ -1,5 +1,4 @@ -/* Copyright (C) 2013 - Free Software Foundation +/* Copyright (C) 2013-2015 Free Software Foundation, Inc. This file is part of GCC. @@ -47,8 +46,12 @@ extern void __VLTChangePermission (int); /* TODO - Replace '4096' below with correct big page size. */ #define VTV_PAGE_SIZE 4096 #else +#if defined(__sun__) && defined(__svr4__) && defined(__sparc__) +#define VTV_PAGE_SIZE 8192 +#else #define VTV_PAGE_SIZE 4096 #endif +#endif diff --git a/include/xregex2.h b/include/xregex2.h index d3d0da14a..05066d4b2 100644 --- a/include/xregex2.h +++ b/include/xregex2.h @@ -1,8 +1,7 @@ /* Definitions for data structures and routines for the regular expression library, version 0.12. - Copyright (C) 1985, 1989, 1990, 1991, 1992, 1993, 1995, 1996, 1997, - 1998, 2000, 2005 Free Software Foundation, Inc. + Copyright (C) 1985-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. Its master source is NOT part of the C library, however. The master source lives in /gd/gnu/lib. diff --git a/include/xtensa-config.h b/include/xtensa-config.h index 30f4f41a2..5ae4c8060 100644 --- a/include/xtensa-config.h +++ b/include/xtensa-config.h @@ -1,6 +1,5 @@ /* Xtensa configuration settings. - Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010 - Free Software Foundation, Inc. + Copyright (C) 2001-2015 Free Software Foundation, Inc. Contributed by Bob Wilson (bob.wilson@acm.org) at Tensilica. This program is free software; you can redistribute it and/or modify -- cgit v1.2.3