Home | History | Annotate | Download | only in src
      1 /* A Bison parser, made by GNU Bison 1.875c.  */
      2 
      3 /* Skeleton parser for Yacc-like parsing with Bison,
      4    Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
      5 
      6    This program is free software; you can redistribute it and/or modify
      7    it under the terms of the GNU General Public License as published by
      8    the Free Software Foundation; either version 2, or (at your option)
      9    any later version.
     10 
     11    This program is distributed in the hope that it will be useful,
     12    but WITHOUT ANY WARRANTY; without even the implied warranty of
     13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14    GNU General Public License for more details.
     15 
     16    You should have received a copy of the GNU General Public License
     17    along with this program; if not, write to the Free Software
     18    Foundation, Inc., 59 Temple Place - Suite 330,
     19    Boston, MA 02111-1307, USA.  */
     20 
     21 /* As a special exception, when this file is copied by Bison into a
     22    Bison output file, you may use that output file without restriction.
     23    This special exception was added by the Free Software Foundation
     24    in version 1.24 of Bison.  */
     25 
     26 /* Written by Richard Stallman by simplifying the original so called
     27    ``semantic'' parser.  */
     28 
     29 /* All symbols defined below should begin with yy or YY, to avoid
     30    infringing on user name space.  This should be done even for local
     31    variables, as they might otherwise be expanded by user macros.
     32    There are some unavoidable exceptions within include files to
     33    define necessary library symbols; they are noted "INFRINGES ON
     34    USER NAME SPACE" below.  */
     35 
     36 /* Identify Bison output.  */
     37 #define YYBISON 1
     38 
     39 /* Skeleton name.  */
     40 #define YYSKELETON_NAME "yacc.c"
     41 
     42 /* Pure parsers.  */
     43 #define YYPURE 0
     44 
     45 /* Using locations.  */
     46 #define YYLSP_NEEDED 0
     47 
     48 /* If NAME_PREFIX is specified substitute the variables and functions
     49    names.  */
     50 #define yyparse ldparse
     51 #define yylex   ldlex
     52 #define yyerror lderror
     53 #define yylval  ldlval
     54 #define yychar  ldchar
     55 #define yydebug lddebug
     56 #define yynerrs ldnerrs
     57 
     58 
     59 /* Tokens.  */
     60 #ifndef YYTOKENTYPE
     61 # define YYTOKENTYPE
     62    /* Put the tokens into the symbol table, so that GDB and other debuggers
     63       know about them.  */
     64    enum yytokentype {
     65      kADD_OP = 258,
     66      kALIGN = 259,
     67      kENTRY = 260,
     68      kEXCLUDE_FILE = 261,
     69      kFILENAME = 262,
     70      kGLOBAL = 263,
     71      kGROUP = 264,
     72      kID = 265,
     73      kINPUT = 266,
     74      kINTERP = 267,
     75      kKEEP = 268,
     76      kLOCAL = 269,
     77      kMODE = 270,
     78      kMUL_OP = 271,
     79      kNUM = 272,
     80      kOUTPUT_FORMAT = 273,
     81      kPAGESIZE = 274,
     82      kPROVIDE = 275,
     83      kSEARCH_DIR = 276,
     84      kSEGMENT = 277,
     85      kSIZEOF_HEADERS = 278,
     86      kSORT = 279,
     87      kVERSION = 280,
     88      kVERSION_SCRIPT = 281,
     89      ADD_OP = 282,
     90      MUL_OP = 283
     91    };
     92 #endif
     93 #define kADD_OP 258
     94 #define kALIGN 259
     95 #define kENTRY 260
     96 #define kEXCLUDE_FILE 261
     97 #define kFILENAME 262
     98 #define kGLOBAL 263
     99 #define kGROUP 264
    100 #define kID 265
    101 #define kINPUT 266
    102 #define kINTERP 267
    103 #define kKEEP 268
    104 #define kLOCAL 269
    105 #define kMODE 270
    106 #define kMUL_OP 271
    107 #define kNUM 272
    108 #define kOUTPUT_FORMAT 273
    109 #define kPAGESIZE 274
    110 #define kPROVIDE 275
    111 #define kSEARCH_DIR 276
    112 #define kSEGMENT 277
    113 #define kSIZEOF_HEADERS 278
    114 #define kSORT 279
    115 #define kVERSION 280
    116 #define kVERSION_SCRIPT 281
    117 #define ADD_OP 282
    118 #define MUL_OP 283
    119 
    120 
    121 
    122 
    123 /* Copy the first part of user declarations.  */
    124 #line 1 "/home/drepper/gnu/elfutils/src/ldscript.y"
    125 
    126 /* Parser for linker scripts.
    127    Copyright (C) 2001, 2002, 2003, 2004 Red Hat, Inc.
    128    Written by Ulrich Drepper <drepper (at) redhat.com>, 2001.
    129 
    130    This program is Open Source software; you can redistribute it and/or
    131    modify it under the terms of the Open Software License version 1.0 as
    132    published by the Open Source Initiative.
    133 
    134    You should have received a copy of the Open Software License along
    135    with this program; if not, you may obtain a copy of the Open Software
    136    License version 1.0 from http://www.opensource.org/licenses/osl.php or
    137    by writing the Open Source Initiative c/o Lawrence Rosen, Esq.,
    138    3001 King Ranch Road, Ukiah, CA 95482.   */
    139 
    140 #ifdef HAVE_CONFIG_H
    141 # include <config.h>
    142 #endif
    143 
    144 #include <assert.h>
    145 #include <error.h>
    146 #include <libintl.h>
    147 #include <stdbool.h>
    148 #include <stdint.h>
    149 #include <stdio.h>
    150 #include <stdlib.h>
    151 #include <string.h>
    152 
    153 #include <system.h>
    154 #include <ld.h>
    155 
    156 /* The error handler.  */
    157 static void yyerror (const char *s);
    158 
    159 /* Some helper functions we need to construct the data structures
    160    describing information from the file.  */
    161 static struct expression *new_expr (int tag);
    162 static struct input_section_name *new_input_section_name (const char *name,
    163 							  bool sort_flag);
    164 static struct input_rule *new_input_rule (int tag);
    165 static struct output_rule *new_output_rule (int tag);
    166 static struct assignment *new_assignment (const char *variable,
    167 					  struct expression *expression,
    168 					  bool provide_flag);
    169 static void new_segment (int mode, struct output_rule *output_rule);
    170 static struct filename_list *new_filename_listelem (const char *string);
    171 static void add_inputfiles (struct filename_list *fnames);
    172 static struct id_list *new_id_listelem (const char *str);
    173 static struct version *new_version (struct id_list *local,
    174 				    struct id_list *global);
    175 static struct version *merge_versions (struct version *one,
    176 				       struct version *two);
    177 static void add_versions (struct version *versions);
    178 
    179 extern int yylex (void);
    180 
    181 
    182 /* Enabling traces.  */
    183 #ifndef YYDEBUG
    184 # define YYDEBUG 0
    185 #endif
    186 
    187 /* Enabling verbose error messages.  */
    188 #ifdef YYERROR_VERBOSE
    189 # undef YYERROR_VERBOSE
    190 # define YYERROR_VERBOSE 1
    191 #else
    192 # define YYERROR_VERBOSE 0
    193 #endif
    194 
    195 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
    196 #line 58 "/home/drepper/gnu/elfutils/src/ldscript.y"
    197 typedef union YYSTYPE {
    198   uintmax_t num;
    199   enum expression_tag op;
    200   char *str;
    201   struct expression *expr;
    202   struct input_section_name *sectionname;
    203   struct filemask_section_name *filemask_section_name;
    204   struct input_rule *input_rule;
    205   struct output_rule *output_rule;
    206   struct assignment *assignment;
    207   struct filename_list *filename_list;
    208   struct version *version;
    209   struct id_list *id_list;
    210 } YYSTYPE;
    211 /* Line 191 of yacc.c.  */
    212 #line 213 "ldscript.c"
    213 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
    214 # define YYSTYPE_IS_DECLARED 1
    215 # define YYSTYPE_IS_TRIVIAL 1
    216 #endif
    217 
    218 
    219 
    220 /* Copy the second part of user declarations.  */
    221 
    222 
    223 /* Line 214 of yacc.c.  */
    224 #line 225 "ldscript.c"
    225 
    226 #if ! defined (yyoverflow) || YYERROR_VERBOSE
    227 
    228 # ifndef YYFREE
    229 #  define YYFREE free
    230 # endif
    231 # ifndef YYMALLOC
    232 #  define YYMALLOC malloc
    233 # endif
    234 
    235 /* The parser invokes alloca or malloc; define the necessary symbols.  */
    236 
    237 # ifdef YYSTACK_USE_ALLOCA
    238 #  if YYSTACK_USE_ALLOCA
    239 #   define YYSTACK_ALLOC alloca
    240 #  endif
    241 # else
    242 #  if defined (alloca) || defined (_ALLOCA_H)
    243 #   define YYSTACK_ALLOC alloca
    244 #  else
    245 #   ifdef __GNUC__
    246 #    define YYSTACK_ALLOC __builtin_alloca
    247 #   endif
    248 #  endif
    249 # endif
    250 
    251 # ifdef YYSTACK_ALLOC
    252    /* Pacify GCC's `empty if-body' warning. */
    253 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
    254 # else
    255 #  if defined (__STDC__) || defined (__cplusplus)
    256 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
    257 #   define YYSIZE_T size_t
    258 #  endif
    259 #  define YYSTACK_ALLOC YYMALLOC
    260 #  define YYSTACK_FREE YYFREE
    261 # endif
    262 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
    263 
    264 
    265 #if (! defined (yyoverflow) \
    266      && (! defined (__cplusplus) \
    267 	 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
    268 
    269 /* A type that is properly aligned for any stack member.  */
    270 union yyalloc
    271 {
    272   short yyss;
    273   YYSTYPE yyvs;
    274   };
    275 
    276 /* The size of the maximum gap between one aligned stack and the next.  */
    277 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
    278 
    279 /* The size of an array large to enough to hold all stacks, each with
    280    N elements.  */
    281 # define YYSTACK_BYTES(N) \
    282      ((N) * (sizeof (short) + sizeof (YYSTYPE))				\
    283       + YYSTACK_GAP_MAXIMUM)
    284 
    285 /* Copy COUNT objects from FROM to TO.  The source and destination do
    286    not overlap.  */
    287 # ifndef YYCOPY
    288 #  if defined (__GNUC__) && 1 < __GNUC__
    289 #   define YYCOPY(To, From, Count) \
    290       __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
    291 #  else
    292 #   define YYCOPY(To, From, Count)		\
    293       do					\
    294 	{					\
    295 	  register YYSIZE_T yyi;		\
    296 	  for (yyi = 0; yyi < (Count); yyi++)	\
    297 	    (To)[yyi] = (From)[yyi];		\
    298 	}					\
    299       while (0)
    300 #  endif
    301 # endif
    302 
    303 /* Relocate STACK from its old location to the new one.  The
    304    local variables YYSIZE and YYSTACKSIZE give the old and new number of
    305    elements in the stack, and YYPTR gives the new location of the
    306    stack.  Advance YYPTR to a properly aligned location for the next
    307    stack.  */
    308 # define YYSTACK_RELOCATE(Stack)					\
    309     do									\
    310       {									\
    311 	YYSIZE_T yynewbytes;						\
    312 	YYCOPY (&yyptr->Stack, Stack, yysize);				\
    313 	Stack = &yyptr->Stack;						\
    314 	yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
    315 	yyptr += yynewbytes / sizeof (*yyptr);				\
    316       }									\
    317     while (0)
    318 
    319 #endif
    320 
    321 #if defined (__STDC__) || defined (__cplusplus)
    322    typedef signed char yysigned_char;
    323 #else
    324    typedef short yysigned_char;
    325 #endif
    326 
    327 /* YYFINAL -- State number of the termination state. */
    328 #define YYFINAL  30
    329 /* YYLAST -- Last index in YYTABLE.  */
    330 #define YYLAST   198
    331 
    332 /* YYNTOKENS -- Number of terminals. */
    333 #define YYNTOKENS  39
    334 /* YYNNTS -- Number of nonterminals. */
    335 #define YYNNTS  22
    336 /* YYNRULES -- Number of rules. */
    337 #define YYNRULES  62
    338 /* YYNRULES -- Number of states. */
    339 #define YYNSTATES  146
    340 
    341 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
    342 #define YYUNDEFTOK  2
    343 #define YYMAXUTOK   283
    344 
    345 #define YYTRANSLATE(YYX) 						\
    346   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
    347 
    348 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
    349 static const unsigned char yytranslate[] =
    350 {
    351        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    352        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    353        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    354        2,     2,     2,     2,     2,     2,     2,     2,    28,     2,
    355       32,    33,    30,     2,    38,     2,     2,     2,     2,     2,
    356        2,     2,     2,     2,     2,     2,     2,     2,     2,    34,
    357        2,    37,     2,     2,     2,     2,     2,     2,     2,     2,
    358        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    359        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    360        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    361        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    362        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    363        2,     2,     2,    35,    27,    36,     2,     2,     2,     2,
    364        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    365        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    366        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    367        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    368        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    369        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    370        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    371        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    372        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    373        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    374        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    375        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    376        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
    377        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
    378       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
    379       25,    26,    29,    31
    380 };
    381 
    382 #if YYDEBUG
    383 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
    384    YYRHS.  */
    385 static const unsigned char yyprhs[] =
    386 {
    387        0,     0,     3,     5,     8,    11,    13,    19,    25,    31,
    388       37,    43,    49,    54,    59,    64,    69,    72,    74,    77,
    389       82,    85,    89,    96,    99,   101,   103,   108,   111,   117,
    390      119,   124,   129,   130,   135,   139,   143,   147,   151,   155,
    391      159,   161,   163,   165,   167,   171,   173,   175,   176,   179,
    392      181,   186,   192,   199,   202,   204,   207,   210,   214,   217,
    393      219,   221,   223
    394 };
    395 
    396 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
    397 static const yysigned_char yyrhs[] =
    398 {
    399       40,     0,    -1,    41,    -1,    26,    54,    -1,    41,    42,
    400       -1,    42,    -1,     5,    32,    10,    33,    34,    -1,    21,
    401       32,    59,    33,    34,    -1,    19,    32,    17,    33,    34,
    402       -1,    12,    32,    59,    33,    34,    -1,    22,    15,    35,
    403       43,    36,    -1,    22,     1,    35,    43,    36,    -1,     9,
    404       32,    52,    33,    -1,    11,    32,    52,    33,    -1,    25,
    405       35,    54,    36,    -1,    18,    32,    59,    33,    -1,    43,
    406       44,    -1,    44,    -1,    45,    34,    -1,    10,    35,    46,
    407       36,    -1,    10,    34,    -1,    10,    37,    51,    -1,    20,
    408       32,    10,    37,    51,    33,    -1,    46,    47,    -1,    47,
    409       -1,    48,    -1,    13,    32,    48,    33,    -1,    45,    34,
    410       -1,    60,    32,    50,    49,    33,    -1,    10,    -1,    24,
    411       32,    10,    33,    -1,     6,    32,    59,    33,    -1,    -1,
    412        4,    32,    51,    33,    -1,    32,    51,    33,    -1,    51,
    413       30,    51,    -1,    51,    16,    51,    -1,    51,     3,    51,
    414       -1,    51,    28,    51,    -1,    51,    27,    51,    -1,    17,
    415       -1,    10,    -1,    23,    -1,    19,    -1,    52,    53,    59,
    416       -1,    59,    -1,    38,    -1,    -1,    54,    55,    -1,    55,
    417       -1,    35,    56,    36,    34,    -1,    59,    35,    56,    36,
    418       34,    -1,    59,    35,    56,    36,    59,    34,    -1,    56,
    419       57,    -1,    57,    -1,     8,    58,    -1,    14,    58,    -1,
    420       58,    60,    34,    -1,    60,    34,    -1,     7,    -1,    10,
    421       -1,    59,    -1,    30,    -1
    422 };
    423 
    424 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
    425 static const unsigned short yyrline[] =
    426 {
    427        0,   128,   128,   129,   133,   134,   137,   142,   146,   151,
    428      156,   160,   166,   177,   179,   181,   185,   190,   194,   199,
    429      211,   235,   237,   241,   246,   250,   255,   262,   269,   280,
    430      282,   286,   289,   292,   297,   299,   305,   311,   317,   323,
    431      329,   334,   339,   341,   345,   351,   355,   356,   359,   364,
    432      368,   374,   380,   389,   391,   395,   397,   402,   408,   412,
    433      414,   418,   420
    434 };
    435 #endif
    436 
    437 #if YYDEBUG || YYERROR_VERBOSE
    438 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
    439    First, the terminals, then, starting at YYNTOKENS, nonterminals. */
    440 static const char *const yytname[] =
    441 {
    442   "$end", "error", "$undefined", "kADD_OP", "kALIGN", "kENTRY",
    443   "kEXCLUDE_FILE", "kFILENAME", "kGLOBAL", "kGROUP", "kID", "kINPUT",
    444   "kINTERP", "kKEEP", "kLOCAL", "kMODE", "kMUL_OP", "kNUM",
    445   "kOUTPUT_FORMAT", "kPAGESIZE", "kPROVIDE", "kSEARCH_DIR", "kSEGMENT",
    446   "kSIZEOF_HEADERS", "kSORT", "kVERSION", "kVERSION_SCRIPT", "'|'", "'&'",
    447   "ADD_OP", "'*'", "MUL_OP", "'('", "')'", "';'", "'{'", "'}'", "'='",
    448   "','", "$accept", "script_or_version", "file", "content",
    449   "outputsections", "outputsection", "assignment", "inputsections",
    450   "inputsection", "sectionname", "sort_opt_name", "exclude_opt", "expr",
    451   "filename_id_list", "comma_opt", "versionlist", "version",
    452   "version_stmt_list", "version_stmt", "filename_id_star_list",
    453   "filename_id", "filename_id_star", 0
    454 };
    455 #endif
    456 
    457 # ifdef YYPRINT
    458 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
    459    token YYLEX-NUM.  */
    460 static const unsigned short yytoknum[] =
    461 {
    462        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
    463      265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
    464      275,   276,   277,   278,   279,   280,   281,   124,    38,   282,
    465       42,   283,    40,    41,    59,   123,   125,    61,    44
    466 };
    467 # endif
    468 
    469 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
    470 static const unsigned char yyr1[] =
    471 {
    472        0,    39,    40,    40,    41,    41,    42,    42,    42,    42,
    473       42,    42,    42,    42,    42,    42,    43,    43,    44,    44,
    474       44,    45,    45,    46,    46,    47,    47,    47,    48,    49,
    475       49,    50,    50,    51,    51,    51,    51,    51,    51,    51,
    476       51,    51,    51,    51,    52,    52,    53,    53,    54,    54,
    477       55,    55,    55,    56,    56,    57,    57,    58,    58,    59,
    478       59,    60,    60
    479 };
    480 
    481 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
    482 static const unsigned char yyr2[] =
    483 {
    484        0,     2,     1,     2,     2,     1,     5,     5,     5,     5,
    485        5,     5,     4,     4,     4,     4,     2,     1,     2,     4,
    486        2,     3,     6,     2,     1,     1,     4,     2,     5,     1,
    487        4,     4,     0,     4,     3,     3,     3,     3,     3,     3,
    488        1,     1,     1,     1,     3,     1,     1,     0,     2,     1,
    489        4,     5,     6,     2,     1,     2,     2,     3,     2,     1,
    490        1,     1,     1
    491 };
    492 
    493 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
    494    STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
    495    means the default is an error.  */
    496 static const unsigned char yydefact[] =
    497 {
    498        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
    499        0,     0,     2,     5,     0,     0,     0,     0,     0,     0,
    500        0,     0,     0,     0,    59,    60,     0,     3,    49,     0,
    501        1,     4,     0,    47,    45,    47,     0,     0,     0,     0,
    502        0,     0,     0,     0,     0,     0,    54,    48,     0,     0,
    503       12,    46,     0,    13,     0,    15,     0,     0,     0,     0,
    504        0,    17,     0,     0,    14,    62,    55,    61,     0,    56,
    505        0,    53,     0,     6,    44,     9,     8,     7,    20,     0,
    506        0,     0,    11,    16,    18,    10,     0,    58,    50,     0,
    507       60,     0,     0,     0,    24,    25,     0,     0,    41,    40,
    508       43,    42,     0,    21,     0,    57,    51,     0,     0,    27,
    509       19,    23,    32,     0,     0,     0,     0,     0,     0,     0,
    510        0,    52,     0,     0,     0,     0,    34,    37,    36,    39,
    511       38,    35,     0,    26,     0,    29,     0,     0,    33,    22,
    512        0,     0,    28,    31,     0,    30
    513 };
    514 
    515 /* YYDEFGOTO[NTERM-NUM]. */
    516 static const short yydefgoto[] =
    517 {
    518       -1,    11,    12,    13,    60,    61,    62,    93,    94,    95,
    519      137,   124,   103,    33,    52,    27,    28,    45,    46,    66,
    520       67,    96
    521 };
    522 
    523 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
    524    STATE-NUM.  */
    525 #define YYPACT_NINF -41
    526 static const short yypact[] =
    527 {
    528      107,   -28,   -20,   -13,    34,    77,    85,    88,    91,    33,
    529       38,   123,   125,   -41,   117,    52,    52,    52,    52,   114,
    530       52,   100,   103,    38,   -41,   -41,    96,    38,   -41,   110,
    531      -41,   -41,   115,    64,   -41,    67,   116,   118,   120,   127,
    532        1,     1,    28,    84,    84,    36,   -41,   -41,    96,   128,
    533      -41,   -41,    52,   -41,   129,   -41,   130,   131,   105,   134,
    534       75,   -41,   133,    79,   -41,   -41,    84,   -41,   135,    84,
    535      136,   -41,    41,   -41,   -41,   -41,   -41,   -41,   -41,    83,
    536       48,   151,   -41,   -41,   -41,   -41,   137,   -41,   -41,    44,
    537      138,   140,   139,    17,   -41,   -41,   142,   144,   -41,   -41,
    538      -41,   -41,    48,    54,   141,   -41,   -41,   143,    84,   -41,
    539      -41,   -41,   162,    48,    -2,    48,    48,    48,    48,    48,
    540       48,   -41,   146,   148,    97,     6,   -41,    54,    54,    58,
    541       53,    -1,    13,   -41,    52,   -41,   149,   150,   -41,   -41,
    542      152,   172,   -41,   -41,   153,   -41
    543 };
    544 
    545 /* YYPGOTO[NTERM-NUM].  */
    546 static const short yypgoto[] =
    547 {
    548      -41,   -41,   -41,   175,   147,   -40,    29,   -41,    98,    76,
    549      -41,   -41,    39,   173,   -41,   167,   -24,   145,    15,   154,
    550      -10,    32
    551 };
    552 
    553 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
    554    positive, shift that token.  If negative, reduce the rule which
    555    number is the opposite.  If zero, do what YYDEFACT says.
    556    If YYTABLE_NINF, syntax error.  */
    557 #define YYTABLE_NINF -1
    558 static const unsigned char yytable[] =
    559 {
    560       29,   115,   115,    47,    14,    34,    34,    36,    37,   115,
    561       39,    58,    15,    29,   116,   116,   115,    29,    47,    16,
    562       83,    59,   116,    83,    24,   117,   118,    90,   119,   116,
    563       91,   126,    29,   117,   118,    24,   119,    59,    25,   138,
    564      117,   118,    74,   119,    43,    24,   139,    65,    25,    43,
    565       44,    24,    97,   110,    25,    44,   115,   115,    98,    24,
    566       71,   115,    25,    26,    64,    99,    17,   100,    23,   116,
    567      116,   101,    70,    26,   116,    68,    68,    89,   106,   107,
    568      102,   117,   118,   119,   119,    58,   118,    71,   119,    58,
    569       24,    24,    21,    90,    25,    59,    91,    50,    86,    59,
    570       53,    86,    51,    59,    43,    51,    22,   135,    92,    18,
    571       44,    82,     1,    65,    65,    85,     2,    19,     3,     4,
    572       20,   136,    92,    30,   140,     5,     6,    32,     7,     8,
    573        1,    38,     9,    10,     2,    40,     3,     4,    41,    78,
    574       79,   114,    80,     5,     6,    48,     7,     8,    49,    54,
    575        9,    55,   125,    56,   127,   128,   129,   130,   131,   132,
    576       57,   104,    73,    75,    76,    77,    81,    84,   123,    87,
    577       88,   105,   108,   109,   112,    80,   113,   121,   120,   133,
    578      134,   141,   144,   142,   122,   143,   145,    31,    63,    35,
    579       42,   111,     0,    72,     0,     0,     0,     0,    69
    580 };
    581 
    582 static const short yycheck[] =
    583 {
    584       10,     3,     3,    27,    32,    15,    16,    17,    18,     3,
    585       20,    10,    32,    23,    16,    16,     3,    27,    42,    32,
    586       60,    20,    16,    63,     7,    27,    28,    10,    30,    16,
    587       13,    33,    42,    27,    28,     7,    30,    20,    10,    33,
    588       27,    28,    52,    30,     8,     7,    33,    30,    10,     8,
    589       14,     7,     4,    36,    10,    14,     3,     3,    10,     7,
    590       45,     3,    10,    35,    36,    17,    32,    19,    35,    16,
    591       16,    23,    36,    35,    16,    43,    44,    36,    34,    89,
    592       32,    27,    28,    30,    30,    10,    28,    72,    30,    10,
    593        7,     7,     1,    10,    10,    20,    13,    33,    66,    20,
    594       33,    69,    38,    20,     8,    38,    15,    10,    79,    32,
    595       14,    36,     5,    30,    30,    36,     9,    32,    11,    12,
    596       32,    24,    93,     0,   134,    18,    19,    10,    21,    22,
    597        5,    17,    25,    26,     9,    35,    11,    12,    35,    34,
    598       35,   102,    37,    18,    19,    35,    21,    22,    33,    33,
    599       25,    33,   113,    33,   115,   116,   117,   118,   119,   120,
    600       33,    10,    34,    34,    34,    34,    32,    34,     6,    34,
    601       34,    34,    32,    34,    32,    37,    32,    34,    37,    33,
    602       32,    32,    10,    33,   108,    33,    33,    12,    41,    16,
    603       23,    93,    -1,    48,    -1,    -1,    -1,    -1,    44
    604 };
    605 
    606 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
    607    symbol of state STATE-NUM.  */
    608 static const unsigned char yystos[] =
    609 {
    610        0,     5,     9,    11,    12,    18,    19,    21,    22,    25,
    611       26,    40,    41,    42,    32,    32,    32,    32,    32,    32,
    612       32,     1,    15,    35,     7,    10,    35,    54,    55,    59,
    613        0,    42,    10,    52,    59,    52,    59,    59,    17,    59,
    614       35,    35,    54,     8,    14,    56,    57,    55,    35,    33,
    615       33,    38,    53,    33,    33,    33,    33,    33,    10,    20,
    616       43,    44,    45,    43,    36,    30,    58,    59,    60,    58,
    617       36,    57,    56,    34,    59,    34,    34,    34,    34,    35,
    618       37,    32,    36,    44,    34,    36,    60,    34,    34,    36,
    619       10,    13,    45,    46,    47,    48,    60,     4,    10,    17,
    620       19,    23,    32,    51,    10,    34,    34,    59,    32,    34,
    621       36,    47,    32,    32,    51,     3,    16,    27,    28,    30,
    622       37,    34,    48,     6,    50,    51,    33,    51,    51,    51,
    623       51,    51,    51,    33,    32,    10,    24,    49,    33,    33,
    624       59,    32,    33,    33,    10,    33
    625 };
    626 
    627 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
    628 # define YYSIZE_T __SIZE_TYPE__
    629 #endif
    630 #if ! defined (YYSIZE_T) && defined (size_t)
    631 # define YYSIZE_T size_t
    632 #endif
    633 #if ! defined (YYSIZE_T)
    634 # if defined (__STDC__) || defined (__cplusplus)
    635 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
    636 #  define YYSIZE_T size_t
    637 # endif
    638 #endif
    639 #if ! defined (YYSIZE_T)
    640 # define YYSIZE_T unsigned int
    641 #endif
    642 
    643 #define yyerrok		(yyerrstatus = 0)
    644 #define yyclearin	(yychar = YYEMPTY)
    645 #define YYEMPTY		(-2)
    646 #define YYEOF		0
    647 
    648 #define YYACCEPT	goto yyacceptlab
    649 #define YYABORT		goto yyabortlab
    650 #define YYERROR		goto yyerrorlab
    651 
    652 
    653 /* Like YYERROR except do call yyerror.  This remains here temporarily
    654    to ease the transition to the new meaning of YYERROR, for GCC.
    655    Once GCC version 2 has supplanted version 1, this can go.  */
    656 
    657 #define YYFAIL		goto yyerrlab
    658 
    659 #define YYRECOVERING()  (!!yyerrstatus)
    660 
    661 #define YYBACKUP(Token, Value)					\
    662 do								\
    663   if (yychar == YYEMPTY && yylen == 1)				\
    664     {								\
    665       yychar = (Token);						\
    666       yylval = (Value);						\
    667       yytoken = YYTRANSLATE (yychar);				\
    668       YYPOPSTACK;						\
    669       goto yybackup;						\
    670     }								\
    671   else								\
    672     { 								\
    673       yyerror ("syntax error: cannot back up");\
    674       YYERROR;							\
    675     }								\
    676 while (0)
    677 
    678 #define YYTERROR	1
    679 #define YYERRCODE	256
    680 
    681 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
    682    are run).  */
    683 
    684 #ifndef YYLLOC_DEFAULT
    685 # define YYLLOC_DEFAULT(Current, Rhs, N)		\
    686    ((Current).first_line   = (Rhs)[1].first_line,	\
    687     (Current).first_column = (Rhs)[1].first_column,	\
    688     (Current).last_line    = (Rhs)[N].last_line,	\
    689     (Current).last_column  = (Rhs)[N].last_column)
    690 #endif
    691 
    692 /* YYLEX -- calling `yylex' with the right arguments.  */
    693 
    694 #ifdef YYLEX_PARAM
    695 # define YYLEX yylex (YYLEX_PARAM)
    696 #else
    697 # define YYLEX yylex ()
    698 #endif
    699 
    700 /* Enable debugging if requested.  */
    701 #if YYDEBUG
    702 
    703 # ifndef YYFPRINTF
    704 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
    705 #  define YYFPRINTF fprintf
    706 # endif
    707 
    708 # define YYDPRINTF(Args)			\
    709 do {						\
    710   if (yydebug)					\
    711     YYFPRINTF Args;				\
    712 } while (0)
    713 
    714 # define YYDSYMPRINT(Args)			\
    715 do {						\
    716   if (yydebug)					\
    717     yysymprint Args;				\
    718 } while (0)
    719 
    720 # define YYDSYMPRINTF(Title, Token, Value, Location)		\
    721 do {								\
    722   if (yydebug)							\
    723     {								\
    724       YYFPRINTF (stderr, "%s ", Title);				\
    725       yysymprint (stderr, 					\
    726                   Token, Value);	\
    727       YYFPRINTF (stderr, "\n");					\
    728     }								\
    729 } while (0)
    730 
    731 /*------------------------------------------------------------------.
    732 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
    733 | TOP (included).                                                   |
    734 `------------------------------------------------------------------*/
    735 
    736 #if defined (__STDC__) || defined (__cplusplus)
    737 static void
    738 yy_stack_print (short *bottom, short *top)
    739 #else
    740 static void
    741 yy_stack_print (bottom, top)
    742     short *bottom;
    743     short *top;
    744 #endif
    745 {
    746   YYFPRINTF (stderr, "Stack now");
    747   for (/* Nothing. */; bottom <= top; ++bottom)
    748     YYFPRINTF (stderr, " %d", *bottom);
    749   YYFPRINTF (stderr, "\n");
    750 }
    751 
    752 # define YY_STACK_PRINT(Bottom, Top)				\
    753 do {								\
    754   if (yydebug)							\
    755     yy_stack_print ((Bottom), (Top));				\
    756 } while (0)
    757 
    758 
    759 /*------------------------------------------------.
    760 | Report that the YYRULE is going to be reduced.  |
    761 `------------------------------------------------*/
    762 
    763 #if defined (__STDC__) || defined (__cplusplus)
    764 static void
    765 yy_reduce_print (int yyrule)
    766 #else
    767 static void
    768 yy_reduce_print (yyrule)
    769     int yyrule;
    770 #endif
    771 {
    772   int yyi;
    773   unsigned int yylno = yyrline[yyrule];
    774   YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
    775              yyrule - 1, yylno);
    776   /* Print the symbols being reduced, and their result.  */
    777   for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
    778     YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
    779   YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
    780 }
    781 
    782 # define YY_REDUCE_PRINT(Rule)		\
    783 do {					\
    784   if (yydebug)				\
    785     yy_reduce_print (Rule);		\
    786 } while (0)
    787 
    788 /* Nonzero means print parse trace.  It is left uninitialized so that
    789    multiple parsers can coexist.  */
    790 int yydebug;
    791 #else /* !YYDEBUG */
    792 # define YYDPRINTF(Args)
    793 # define YYDSYMPRINT(Args)
    794 # define YYDSYMPRINTF(Title, Token, Value, Location)
    795 # define YY_STACK_PRINT(Bottom, Top)
    796 # define YY_REDUCE_PRINT(Rule)
    797 #endif /* !YYDEBUG */
    798 
    799 
    800 /* YYINITDEPTH -- initial size of the parser's stacks.  */
    801 #ifndef	YYINITDEPTH
    802 # define YYINITDEPTH 200
    803 #endif
    804 
    805 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
    806    if the built-in stack extension method is used).
    807 
    808    Do not make this value too large; the results are undefined if
    809    SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
    810    evaluated with infinite-precision integer arithmetic.  */
    811 
    812 #if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
    813 # undef YYMAXDEPTH
    814 #endif
    815 
    816 #ifndef YYMAXDEPTH
    817 # define YYMAXDEPTH 10000
    818 #endif
    819 
    820 
    821 
    823 #if YYERROR_VERBOSE
    824 
    825 # ifndef yystrlen
    826 #  if defined (__GLIBC__) && defined (_STRING_H)
    827 #   define yystrlen strlen
    828 #  else
    829 /* Return the length of YYSTR.  */
    830 static YYSIZE_T
    831 #   if defined (__STDC__) || defined (__cplusplus)
    832 yystrlen (const char *yystr)
    833 #   else
    834 yystrlen (yystr)
    835      const char *yystr;
    836 #   endif
    837 {
    838   register const char *yys = yystr;
    839 
    840   while (*yys++ != '\0')
    841     continue;
    842 
    843   return yys - yystr - 1;
    844 }
    845 #  endif
    846 # endif
    847 
    848 # ifndef yystpcpy
    849 #  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
    850 #   define yystpcpy stpcpy
    851 #  else
    852 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
    853    YYDEST.  */
    854 static char *
    855 #   if defined (__STDC__) || defined (__cplusplus)
    856 yystpcpy (char *yydest, const char *yysrc)
    857 #   else
    858 yystpcpy (yydest, yysrc)
    859      char *yydest;
    860      const char *yysrc;
    861 #   endif
    862 {
    863   register char *yyd = yydest;
    864   register const char *yys = yysrc;
    865 
    866   while ((*yyd++ = *yys++) != '\0')
    867     continue;
    868 
    869   return yyd - 1;
    870 }
    871 #  endif
    872 # endif
    873 
    874 #endif /* !YYERROR_VERBOSE */
    875 
    876 
    877 
    879 #if YYDEBUG
    880 /*--------------------------------.
    881 | Print this symbol on YYOUTPUT.  |
    882 `--------------------------------*/
    883 
    884 #if defined (__STDC__) || defined (__cplusplus)
    885 static void
    886 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
    887 #else
    888 static void
    889 yysymprint (yyoutput, yytype, yyvaluep)
    890     FILE *yyoutput;
    891     int yytype;
    892     YYSTYPE *yyvaluep;
    893 #endif
    894 {
    895   /* Pacify ``unused variable'' warnings.  */
    896   (void) yyvaluep;
    897 
    898   if (yytype < YYNTOKENS)
    899     {
    900       YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
    901 # ifdef YYPRINT
    902       YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
    903 # endif
    904     }
    905   else
    906     YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
    907 
    908   switch (yytype)
    909     {
    910       default:
    911         break;
    912     }
    913   YYFPRINTF (yyoutput, ")");
    914 }
    915 
    916 #endif /* ! YYDEBUG */
    917 /*-----------------------------------------------.
    918 | Release the memory associated to this symbol.  |
    919 `-----------------------------------------------*/
    920 
    921 #if defined (__STDC__) || defined (__cplusplus)
    922 static void
    923 yydestruct (int yytype, YYSTYPE *yyvaluep)
    924 #else
    925 static void
    926 yydestruct (yytype, yyvaluep)
    927     int yytype;
    928     YYSTYPE *yyvaluep;
    929 #endif
    930 {
    931   /* Pacify ``unused variable'' warnings.  */
    932   (void) yyvaluep;
    933 
    934   switch (yytype)
    935     {
    936 
    937       default:
    938         break;
    939     }
    940 }
    941 
    942 
    944 /* Prevent warnings from -Wmissing-prototypes.  */
    945 
    946 #ifdef YYPARSE_PARAM
    947 # if defined (__STDC__) || defined (__cplusplus)
    948 int yyparse (void *YYPARSE_PARAM);
    949 # else
    950 int yyparse ();
    951 # endif
    952 #else /* ! YYPARSE_PARAM */
    953 #if defined (__STDC__) || defined (__cplusplus)
    954 int yyparse (void);
    955 #else
    956 int yyparse ();
    957 #endif
    958 #endif /* ! YYPARSE_PARAM */
    959 
    960 
    961 
    962 /* The lookahead symbol.  */
    963 int yychar;
    964 
    965 /* The semantic value of the lookahead symbol.  */
    966 YYSTYPE yylval;
    967 
    968 /* Number of syntax errors so far.  */
    969 int yynerrs;
    970 
    971 
    972 
    973 /*----------.
    974 | yyparse.  |
    975 `----------*/
    976 
    977 #ifdef YYPARSE_PARAM
    978 # if defined (__STDC__) || defined (__cplusplus)
    979 int yyparse (void *YYPARSE_PARAM)
    980 # else
    981 int yyparse (YYPARSE_PARAM)
    982   void *YYPARSE_PARAM;
    983 # endif
    984 #else /* ! YYPARSE_PARAM */
    985 #if defined (__STDC__) || defined (__cplusplus)
    986 int
    987 yyparse (void)
    988 #else
    989 int
    990 yyparse ()
    991 
    992 #endif
    993 #endif
    994 {
    995 
    996   register int yystate;
    997   register int yyn;
    998   int yyresult;
    999   /* Number of tokens to shift before error messages enabled.  */
   1000   int yyerrstatus;
   1001   /* Lookahead token as an internal (translated) token number.  */
   1002   int yytoken = 0;
   1003 
   1004   /* Three stacks and their tools:
   1005      `yyss': related to states,
   1006      `yyvs': related to semantic values,
   1007      `yyls': related to locations.
   1008 
   1009      Refer to the stacks thru separate pointers, to allow yyoverflow
   1010      to reallocate them elsewhere.  */
   1011 
   1012   /* The state stack.  */
   1013   short	yyssa[YYINITDEPTH];
   1014   short *yyss = yyssa;
   1015   register short *yyssp;
   1016 
   1017   /* The semantic value stack.  */
   1018   YYSTYPE yyvsa[YYINITDEPTH];
   1019   YYSTYPE *yyvs = yyvsa;
   1020   register YYSTYPE *yyvsp;
   1021 
   1022 
   1023 
   1024 #define YYPOPSTACK   (yyvsp--, yyssp--)
   1025 
   1026   YYSIZE_T yystacksize = YYINITDEPTH;
   1027 
   1028   /* The variables used to return semantic value and location from the
   1029      action routines.  */
   1030   YYSTYPE yyval;
   1031 
   1032 
   1033   /* When reducing, the number of symbols on the RHS of the reduced
   1034      rule.  */
   1035   int yylen;
   1036 
   1037   YYDPRINTF ((stderr, "Starting parse\n"));
   1038 
   1039   yystate = 0;
   1040   yyerrstatus = 0;
   1041   yynerrs = 0;
   1042   yychar = YYEMPTY;		/* Cause a token to be read.  */
   1043 
   1044   /* Initialize stack pointers.
   1045      Waste one element of value and location stack
   1046      so that they stay on the same level as the state stack.
   1047      The wasted elements are never initialized.  */
   1048 
   1049   yyssp = yyss;
   1050   yyvsp = yyvs;
   1051 
   1052   goto yysetstate;
   1053 
   1054 /*------------------------------------------------------------.
   1055 | yynewstate -- Push a new state, which is found in yystate.  |
   1056 `------------------------------------------------------------*/
   1057  yynewstate:
   1058   /* In all cases, when you get here, the value and location stacks
   1059      have just been pushed. so pushing a state here evens the stacks.
   1060      */
   1061   yyssp++;
   1062 
   1063  yysetstate:
   1064   *yyssp = yystate;
   1065 
   1066   if (yyss + yystacksize - 1 <= yyssp)
   1067     {
   1068       /* Get the current used size of the three stacks, in elements.  */
   1069       YYSIZE_T yysize = yyssp - yyss + 1;
   1070 
   1071 #ifdef yyoverflow
   1072       {
   1073 	/* Give user a chance to reallocate the stack. Use copies of
   1074 	   these so that the &'s don't force the real ones into
   1075 	   memory.  */
   1076 	YYSTYPE *yyvs1 = yyvs;
   1077 	short *yyss1 = yyss;
   1078 
   1079 
   1080 	/* Each stack pointer address is followed by the size of the
   1081 	   data in use in that stack, in bytes.  This used to be a
   1082 	   conditional around just the two extra args, but that might
   1083 	   be undefined if yyoverflow is a macro.  */
   1084 	yyoverflow ("parser stack overflow",
   1085 		    &yyss1, yysize * sizeof (*yyssp),
   1086 		    &yyvs1, yysize * sizeof (*yyvsp),
   1087 
   1088 		    &yystacksize);
   1089 
   1090 	yyss = yyss1;
   1091 	yyvs = yyvs1;
   1092       }
   1093 #else /* no yyoverflow */
   1094 # ifndef YYSTACK_RELOCATE
   1095       goto yyoverflowlab;
   1096 # else
   1097       /* Extend the stack our own way.  */
   1098       if (YYMAXDEPTH <= yystacksize)
   1099 	goto yyoverflowlab;
   1100       yystacksize *= 2;
   1101       if (YYMAXDEPTH < yystacksize)
   1102 	yystacksize = YYMAXDEPTH;
   1103 
   1104       {
   1105 	short *yyss1 = yyss;
   1106 	union yyalloc *yyptr =
   1107 	  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
   1108 	if (! yyptr)
   1109 	  goto yyoverflowlab;
   1110 	YYSTACK_RELOCATE (yyss);
   1111 	YYSTACK_RELOCATE (yyvs);
   1112 
   1113 #  undef YYSTACK_RELOCATE
   1114 	if (yyss1 != yyssa)
   1115 	  YYSTACK_FREE (yyss1);
   1116       }
   1117 # endif
   1118 #endif /* no yyoverflow */
   1119 
   1120       yyssp = yyss + yysize - 1;
   1121       yyvsp = yyvs + yysize - 1;
   1122 
   1123 
   1124       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
   1125 		  (unsigned long int) yystacksize));
   1126 
   1127       if (yyss + yystacksize - 1 <= yyssp)
   1128 	YYABORT;
   1129     }
   1130 
   1131   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
   1132 
   1133   goto yybackup;
   1134 
   1135 /*-----------.
   1136 | yybackup.  |
   1137 `-----------*/
   1138 yybackup:
   1139 
   1140 /* Do appropriate processing given the current state.  */
   1141 /* Read a lookahead token if we need one and don't already have one.  */
   1142 /* yyresume: */
   1143 
   1144   /* First try to decide what to do without reference to lookahead token.  */
   1145 
   1146   yyn = yypact[yystate];
   1147   if (yyn == YYPACT_NINF)
   1148     goto yydefault;
   1149 
   1150   /* Not known => get a lookahead token if don't already have one.  */
   1151 
   1152   /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
   1153   if (yychar == YYEMPTY)
   1154     {
   1155       YYDPRINTF ((stderr, "Reading a token: "));
   1156       yychar = YYLEX;
   1157     }
   1158 
   1159   if (yychar <= YYEOF)
   1160     {
   1161       yychar = yytoken = YYEOF;
   1162       YYDPRINTF ((stderr, "Now at end of input.\n"));
   1163     }
   1164   else
   1165     {
   1166       yytoken = YYTRANSLATE (yychar);
   1167       YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
   1168     }
   1169 
   1170   /* If the proper action on seeing token YYTOKEN is to reduce or to
   1171      detect an error, take that action.  */
   1172   yyn += yytoken;
   1173   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
   1174     goto yydefault;
   1175   yyn = yytable[yyn];
   1176   if (yyn <= 0)
   1177     {
   1178       if (yyn == 0 || yyn == YYTABLE_NINF)
   1179 	goto yyerrlab;
   1180       yyn = -yyn;
   1181       goto yyreduce;
   1182     }
   1183 
   1184   if (yyn == YYFINAL)
   1185     YYACCEPT;
   1186 
   1187   /* Shift the lookahead token.  */
   1188   YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
   1189 
   1190   /* Discard the token being shifted unless it is eof.  */
   1191   if (yychar != YYEOF)
   1192     yychar = YYEMPTY;
   1193 
   1194   *++yyvsp = yylval;
   1195 
   1196 
   1197   /* Count tokens shifted since error; after three, turn off error
   1198      status.  */
   1199   if (yyerrstatus)
   1200     yyerrstatus--;
   1201 
   1202   yystate = yyn;
   1203   goto yynewstate;
   1204 
   1205 
   1206 /*-----------------------------------------------------------.
   1207 | yydefault -- do the default action for the current state.  |
   1208 `-----------------------------------------------------------*/
   1209 yydefault:
   1210   yyn = yydefact[yystate];
   1211   if (yyn == 0)
   1212     goto yyerrlab;
   1213   goto yyreduce;
   1214 
   1215 
   1216 /*-----------------------------.
   1217 | yyreduce -- Do a reduction.  |
   1218 `-----------------------------*/
   1219 yyreduce:
   1220   /* yyn is the number of a rule to reduce with.  */
   1221   yylen = yyr2[yyn];
   1222 
   1223   /* If YYLEN is nonzero, implement the default value of the action:
   1224      `$$ = $1'.
   1225 
   1226      Otherwise, the following line sets YYVAL to garbage.
   1227      This behavior is undocumented and Bison
   1228      users should not rely upon it.  Assigning to YYVAL
   1229      unconditionally makes the parser a bit smaller, and it avoids a
   1230      GCC warning that YYVAL may be used uninitialized.  */
   1231   yyval = yyvsp[1-yylen];
   1232 
   1233 
   1234   YY_REDUCE_PRINT (yyn);
   1235   switch (yyn)
   1236     {
   1237         case 3:
   1238 #line 130 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1239     { add_versions (yyvsp[0].version); }
   1240     break;
   1241 
   1242   case 6:
   1243 #line 138 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1244     {
   1245 		      if (likely (ld_state.entry == NULL))
   1246 			ld_state.entry = yyvsp[-2].str;
   1247 		    }
   1248     break;
   1249 
   1250   case 7:
   1251 #line 143 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1252     {
   1253 		      ld_new_searchdir (yyvsp[-2].str);
   1254 		    }
   1255     break;
   1256 
   1257   case 8:
   1258 #line 147 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1259     {
   1260 		      if (likely (ld_state.pagesize == 0))
   1261 			ld_state.pagesize = yyvsp[-2].num;
   1262 		    }
   1263     break;
   1264 
   1265   case 9:
   1266 #line 152 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1267     {
   1268 		      if (likely (ld_state.interp == NULL))
   1269 			ld_state.interp = yyvsp[-2].str;
   1270 		    }
   1271     break;
   1272 
   1273   case 10:
   1274 #line 157 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1275     {
   1276 		      new_segment (yyvsp[-3].num, yyvsp[-1].output_rule);
   1277 		    }
   1278     break;
   1279 
   1280   case 11:
   1281 #line 161 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1282     {
   1283 		      fputs_unlocked (gettext ("mode for segment invalid\n"),
   1284 				      stderr);
   1285 		      new_segment (0, yyvsp[-1].output_rule);
   1286 		    }
   1287     break;
   1288 
   1289   case 12:
   1290 #line 167 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1291     {
   1292 		      /* First little optimization.  If there is only one
   1293 			 file in the group don't do anything.  */
   1294 		      if (yyvsp[-1].filename_list != yyvsp[-1].filename_list->next)
   1295 			{
   1296 			  yyvsp[-1].filename_list->next->group_start = 1;
   1297 			  yyvsp[-1].filename_list->group_end = 1;
   1298 			}
   1299 		      add_inputfiles (yyvsp[-1].filename_list);
   1300 		    }
   1301     break;
   1302 
   1303   case 13:
   1304 #line 178 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1305     { add_inputfiles (yyvsp[-1].filename_list); }
   1306     break;
   1307 
   1308   case 14:
   1309 #line 180 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1310     { add_versions (yyvsp[-1].version); }
   1311     break;
   1312 
   1313   case 15:
   1314 #line 182 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1315     { /* XXX TODO */ }
   1316     break;
   1317 
   1318   case 16:
   1319 #line 186 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1320     {
   1321 		      yyvsp[0].output_rule->next = yyvsp[-1].output_rule->next;
   1322 		      yyval.output_rule = yyvsp[-1].output_rule->next = yyvsp[0].output_rule;
   1323 		    }
   1324     break;
   1325 
   1326   case 17:
   1327 #line 191 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1328     { yyval.output_rule = yyvsp[0].output_rule; }
   1329     break;
   1330 
   1331   case 18:
   1332 #line 195 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1333     {
   1334 		      yyval.output_rule = new_output_rule (output_assignment);
   1335 		      yyval.output_rule->val.assignment = yyvsp[-1].assignment;
   1336 		    }
   1337     break;
   1338 
   1339   case 19:
   1340 #line 200 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1341     {
   1342 		      yyval.output_rule = new_output_rule (output_section);
   1343 		      yyval.output_rule->val.section.name = yyvsp[-3].str;
   1344 		      yyval.output_rule->val.section.input = yyvsp[-1].input_rule->next;
   1345 		      if (ld_state.strip == strip_debug
   1346 			  && ebl_debugscn_p (ld_state.ebl, yyvsp[-3].str))
   1347 			yyval.output_rule->val.section.ignored = true;
   1348 		      else
   1349 			yyval.output_rule->val.section.ignored = false;
   1350 		      yyvsp[-1].input_rule->next = NULL;
   1351 		    }
   1352     break;
   1353 
   1354   case 20:
   1355 #line 212 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1356     {
   1357 		      /* This is a short cut for "ID { *(ID) }".  */
   1358 		      yyval.output_rule = new_output_rule (output_section);
   1359 		      yyval.output_rule->val.section.name = yyvsp[-1].str;
   1360 		      yyval.output_rule->val.section.input = new_input_rule (input_section);
   1361 		      yyval.output_rule->val.section.input->next = NULL;
   1362 		      yyval.output_rule->val.section.input->val.section =
   1363 			(struct filemask_section_name *)
   1364 			  obstack_alloc (&ld_state.smem,
   1365 					 sizeof (struct filemask_section_name));
   1366 		      yyval.output_rule->val.section.input->val.section->filemask = NULL;
   1367 		      yyval.output_rule->val.section.input->val.section->excludemask = NULL;
   1368 		      yyval.output_rule->val.section.input->val.section->section_name =
   1369 			new_input_section_name (yyvsp[-1].str, false);
   1370 		      yyval.output_rule->val.section.input->val.section->keep_flag = false;
   1371 		      if (ld_state.strip == strip_debug
   1372 			  && ebl_debugscn_p (ld_state.ebl, yyvsp[-1].str))
   1373 			yyval.output_rule->val.section.ignored = true;
   1374 		      else
   1375 			yyval.output_rule->val.section.ignored = false;
   1376 		    }
   1377     break;
   1378 
   1379   case 21:
   1380 #line 236 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1381     { yyval.assignment = new_assignment (yyvsp[-2].str, yyvsp[0].expr, false); }
   1382     break;
   1383 
   1384   case 22:
   1385 #line 238 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1386     { yyval.assignment = new_assignment (yyvsp[-3].str, yyvsp[-1].expr, true); }
   1387     break;
   1388 
   1389   case 23:
   1390 #line 242 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1391     {
   1392 		      yyvsp[0].input_rule->next = yyvsp[-1].input_rule->next;
   1393 		      yyval.input_rule = yyvsp[-1].input_rule->next = yyvsp[0].input_rule;
   1394 		    }
   1395     break;
   1396 
   1397   case 24:
   1398 #line 247 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1399     { yyval.input_rule = yyvsp[0].input_rule; }
   1400     break;
   1401 
   1402   case 25:
   1403 #line 251 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1404     {
   1405 		      yyval.input_rule = new_input_rule (input_section);
   1406 		      yyval.input_rule->val.section = yyvsp[0].filemask_section_name;
   1407 		    }
   1408     break;
   1409 
   1410   case 26:
   1411 #line 256 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1412     {
   1413 		      yyvsp[-1].filemask_section_name->keep_flag = true;
   1414 
   1415 		      yyval.input_rule = new_input_rule (input_section);
   1416 		      yyval.input_rule->val.section = yyvsp[-1].filemask_section_name;
   1417 		    }
   1418     break;
   1419 
   1420   case 27:
   1421 #line 263 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1422     {
   1423 		      yyval.input_rule = new_input_rule (input_assignment);
   1424 		      yyval.input_rule->val.assignment = yyvsp[-1].assignment;
   1425 		    }
   1426     break;
   1427 
   1428   case 28:
   1429 #line 270 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1430     {
   1431 		      yyval.filemask_section_name = (struct filemask_section_name *)
   1432 			obstack_alloc (&ld_state.smem, sizeof (*yyval.filemask_section_name));
   1433 		      yyval.filemask_section_name->filemask = yyvsp[-4].str;
   1434 		      yyval.filemask_section_name->excludemask = yyvsp[-2].str;
   1435 		      yyval.filemask_section_name->section_name = yyvsp[-1].sectionname;
   1436 		      yyval.filemask_section_name->keep_flag = false;
   1437 		    }
   1438     break;
   1439 
   1440   case 29:
   1441 #line 281 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1442     { yyval.sectionname = new_input_section_name (yyvsp[0].str, false); }
   1443     break;
   1444 
   1445   case 30:
   1446 #line 283 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1447     { yyval.sectionname = new_input_section_name (yyvsp[-1].str, true); }
   1448     break;
   1449 
   1450   case 31:
   1451 #line 287 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1452     { yyval.str = yyvsp[-1].str; }
   1453     break;
   1454 
   1455   case 32:
   1456 #line 289 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1457     { yyval.str = NULL; }
   1458     break;
   1459 
   1460   case 33:
   1461 #line 293 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1462     {
   1463 		      yyval.expr = new_expr (exp_align);
   1464 		      yyval.expr->val.child = yyvsp[-1].expr;
   1465 		    }
   1466     break;
   1467 
   1468   case 34:
   1469 #line 298 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1470     { yyval.expr = yyvsp[-1].expr; }
   1471     break;
   1472 
   1473   case 35:
   1474 #line 300 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1475     {
   1476 		      yyval.expr = new_expr (exp_mult);
   1477 		      yyval.expr->val.binary.left = yyvsp[-2].expr;
   1478 		      yyval.expr->val.binary.right = yyvsp[0].expr;
   1479 		    }
   1480     break;
   1481 
   1482   case 36:
   1483 #line 306 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1484     {
   1485 		      yyval.expr = new_expr (yyvsp[-1].op);
   1486 		      yyval.expr->val.binary.left = yyvsp[-2].expr;
   1487 		      yyval.expr->val.binary.right = yyvsp[0].expr;
   1488 		    }
   1489     break;
   1490 
   1491   case 37:
   1492 #line 312 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1493     {
   1494 		      yyval.expr = new_expr (yyvsp[-1].op);
   1495 		      yyval.expr->val.binary.left = yyvsp[-2].expr;
   1496 		      yyval.expr->val.binary.right = yyvsp[0].expr;
   1497 		    }
   1498     break;
   1499 
   1500   case 38:
   1501 #line 318 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1502     {
   1503 		      yyval.expr = new_expr (exp_and);
   1504 		      yyval.expr->val.binary.left = yyvsp[-2].expr;
   1505 		      yyval.expr->val.binary.right = yyvsp[0].expr;
   1506 		    }
   1507     break;
   1508 
   1509   case 39:
   1510 #line 324 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1511     {
   1512 		      yyval.expr = new_expr (exp_or);
   1513 		      yyval.expr->val.binary.left = yyvsp[-2].expr;
   1514 		      yyval.expr->val.binary.right = yyvsp[0].expr;
   1515 		    }
   1516     break;
   1517 
   1518   case 40:
   1519 #line 330 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1520     {
   1521 		      yyval.expr = new_expr (exp_num);
   1522 		      yyval.expr->val.num = yyvsp[0].num;
   1523 		    }
   1524     break;
   1525 
   1526   case 41:
   1527 #line 335 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1528     {
   1529 		      yyval.expr = new_expr (exp_id);
   1530 		      yyval.expr->val.str = yyvsp[0].str;
   1531 		    }
   1532     break;
   1533 
   1534   case 42:
   1535 #line 340 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1536     { yyval.expr = new_expr (exp_sizeof_headers); }
   1537     break;
   1538 
   1539   case 43:
   1540 #line 342 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1541     { yyval.expr = new_expr (exp_pagesize); }
   1542     break;
   1543 
   1544   case 44:
   1545 #line 346 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1546     {
   1547 		      struct filename_list *newp = new_filename_listelem (yyvsp[0].str);
   1548 		      newp->next = yyvsp[-2].filename_list->next;
   1549 		      yyval.filename_list = yyvsp[-2].filename_list->next = newp;
   1550 		    }
   1551     break;
   1552 
   1553   case 45:
   1554 #line 352 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1555     { yyval.filename_list = new_filename_listelem (yyvsp[0].str); }
   1556     break;
   1557 
   1558   case 48:
   1559 #line 360 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1560     {
   1561 		      yyvsp[0].version->next = yyvsp[-1].version->next;
   1562 		      yyval.version = yyvsp[-1].version->next = yyvsp[0].version;
   1563 		    }
   1564     break;
   1565 
   1566   case 49:
   1567 #line 365 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1568     { yyval.version = yyvsp[0].version; }
   1569     break;
   1570 
   1571   case 50:
   1572 #line 369 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1573     {
   1574 		      yyvsp[-2].version->versionname = "";
   1575 		      yyvsp[-2].version->parentname = NULL;
   1576 		      yyval.version = yyvsp[-2].version;
   1577 		    }
   1578     break;
   1579 
   1580   case 51:
   1581 #line 375 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1582     {
   1583 		      yyvsp[-2].version->versionname = yyvsp[-4].str;
   1584 		      yyvsp[-2].version->parentname = NULL;
   1585 		      yyval.version = yyvsp[-2].version;
   1586 		    }
   1587     break;
   1588 
   1589   case 52:
   1590 #line 381 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1591     {
   1592 		      yyvsp[-3].version->versionname = yyvsp[-5].str;
   1593 		      yyvsp[-3].version->parentname = yyvsp[-1].str;
   1594 		      yyval.version = yyvsp[-3].version;
   1595 		    }
   1596     break;
   1597 
   1598   case 53:
   1599 #line 390 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1600     { yyval.version = merge_versions (yyvsp[-1].version, yyvsp[0].version); }
   1601     break;
   1602 
   1603   case 54:
   1604 #line 392 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1605     { yyval.version = yyvsp[0].version; }
   1606     break;
   1607 
   1608   case 55:
   1609 #line 396 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1610     { yyval.version = new_version (NULL, yyvsp[0].id_list); }
   1611     break;
   1612 
   1613   case 56:
   1614 #line 398 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1615     { yyval.version = new_version (yyvsp[0].id_list, NULL); }
   1616     break;
   1617 
   1618   case 57:
   1619 #line 403 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1620     {
   1621 		      struct id_list *newp = new_id_listelem (yyvsp[-1].str);
   1622 		      newp->next = yyvsp[-2].id_list->next;
   1623 		      yyval.id_list = yyvsp[-2].id_list->next = newp;
   1624 		    }
   1625     break;
   1626 
   1627   case 58:
   1628 #line 409 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1629     { yyval.id_list = new_id_listelem (yyvsp[-1].str); }
   1630     break;
   1631 
   1632   case 59:
   1633 #line 413 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1634     { yyval.str = yyvsp[0].str; }
   1635     break;
   1636 
   1637   case 60:
   1638 #line 415 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1639     { yyval.str = yyvsp[0].str; }
   1640     break;
   1641 
   1642   case 61:
   1643 #line 419 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1644     { yyval.str = yyvsp[0].str; }
   1645     break;
   1646 
   1647   case 62:
   1648 #line 421 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1649     { yyval.str = NULL; }
   1650     break;
   1651 
   1652 
   1653     }
   1654 
   1655 /* Line 1000 of yacc.c.  */
   1656 #line 1654 "ldscript.c"
   1657 
   1658   yyvsp -= yylen;
   1660   yyssp -= yylen;
   1661 
   1662 
   1663   YY_STACK_PRINT (yyss, yyssp);
   1664 
   1665   *++yyvsp = yyval;
   1666 
   1667 
   1668   /* Now `shift' the result of the reduction.  Determine what state
   1669      that goes to, based on the state we popped back to and the rule
   1670      number reduced by.  */
   1671 
   1672   yyn = yyr1[yyn];
   1673 
   1674   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
   1675   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
   1676     yystate = yytable[yystate];
   1677   else
   1678     yystate = yydefgoto[yyn - YYNTOKENS];
   1679 
   1680   goto yynewstate;
   1681 
   1682 
   1683 /*------------------------------------.
   1684 | yyerrlab -- here on detecting error |
   1685 `------------------------------------*/
   1686 yyerrlab:
   1687   /* If not already recovering from an error, report this error.  */
   1688   if (!yyerrstatus)
   1689     {
   1690       ++yynerrs;
   1691 #if YYERROR_VERBOSE
   1692       yyn = yypact[yystate];
   1693 
   1694       if (YYPACT_NINF < yyn && yyn < YYLAST)
   1695 	{
   1696 	  YYSIZE_T yysize = 0;
   1697 	  int yytype = YYTRANSLATE (yychar);
   1698 	  const char* yyprefix;
   1699 	  char *yymsg;
   1700 	  int yyx;
   1701 
   1702 	  /* Start YYX at -YYN if negative to avoid negative indexes in
   1703 	     YYCHECK.  */
   1704 	  int yyxbegin = yyn < 0 ? -yyn : 0;
   1705 
   1706 	  /* Stay within bounds of both yycheck and yytname.  */
   1707 	  int yychecklim = YYLAST - yyn;
   1708 	  int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
   1709 	  int yycount = 0;
   1710 
   1711 	  yyprefix = ", expecting ";
   1712 	  for (yyx = yyxbegin; yyx < yyxend; ++yyx)
   1713 	    if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
   1714 	      {
   1715 		yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
   1716 		yycount += 1;
   1717 		if (yycount == 5)
   1718 		  {
   1719 		    yysize = 0;
   1720 		    break;
   1721 		  }
   1722 	      }
   1723 	  yysize += (sizeof ("syntax error, unexpected ")
   1724 		     + yystrlen (yytname[yytype]));
   1725 	  yymsg = (char *) YYSTACK_ALLOC (yysize);
   1726 	  if (yymsg != 0)
   1727 	    {
   1728 	      char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
   1729 	      yyp = yystpcpy (yyp, yytname[yytype]);
   1730 
   1731 	      if (yycount < 5)
   1732 		{
   1733 		  yyprefix = ", expecting ";
   1734 		  for (yyx = yyxbegin; yyx < yyxend; ++yyx)
   1735 		    if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
   1736 		      {
   1737 			yyp = yystpcpy (yyp, yyprefix);
   1738 			yyp = yystpcpy (yyp, yytname[yyx]);
   1739 			yyprefix = " or ";
   1740 		      }
   1741 		}
   1742 	      yyerror (yymsg);
   1743 	      YYSTACK_FREE (yymsg);
   1744 	    }
   1745 	  else
   1746 	    yyerror ("syntax error; also virtual memory exhausted");
   1747 	}
   1748       else
   1749 #endif /* YYERROR_VERBOSE */
   1750 	yyerror ("syntax error");
   1751     }
   1752 
   1753 
   1754 
   1755   if (yyerrstatus == 3)
   1756     {
   1757       /* If just tried and failed to reuse lookahead token after an
   1758 	 error, discard it.  */
   1759 
   1760       if (yychar <= YYEOF)
   1761         {
   1762           /* If at end of input, pop the error token,
   1763 	     then the rest of the stack, then return failure.  */
   1764 	  if (yychar == YYEOF)
   1765 	     for (;;)
   1766 	       {
   1767 		 YYPOPSTACK;
   1768 		 if (yyssp == yyss)
   1769 		   YYABORT;
   1770 		 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
   1771 		 yydestruct (yystos[*yyssp], yyvsp);
   1772 	       }
   1773         }
   1774       else
   1775 	{
   1776 	  YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
   1777 	  yydestruct (yytoken, &yylval);
   1778 	  yychar = YYEMPTY;
   1779 
   1780 	}
   1781     }
   1782 
   1783   /* Else will try to reuse lookahead token after shifting the error
   1784      token.  */
   1785   goto yyerrlab1;
   1786 
   1787 
   1788 /*---------------------------------------------------.
   1789 | yyerrorlab -- error raised explicitly by YYERROR.  |
   1790 `---------------------------------------------------*/
   1791 yyerrorlab:
   1792 
   1793 #ifdef __GNUC__
   1794   /* Pacify GCC when the user code never invokes YYERROR and the label
   1795      yyerrorlab therefore never appears in user code.  */
   1796   if (0)
   1797      goto yyerrorlab;
   1798 #endif
   1799 
   1800   yyvsp -= yylen;
   1801   yyssp -= yylen;
   1802   yystate = *yyssp;
   1803   goto yyerrlab1;
   1804 
   1805 
   1806 /*-------------------------------------------------------------.
   1807 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
   1808 `-------------------------------------------------------------*/
   1809 yyerrlab1:
   1810   yyerrstatus = 3;	/* Each real token shifted decrements this.  */
   1811 
   1812   for (;;)
   1813     {
   1814       yyn = yypact[yystate];
   1815       if (yyn != YYPACT_NINF)
   1816 	{
   1817 	  yyn += YYTERROR;
   1818 	  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
   1819 	    {
   1820 	      yyn = yytable[yyn];
   1821 	      if (0 < yyn)
   1822 		break;
   1823 	    }
   1824 	}
   1825 
   1826       /* Pop the current state because it cannot handle the error token.  */
   1827       if (yyssp == yyss)
   1828 	YYABORT;
   1829 
   1830       YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
   1831       yydestruct (yystos[yystate], yyvsp);
   1832       YYPOPSTACK;
   1833       yystate = *yyssp;
   1834       YY_STACK_PRINT (yyss, yyssp);
   1835     }
   1836 
   1837   if (yyn == YYFINAL)
   1838     YYACCEPT;
   1839 
   1840   YYDPRINTF ((stderr, "Shifting error token, "));
   1841 
   1842   *++yyvsp = yylval;
   1843 
   1844 
   1845   yystate = yyn;
   1846   goto yynewstate;
   1847 
   1848 
   1849 /*-------------------------------------.
   1850 | yyacceptlab -- YYACCEPT comes here.  |
   1851 `-------------------------------------*/
   1852 yyacceptlab:
   1853   yyresult = 0;
   1854   goto yyreturn;
   1855 
   1856 /*-----------------------------------.
   1857 | yyabortlab -- YYABORT comes here.  |
   1858 `-----------------------------------*/
   1859 yyabortlab:
   1860   yyresult = 1;
   1861   goto yyreturn;
   1862 
   1863 #ifndef yyoverflow
   1864 /*----------------------------------------------.
   1865 | yyoverflowlab -- parser overflow comes here.  |
   1866 `----------------------------------------------*/
   1867 yyoverflowlab:
   1868   yyerror ("parser stack overflow");
   1869   yyresult = 2;
   1870   /* Fall through.  */
   1871 #endif
   1872 
   1873 yyreturn:
   1874 #ifndef yyoverflow
   1875   if (yyss != yyssa)
   1876     YYSTACK_FREE (yyss);
   1877 #endif
   1878   return yyresult;
   1879 }
   1880 
   1881 
   1882 #line 424 "/home/drepper/gnu/elfutils/src/ldscript.y"
   1883 
   1884 
   1885 static void
   1886 yyerror (const char *s)
   1887 {
   1888   error (0, 0, (ld_scan_version_script
   1889 		? gettext ("while reading version script '%s': %s at line %d")
   1890 		: gettext ("while reading linker script '%s': %s at line %d")),
   1891 	 ldin_fname, gettext (s), ldlineno);
   1892 }
   1893 
   1894 
   1895 static struct expression *
   1896 new_expr (int tag)
   1897 {
   1898   struct expression *newp = (struct expression *)
   1899     obstack_alloc (&ld_state.smem, sizeof (*newp));
   1900 
   1901   newp->tag = tag;
   1902   return newp;
   1903 }
   1904 
   1905 
   1906 static struct input_section_name *
   1907 new_input_section_name (const char *name, bool sort_flag)
   1908 {
   1909   struct input_section_name *newp = (struct input_section_name *)
   1910     obstack_alloc (&ld_state.smem, sizeof (*newp));
   1911 
   1912   newp->name = name;
   1913   newp->sort_flag = sort_flag;
   1914   return newp;
   1915 }
   1916 
   1917 
   1918 static struct input_rule *
   1919 new_input_rule (int tag)
   1920 {
   1921   struct input_rule *newp = (struct input_rule *)
   1922     obstack_alloc (&ld_state.smem, sizeof (*newp));
   1923 
   1924   newp->tag = tag;
   1925   newp->next = newp;
   1926   return newp;
   1927 }
   1928 
   1929 
   1930 static struct output_rule *
   1931 new_output_rule (int tag)
   1932 {
   1933   struct output_rule *newp = (struct output_rule *)
   1934     memset (obstack_alloc (&ld_state.smem, sizeof (*newp)),
   1935 	    '\0', sizeof (*newp));
   1936 
   1937   newp->tag = tag;
   1938   newp->next = newp;
   1939   return newp;
   1940 }
   1941 
   1942 
   1943 static struct assignment *
   1944 new_assignment (const char *variable, struct expression *expression,
   1945 		bool provide_flag)
   1946 {
   1947   struct assignment *newp = (struct assignment *)
   1948     obstack_alloc (&ld_state.smem, sizeof (*newp));
   1949 
   1950   newp->variable = variable;
   1951   newp->expression = expression;
   1952   newp->sym = NULL;
   1953   newp->provide_flag = provide_flag;
   1954 
   1955   /* Insert the symbol into a hash table.  We will later have to matc*/
   1956   return newp;
   1957 }
   1958 
   1959 
   1960 static void
   1961 new_segment (int mode, struct output_rule *output_rule)
   1962 {
   1963   struct output_segment *newp;
   1964 
   1965   newp
   1966     = (struct output_segment *) obstack_alloc (&ld_state.smem, sizeof (*newp));
   1967   newp->mode = mode;
   1968   newp->next = newp;
   1969 
   1970   newp->output_rules = output_rule->next;
   1971   output_rule->next = NULL;
   1972 
   1973   /* Enqueue the output segment description.  */
   1974   if (ld_state.output_segments == NULL)
   1975     ld_state.output_segments = newp;
   1976   else
   1977     {
   1978       newp->next = ld_state.output_segments->next;
   1979       ld_state.output_segments = ld_state.output_segments->next = newp;
   1980     }
   1981 
   1982   /* If the output file should be stripped of all symbol set the flag
   1983      in the structures of all output sections.  */
   1984   if (mode == 0 && ld_state.strip == strip_all)
   1985     {
   1986       struct output_rule *runp;
   1987 
   1988       for (runp = newp->output_rules; runp != NULL; runp = runp->next)
   1989 	if (runp->tag == output_section)
   1990 	  runp->val.section.ignored = true;
   1991     }
   1992 }
   1993 
   1994 
   1995 static struct filename_list *
   1996 new_filename_listelem (const char *string)
   1997 {
   1998   struct filename_list *newp;
   1999 
   2000   /* We use calloc and not the obstack since this object can be freed soon.  */
   2001   newp = (struct filename_list *) xcalloc (1, sizeof (*newp));
   2002   newp->name = string;
   2003   newp->next = newp;
   2004   return newp;
   2005 }
   2006 
   2007 
   2008 static void
   2009 add_inputfiles (struct filename_list *fnames)
   2010 {
   2011   assert (fnames != NULL);
   2012 
   2013   if (ld_state.srcfiles == NULL)
   2014     ld_state.srcfiles = fnames;
   2015   else
   2016     {
   2017       struct filename_list *first = ld_state.srcfiles->next;
   2018 
   2019       ld_state.srcfiles->next = fnames->next;
   2020       fnames->next = first;
   2021       ld_state.srcfiles->next = fnames;
   2022     }
   2023 }
   2024 
   2025 
   2026 static _Bool
   2027 special_char_p (const char *str)
   2028 {
   2029   while (*str != '\0')
   2030     {
   2031       if (__builtin_expect (*str == '*', 0)
   2032 	  || __builtin_expect (*str == '?', 0)
   2033 	  || __builtin_expect (*str == '[', 0))
   2034 	return true;
   2035 
   2036       ++str;
   2037     }
   2038 
   2039   return false;
   2040 }
   2041 
   2042 
   2043 static struct id_list *
   2044 new_id_listelem (const char *str)
   2045 {
   2046   struct id_list *newp;
   2047 
   2048   newp = (struct id_list *) obstack_alloc (&ld_state.smem, sizeof (*newp));
   2049   if (str == NULL)
   2050     newp->u.id_type = id_all;
   2051   else if (__builtin_expect (special_char_p (str), false))
   2052     newp->u.id_type = id_wild;
   2053   else
   2054     newp->u.id_type = id_str;
   2055   newp->id = str;
   2056   newp->next = newp;
   2057 
   2058   return newp;
   2059 }
   2060 
   2061 
   2062 static struct version *
   2063 new_version (struct id_list *local, struct id_list *global)
   2064 {
   2065   struct version *newp;
   2066 
   2067   newp = (struct version *) obstack_alloc (&ld_state.smem, sizeof (*newp));
   2068   newp->next = newp;
   2069   newp->local_names = local;
   2070   newp->global_names = global;
   2071   newp->versionname = NULL;
   2072   newp->parentname = NULL;
   2073 
   2074   return newp;
   2075 }
   2076 
   2077 
   2078 static struct version *
   2079 merge_versions (struct version *one, struct version *two)
   2080 {
   2081   assert (two->local_names == NULL || two->global_names == NULL);
   2082 
   2083   if (two->local_names != NULL)
   2084     {
   2085       if (one->local_names == NULL)
   2086 	one->local_names = two->local_names;
   2087       else
   2088 	{
   2089 	  two->local_names->next = one->local_names->next;
   2090 	  one->local_names = one->local_names->next = two->local_names;
   2091 	}
   2092     }
   2093   else
   2094     {
   2095       if (one->global_names == NULL)
   2096 	one->global_names = two->global_names;
   2097       else
   2098 	{
   2099 	  two->global_names->next = one->global_names->next;
   2100 	  one->global_names = one->global_names->next = two->global_names;
   2101 	}
   2102     }
   2103 
   2104   return one;
   2105 }
   2106 
   2107 
   2108 static void
   2109 add_id_list (const char *versionname, struct id_list *runp, _Bool local)
   2110 {
   2111   struct id_list *lastp = runp;
   2112 
   2113   if (runp == NULL)
   2114     /* Nothing to do.  */
   2115     return;
   2116 
   2117   /* Convert into a simple single-linked list.  */
   2118   runp = runp->next;
   2119   assert (runp != NULL);
   2120   lastp->next = NULL;
   2121 
   2122   do
   2123     if (runp->u.id_type == id_str)
   2124       {
   2125 	struct id_list *curp;
   2126 	struct id_list *defp;
   2127 	unsigned long int hval = elf_hash (runp->id);
   2128 
   2129 	curp = runp;
   2130 	runp = runp->next;
   2131 
   2132 	defp = ld_version_str_tab_find (&ld_state.version_str_tab, hval, curp);
   2133 	if (defp != NULL)
   2134 	  {
   2135 	    /* There is already a version definition for this symbol.  */
   2136 	    while (strcmp (defp->u.s.versionname, versionname) != 0)
   2137 	      {
   2138 		if (defp->next == NULL)
   2139 		  {
   2140 		    /* No version like this so far.  */
   2141 		    defp->next = curp;
   2142 		    curp->u.s.local = local;
   2143 		    curp->u.s.versionname = versionname;
   2144 		    curp->next = NULL;
   2145 		    defp = NULL;
   2146 		    break;
   2147 		  }
   2148 
   2149 		defp = defp->next;
   2150 	      }
   2151 
   2152 	    if (defp != NULL && defp->u.s.local != local)
   2153 	      error (EXIT_FAILURE, 0, versionname[0] == '\0'
   2154 		     ? gettext ("\
   2155 symbol '%s' in declared both local and global for unnamed version")
   2156 		     : gettext ("\
   2157 symbol '%s' in declared both local and global for version '%s'"),
   2158 		     runp->id, versionname);
   2159 	  }
   2160 	else
   2161 	  {
   2162 	    /* This is the first version definition for this symbol.  */
   2163 	    ld_version_str_tab_insert (&ld_state.version_str_tab, hval, curp);
   2164 
   2165 	    curp->u.s.local = local;
   2166 	    curp->u.s.versionname = versionname;
   2167 	    curp->next = NULL;
   2168 	  }
   2169       }
   2170     else if (runp->u.id_type == id_all)
   2171       {
   2172 	if (local)
   2173 	  {
   2174 	    if (ld_state.default_bind_global)
   2175 	      error (EXIT_FAILURE, 0,
   2176 		     gettext ("default visibility set as local and global"));
   2177 	    ld_state.default_bind_local = true;
   2178 	  }
   2179 	else
   2180 	  {
   2181 	    if (ld_state.default_bind_local)
   2182 	      error (EXIT_FAILURE, 0,
   2183 		     gettext ("default visibility set as local and global"));
   2184 	    ld_state.default_bind_global = true;
   2185 	  }
   2186 
   2187 	runp = runp->next;
   2188       }
   2189     else
   2190       {
   2191 	assert (runp->u.id_type == id_wild);
   2192 	/* XXX TBI */
   2193 	abort ();
   2194       }
   2195   while (runp != NULL);
   2196 }
   2197 
   2198 
   2199 static void
   2200 add_versions (struct version *versions)
   2201 {
   2202   struct version *lastp = versions;
   2203 
   2204   if (versions == NULL)
   2205     return;
   2206 
   2207   /* Convert into a simple single-linked list.  */
   2208   versions = versions->next;
   2209   assert (versions != NULL);
   2210   lastp->next = NULL;
   2211 
   2212   do
   2213     {
   2214       struct version *oldp;
   2215 
   2216       add_id_list (versions->versionname, versions->local_names, true);
   2217       add_id_list (versions->versionname, versions->global_names, false);
   2218 
   2219       oldp = versions;
   2220       versions = versions->next;
   2221     }
   2222   while (versions != NULL);
   2223 }
   2224 
   2225