1 /* A Bison parser, made by GNU Bison 2.5. */
3 /* Bison implementation for Yacc-like parsers in C
5 Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 /* As a special exception, you may create a larger work that contains
21 part or all of the Bison parser skeleton and distribute that work
22 under terms of your choice, so long as that work isn't itself a
23 parser generator using the skeleton or a modified version thereof
24 as a parser skeleton. Alternatively, if you modify or redistribute
25 the parser skeleton itself, you may (at your option) remove this
26 special exception, which will cause the skeleton and the resulting
27 Bison output files to be licensed under the GNU General Public
28 License without this special exception.
30 This special exception was added by the Free Software Foundation in
31 version 2.2 of Bison. */
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34 simplifying the original so-called "semantic" parser. */
36 /* All symbols defined below should begin with yy or YY, to avoid
37 infringing on user name space. This should be done even for local
38 variables, as they might otherwise be expanded by user macros.
39 There are some unavoidable exceptions within include files to
40 define necessary library symbols; they are noted "INFRINGES ON
41 USER NAME SPACE" below. */
43 /* Identify Bison output. */
47 #define YYBISON_VERSION "2.5"
50 #define YYSKELETON_NAME "yacc.c"
61 /* Using locations. */
62 #define YYLSP_NEEDED 0
64 /* Substitute the variable and function names. */
65 #define yyparse ldparse
67 #define yyerror lderror
70 #define yydebug lddebug
71 #define yynerrs ldnerrs
74 /* Copy the first part of user declarations. */
76 /* Line 268 of yacc.c */
79 /* Parser for linker scripts.
80 Copyright (C) 2001-2011 Red Hat, Inc.
81 This file is part of elfutils.
82 Written by Ulrich Drepper <drepper@redhat.com>, 2001.
84 This file is free software; you can redistribute it and/or modify
85 it under the terms of the GNU General Public License as published by
86 the Free Software Foundation; either version 3 of the License, or
87 (at your option) any later version.
89 elfutils is distributed in the hope that it will be useful, but
90 WITHOUT ANY WARRANTY; without even the implied warranty of
91 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
92 GNU General Public License for more details.
94 You should have received a copy of the GNU General Public License
95 along with this program. If not, see <http://www.gnu.org/licenses/>. */
113 /* The error handler. */
114 static void yyerror (const char *s);
116 /* Some helper functions we need to construct the data structures
117 describing information from the file. */
118 static struct expression *new_expr (int tag);
119 static struct input_section_name *new_input_section_name (const char *name,
121 static struct input_rule *new_input_rule (int tag);
122 static struct output_rule *new_output_rule (int tag);
123 static struct assignment *new_assignment (const char *variable,
124 struct expression *expression,
126 static void new_segment (int mode, struct output_rule *output_rule);
127 static struct filename_list *new_filename_listelem (const char *string);
128 static void add_inputfiles (struct filename_list *fnames);
129 static struct id_list *new_id_listelem (const char *str);
130 static struct filename_list *mark_as_needed (struct filename_list *listp);
131 static struct version *new_version (struct id_list *local,
132 struct id_list *global);
133 static struct version *merge_versions (struct version *one,
134 struct version *two);
135 static void add_versions (struct version *versions);
137 extern int yylex (void);
140 /* Line 268 of yacc.c */
141 #line 142 "ldscript.c"
143 /* Enabling traces. */
148 /* Enabling verbose error messages. */
149 #ifdef YYERROR_VERBOSE
150 # undef YYERROR_VERBOSE
151 # define YYERROR_VERBOSE 1
153 # define YYERROR_VERBOSE 0
156 /* Enabling the token table. */
157 #ifndef YYTOKEN_TABLE
158 # define YYTOKEN_TABLE 0
165 /* Put the tokens into the symbol table, so that GDB and other debuggers
184 kOUTPUT_FORMAT = 274,
189 kSIZEOF_HEADERS = 279,
192 kVERSION_SCRIPT = 282,
200 #define kAS_NEEDED 260
202 #define kEXCLUDE_FILE 262
203 #define kFILENAME 263
214 #define kOUTPUT_FORMAT 274
215 #define kPAGESIZE 275
217 #define kSEARCH_DIR 277
219 #define kSIZEOF_HEADERS 279
222 #define kVERSION_SCRIPT 282
229 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
230 typedef union YYSTYPE
233 /* Line 293 of yacc.c */
234 #line 63 "ldscript.y"
237 enum expression_tag op;
239 struct expression *expr;
240 struct input_section_name *sectionname;
241 struct filemask_section_name *filemask_section_name;
242 struct input_rule *input_rule;
243 struct output_rule *output_rule;
244 struct assignment *assignment;
245 struct filename_list *filename_list;
246 struct version *version;
247 struct id_list *id_list;
251 /* Line 293 of yacc.c */
252 #line 253 "ldscript.c"
254 # define YYSTYPE_IS_TRIVIAL 1
255 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
256 # define YYSTYPE_IS_DECLARED 1
260 /* Copy the second part of user declarations. */
263 /* Line 343 of yacc.c */
264 #line 265 "ldscript.c"
271 typedef YYTYPE_UINT8 yytype_uint8;
273 typedef unsigned char yytype_uint8;
277 typedef YYTYPE_INT8 yytype_int8;
278 #elif (defined __STDC__ || defined __C99__FUNC__ \
279 || defined __cplusplus || defined _MSC_VER)
280 typedef signed char yytype_int8;
282 typedef short int yytype_int8;
286 typedef YYTYPE_UINT16 yytype_uint16;
288 typedef unsigned short int yytype_uint16;
292 typedef YYTYPE_INT16 yytype_int16;
294 typedef short int yytype_int16;
298 # ifdef __SIZE_TYPE__
299 # define YYSIZE_T __SIZE_TYPE__
300 # elif defined size_t
301 # define YYSIZE_T size_t
302 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
303 || defined __cplusplus || defined _MSC_VER)
304 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
305 # define YYSIZE_T size_t
307 # define YYSIZE_T unsigned int
311 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
314 # if defined YYENABLE_NLS && YYENABLE_NLS
316 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
317 # define YY_(msgid) dgettext ("bison-runtime", msgid)
321 # define YY_(msgid) msgid
325 /* Suppress unused-variable warnings by "using" E. */
326 #if ! defined lint || defined __GNUC__
327 # define YYUSE(e) ((void) (e))
329 # define YYUSE(e) /* empty */
332 /* Identity function, used to suppress warnings about constant conditions. */
336 #if (defined __STDC__ || defined __C99__FUNC__ \
337 || defined __cplusplus || defined _MSC_VER)
350 #if ! defined yyoverflow || YYERROR_VERBOSE
352 /* The parser invokes alloca or malloc; define the necessary symbols. */
354 # ifdef YYSTACK_USE_ALLOCA
355 # if YYSTACK_USE_ALLOCA
357 # define YYSTACK_ALLOC __builtin_alloca
358 # elif defined __BUILTIN_VA_ARG_INCR
359 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
361 # define YYSTACK_ALLOC __alloca
362 # elif defined _MSC_VER
363 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
364 # define alloca _alloca
366 # define YYSTACK_ALLOC alloca
367 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
368 || defined __cplusplus || defined _MSC_VER)
369 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
370 # ifndef EXIT_SUCCESS
371 # define EXIT_SUCCESS 0
378 # ifdef YYSTACK_ALLOC
379 /* Pacify GCC's `empty if-body' warning. */
380 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
381 # ifndef YYSTACK_ALLOC_MAXIMUM
382 /* The OS might guarantee only one guard page at the bottom of the stack,
383 and a page size can be as small as 4096 bytes. So we cannot safely
384 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
385 to allow for a few compiler-allocated temporary stack slots. */
386 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
389 # define YYSTACK_ALLOC YYMALLOC
390 # define YYSTACK_FREE YYFREE
391 # ifndef YYSTACK_ALLOC_MAXIMUM
392 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
394 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
395 && ! ((defined YYMALLOC || defined malloc) \
396 && (defined YYFREE || defined free)))
397 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
398 # ifndef EXIT_SUCCESS
399 # define EXIT_SUCCESS 0
403 # define YYMALLOC malloc
404 # if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
405 || defined __cplusplus || defined _MSC_VER)
406 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
411 # if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
412 || defined __cplusplus || defined _MSC_VER)
413 void free (void *); /* INFRINGES ON USER NAME SPACE */
417 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
420 #if (! defined yyoverflow \
421 && (! defined __cplusplus \
422 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
424 /* A type that is properly aligned for any stack member. */
427 yytype_int16 yyss_alloc;
431 /* The size of the maximum gap between one aligned stack and the next. */
432 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
434 /* The size of an array large to enough to hold all stacks, each with
436 # define YYSTACK_BYTES(N) \
437 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
438 + YYSTACK_GAP_MAXIMUM)
440 # define YYCOPY_NEEDED 1
442 /* Relocate STACK from its old location to the new one. The
443 local variables YYSIZE and YYSTACKSIZE give the old and new number of
444 elements in the stack, and YYPTR gives the new location of the
445 stack. Advance YYPTR to a properly aligned location for the next
447 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
450 YYSIZE_T yynewbytes; \
451 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
452 Stack = &yyptr->Stack_alloc; \
453 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
454 yyptr += yynewbytes / sizeof (*yyptr); \
460 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
461 /* Copy COUNT objects from FROM to TO. The source and destination do
464 # if defined __GNUC__ && 1 < __GNUC__
465 # define YYCOPY(To, From, Count) \
466 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
468 # define YYCOPY(To, From, Count) \
472 for (yyi = 0; yyi < (Count); yyi++) \
473 (To)[yyi] = (From)[yyi]; \
478 #endif /* !YYCOPY_NEEDED */
480 /* YYFINAL -- State number of the termination state. */
482 /* YYLAST -- Last index in YYTABLE. */
485 /* YYNTOKENS -- Number of terminals. */
487 /* YYNNTS -- Number of nonterminals. */
489 /* YYNRULES -- Number of rules. */
491 /* YYNRULES -- Number of states. */
492 #define YYNSTATES 159
494 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
496 #define YYMAXUTOK 284
498 #define YYTRANSLATE(YYX) \
499 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
501 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
502 static const yytype_uint8 yytranslate[] =
504 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
505 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
506 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
507 2, 2, 2, 2, 2, 2, 2, 2, 29, 2,
508 33, 34, 31, 2, 39, 2, 2, 2, 2, 2,
509 2, 2, 2, 2, 2, 2, 2, 2, 2, 35,
510 2, 38, 2, 2, 2, 2, 2, 2, 2, 2,
511 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
512 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
513 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
514 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
515 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
516 2, 2, 2, 36, 28, 37, 2, 2, 2, 2,
517 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
518 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
519 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
520 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
521 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
522 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
523 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
524 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
525 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
526 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
527 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
528 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
529 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
530 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
531 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
536 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
538 static const yytype_uint8 yyprhs[] =
540 0, 0, 3, 5, 8, 11, 13, 19, 25, 31,
541 37, 43, 49, 54, 59, 64, 69, 74, 77, 79,
542 82, 87, 90, 94, 101, 104, 106, 108, 113, 116,
543 122, 124, 129, 134, 135, 140, 144, 148, 152, 156,
544 160, 164, 166, 168, 170, 172, 176, 178, 180, 181,
545 186, 191, 193, 196, 198, 203, 209, 216, 219, 221,
546 224, 227, 231, 234, 236, 238, 240
549 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
550 static const yytype_int8 yyrhs[] =
552 41, 0, -1, 42, -1, 27, 56, -1, 42, 43,
553 -1, 43, -1, 6, 33, 11, 34, 35, -1, 22,
554 33, 61, 34, 35, -1, 20, 33, 18, 34, 35,
555 -1, 13, 33, 61, 34, 35, -1, 23, 16, 36,
556 44, 37, -1, 23, 1, 36, 44, 37, -1, 10,
557 33, 53, 34, -1, 12, 33, 53, 34, -1, 5,
558 33, 53, 34, -1, 26, 36, 56, 37, -1, 19,
559 33, 61, 34, -1, 44, 45, -1, 45, -1, 46,
560 35, -1, 11, 36, 47, 37, -1, 11, 35, -1,
561 11, 38, 52, -1, 21, 33, 11, 38, 52, 34,
562 -1, 47, 48, -1, 48, -1, 49, -1, 14, 33,
563 49, 34, -1, 46, 35, -1, 62, 33, 51, 50,
564 34, -1, 11, -1, 25, 33, 11, 34, -1, 7,
565 33, 61, 34, -1, -1, 4, 33, 52, 34, -1,
566 33, 52, 34, -1, 52, 31, 52, -1, 52, 17,
567 52, -1, 52, 3, 52, -1, 52, 29, 52, -1,
568 52, 28, 52, -1, 18, -1, 11, -1, 24, -1,
569 20, -1, 53, 54, 55, -1, 55, -1, 39, -1,
570 -1, 10, 33, 53, 34, -1, 5, 33, 53, 34,
571 -1, 61, -1, 56, 57, -1, 57, -1, 36, 58,
572 37, 35, -1, 61, 36, 58, 37, 35, -1, 61,
573 36, 58, 37, 61, 35, -1, 58, 59, -1, 59,
574 -1, 9, 60, -1, 15, 60, -1, 60, 62, 35,
575 -1, 62, 35, -1, 8, -1, 11, -1, 61, -1,
579 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
580 static const yytype_uint16 yyrline[] =
582 0, 135, 135, 136, 140, 141, 144, 149, 153, 158,
583 164, 168, 174, 185, 187, 189, 191, 195, 200, 204,
584 209, 221, 245, 247, 251, 256, 260, 265, 272, 279,
585 290, 292, 296, 299, 302, 307, 309, 315, 321, 327,
586 333, 339, 344, 349, 351, 355, 360, 364, 365, 368,
587 379, 381, 386, 391, 395, 401, 407, 416, 418, 422,
588 424, 429, 435, 439, 441, 445, 447
592 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
593 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
594 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
595 static const char *const yytname[] =
597 "$end", "error", "$undefined", "kADD_OP", "kALIGN", "kAS_NEEDED",
598 "kENTRY", "kEXCLUDE_FILE", "kFILENAME", "kGLOBAL", "kGROUP", "kID",
599 "kINPUT", "kINTERP", "kKEEP", "kLOCAL", "kMODE", "kMUL_OP", "kNUM",
600 "kOUTPUT_FORMAT", "kPAGESIZE", "kPROVIDE", "kSEARCH_DIR", "kSEGMENT",
601 "kSIZEOF_HEADERS", "kSORT", "kVERSION", "kVERSION_SCRIPT", "'|'", "'&'",
602 "ADD_OP", "'*'", "MUL_OP", "'('", "')'", "';'", "'{'", "'}'", "'='",
603 "','", "$accept", "script_or_version", "file", "content",
604 "outputsections", "outputsection", "assignment", "inputsections",
605 "inputsection", "sectionname", "sort_opt_name", "exclude_opt", "expr",
606 "filename_id_list", "comma_opt", "filename_id_listelem", "versionlist",
607 "version", "version_stmt_list", "version_stmt", "filename_id_star_list",
608 "filename_id", "filename_id_star", 0
613 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
615 static const yytype_uint16 yytoknum[] =
617 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
618 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
619 275, 276, 277, 278, 279, 280, 281, 282, 124, 38,
620 283, 42, 284, 40, 41, 59, 123, 125, 61, 44
624 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
625 static const yytype_uint8 yyr1[] =
627 0, 40, 41, 41, 42, 42, 43, 43, 43, 43,
628 43, 43, 43, 43, 43, 43, 43, 44, 44, 45,
629 45, 45, 46, 46, 47, 47, 48, 48, 48, 49,
630 50, 50, 51, 51, 52, 52, 52, 52, 52, 52,
631 52, 52, 52, 52, 52, 53, 53, 54, 54, 55,
632 55, 55, 56, 56, 57, 57, 57, 58, 58, 59,
633 59, 60, 60, 61, 61, 62, 62
636 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
637 static const yytype_uint8 yyr2[] =
639 0, 2, 1, 2, 2, 1, 5, 5, 5, 5,
640 5, 5, 4, 4, 4, 4, 4, 2, 1, 2,
641 4, 2, 3, 6, 2, 1, 1, 4, 2, 5,
642 1, 4, 4, 0, 4, 3, 3, 3, 3, 3,
643 3, 1, 1, 1, 1, 3, 1, 1, 0, 4,
644 4, 1, 2, 1, 4, 5, 6, 2, 1, 2,
648 /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
649 Performed when YYTABLE doesn't specify something else to do. Zero
650 means the default is an error. */
651 static const yytype_uint8 yydefact[] =
653 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
654 0, 0, 0, 2, 5, 0, 0, 0, 0, 0,
655 0, 0, 0, 0, 0, 0, 63, 64, 0, 3,
656 53, 0, 1, 4, 0, 0, 48, 46, 51, 0,
657 48, 48, 0, 0, 0, 0, 0, 0, 0, 0,
658 0, 0, 58, 52, 0, 0, 0, 14, 47, 0,
659 0, 12, 13, 0, 16, 0, 0, 0, 0, 0,
660 18, 0, 0, 15, 66, 59, 65, 0, 60, 0,
661 57, 0, 48, 48, 45, 6, 9, 8, 7, 21,
662 0, 0, 0, 11, 17, 19, 10, 0, 62, 54,
663 0, 50, 49, 64, 0, 0, 0, 25, 26, 0,
664 0, 42, 41, 44, 43, 0, 22, 0, 61, 55,
665 0, 0, 28, 20, 24, 33, 0, 0, 0, 0,
666 0, 0, 0, 0, 56, 0, 0, 0, 0, 35,
667 38, 37, 40, 39, 36, 0, 27, 0, 30, 0,
668 0, 34, 23, 0, 0, 29, 32, 0, 31
671 /* YYDEFGOTO[NTERM-NUM]. */
672 static const yytype_int16 yydefgoto[] =
674 -1, 12, 13, 14, 69, 70, 71, 106, 107, 108,
675 150, 137, 116, 36, 59, 37, 29, 30, 51, 52,
679 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
681 #define YYPACT_NINF -86
682 static const yytype_int16 yypact[] =
684 111, -18, -14, 23, 45, 70, 75, 85, 92, 97,
685 91, 19, 128, 134, -86, 162, 96, 162, 162, 5,
686 5, 123, 5, 93, 99, 19, -86, -86, 117, 19,
687 -86, 115, -86, -86, 125, 144, 71, -86, -86, 145,
688 116, 135, 147, 148, 149, 150, 101, 101, 14, 83,
689 83, 55, -86, -86, 117, 162, 162, -86, -86, 162,
690 133, -86, -86, 143, -86, 151, 152, 107, 155, 63,
691 -86, 154, 74, -86, -86, 83, -86, 156, 83, 157,
692 -86, 56, 137, 141, -86, -86, -86, -86, -86, -86,
693 88, 48, 174, -86, -86, -86, -86, 158, -86, -86,
694 69, -86, -86, 159, 161, 160, 12, -86, -86, 163,
695 165, -86, -86, -86, -86, 48, 59, 164, -86, -86,
696 166, 83, -86, -86, -86, 183, 48, 0, 48, 48,
697 48, 48, 48, 48, -86, 169, 167, 90, 7, -86,
698 59, 59, 44, 66, 103, 29, -86, 5, -86, 171,
699 172, -86, -86, 173, 188, -86, -86, 175, -86
702 /* YYPGOTO[NTERM-NUM]. */
703 static const yytype_int16 yypgoto[] =
705 -86, -86, -86, 192, 168, 80, -85, -86, 102, 89,
706 -86, -86, 33, -16, -86, 153, 186, 38, 170, -39,
710 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
711 positive, shift that token. If negative, reduce the rule which
712 number is the opposite. If YYTABLE_NINF, syntax error. */
713 #define YYTABLE_NINF -1
714 static const yytype_uint8 yytable[] =
716 31, 40, 41, 128, 38, 105, 38, 38, 42, 43,
717 128, 45, 80, 26, 31, 15, 27, 129, 31, 16,
718 26, 105, 26, 103, 129, 27, 104, 26, 130, 131,
719 27, 132, 128, 68, 139, 130, 131, 31, 132, 82,
720 83, 151, 80, 74, 38, 38, 129, 128, 38, 123,
721 28, 73, 110, 77, 77, 28, 17, 130, 131, 111,
722 132, 129, 128, 152, 49, 49, 112, 53, 113, 128,
723 50, 50, 114, 131, 67, 132, 129, 26, 18, 97,
724 27, 115, 97, 129, 68, 67, 53, 130, 131, 120,
725 132, 26, 79, 100, 27, 68, 26, 132, 23, 103,
726 93, 148, 104, 19, 119, 57, 128, 39, 20, 68,
727 58, 96, 67, 24, 74, 149, 1, 2, 21, 74,
728 129, 3, 68, 4, 5, 22, 49, 25, 32, 46,
729 6, 7, 50, 8, 9, 47, 153, 10, 11, 1,
730 2, 44, 89, 90, 3, 91, 4, 5, 127, 94,
731 61, 54, 94, 6, 7, 58, 8, 9, 55, 138,
732 10, 140, 141, 142, 143, 144, 145, 34, 85, 62,
733 26, 101, 35, 27, 58, 102, 58, 56, 86, 60,
734 58, 63, 64, 65, 66, 117, 87, 88, 92, 95,
735 136, 98, 99, 118, 121, 122, 125, 91, 126, 157,
736 147, 134, 133, 146, 154, 33, 155, 156, 124, 158,
737 135, 48, 84, 0, 0, 72, 0, 0, 0, 0,
738 0, 0, 0, 0, 81, 0, 78
741 #define yypact_value_is_default(yystate) \
744 #define yytable_value_is_error(yytable_value) \
747 static const yytype_int16 yycheck[] =
749 11, 17, 18, 3, 15, 90, 17, 18, 19, 20,
750 3, 22, 51, 8, 25, 33, 11, 17, 29, 33,
751 8, 106, 8, 11, 17, 11, 14, 8, 28, 29,
752 11, 31, 3, 21, 34, 28, 29, 48, 31, 55,
753 56, 34, 81, 31, 55, 56, 17, 3, 59, 37,
754 36, 37, 4, 49, 50, 36, 33, 28, 29, 11,
755 31, 17, 3, 34, 9, 9, 18, 29, 20, 3,
756 15, 15, 24, 29, 11, 31, 17, 8, 33, 75,
757 11, 33, 78, 17, 21, 11, 48, 28, 29, 100,
758 31, 8, 37, 37, 11, 21, 8, 31, 1, 11,
759 37, 11, 14, 33, 35, 34, 3, 11, 33, 21,
760 39, 37, 11, 16, 31, 25, 5, 6, 33, 31,
761 17, 10, 21, 12, 13, 33, 9, 36, 0, 36,
762 19, 20, 15, 22, 23, 36, 147, 26, 27, 5,
763 6, 18, 35, 36, 10, 38, 12, 13, 115, 69,
764 34, 36, 72, 19, 20, 39, 22, 23, 33, 126,
765 26, 128, 129, 130, 131, 132, 133, 5, 35, 34,
766 8, 34, 10, 11, 39, 34, 39, 33, 35, 34,
767 39, 34, 34, 34, 34, 11, 35, 35, 33, 35,
768 7, 35, 35, 35, 33, 35, 33, 38, 33, 11,
769 33, 35, 38, 34, 33, 13, 34, 34, 106, 34,
770 121, 25, 59, -1, -1, 47, -1, -1, -1, -1,
771 -1, -1, -1, -1, 54, -1, 50
774 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
775 symbol of state STATE-NUM. */
776 static const yytype_uint8 yystos[] =
778 0, 5, 6, 10, 12, 13, 19, 20, 22, 23,
779 26, 27, 41, 42, 43, 33, 33, 33, 33, 33,
780 33, 33, 33, 1, 16, 36, 8, 11, 36, 56,
781 57, 61, 0, 43, 5, 10, 53, 55, 61, 11,
782 53, 53, 61, 61, 18, 61, 36, 36, 56, 9,
783 15, 58, 59, 57, 36, 33, 33, 34, 39, 54,
784 34, 34, 34, 34, 34, 34, 34, 11, 21, 44,
785 45, 46, 44, 37, 31, 60, 61, 62, 60, 37,
786 59, 58, 53, 53, 55, 35, 35, 35, 35, 35,
787 36, 38, 33, 37, 45, 35, 37, 62, 35, 35,
788 37, 34, 34, 11, 14, 46, 47, 48, 49, 62,
789 4, 11, 18, 20, 24, 33, 52, 11, 35, 35,
790 61, 33, 35, 37, 48, 33, 33, 52, 3, 17,
791 28, 29, 31, 38, 35, 49, 7, 51, 52, 34,
792 52, 52, 52, 52, 52, 52, 34, 33, 11, 25,
793 50, 34, 34, 61, 33, 34, 34, 11, 34
796 #define yyerrok (yyerrstatus = 0)
797 #define yyclearin (yychar = YYEMPTY)
801 #define YYACCEPT goto yyacceptlab
802 #define YYABORT goto yyabortlab
803 #define YYERROR goto yyerrorlab
806 /* Like YYERROR except do call yyerror. This remains here temporarily
807 to ease the transition to the new meaning of YYERROR, for GCC.
808 Once GCC version 2 has supplanted version 1, this can go. However,
809 YYFAIL appears to be in use. Nevertheless, it is formally deprecated
810 in Bison 2.4.2's NEWS entry, where a plan to phase it out is
813 #define YYFAIL goto yyerrlab
815 /* This is here to suppress warnings from the GCC cpp's
816 -Wunused-macros. Normally we don't worry about that warning, but
817 some users do, and we want to make it easy for users to remove
818 YYFAIL uses, which will produce warnings from Bison 2.5. */
821 #define YYRECOVERING() (!!yyerrstatus)
823 #define YYBACKUP(Token, Value) \
825 if (yychar == YYEMPTY && yylen == 1) \
834 yyerror (YY_("syntax error: cannot back up")); \
841 #define YYERRCODE 256
844 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
845 If N is 0, then set CURRENT to the empty location which ends
846 the previous symbol: RHS[0] (always defined). */
848 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
849 #ifndef YYLLOC_DEFAULT
850 # define YYLLOC_DEFAULT(Current, Rhs, N) \
854 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
855 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
856 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
857 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
861 (Current).first_line = (Current).last_line = \
862 YYRHSLOC (Rhs, 0).last_line; \
863 (Current).first_column = (Current).last_column = \
864 YYRHSLOC (Rhs, 0).last_column; \
870 /* This macro is provided for backward compatibility. */
872 #ifndef YY_LOCATION_PRINT
873 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
877 /* YYLEX -- calling `yylex' with the right arguments. */
880 # define YYLEX yylex (YYLEX_PARAM)
882 # define YYLEX yylex ()
885 /* Enable debugging if requested. */
889 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
890 # define YYFPRINTF fprintf
893 # define YYDPRINTF(Args) \
899 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
903 YYFPRINTF (stderr, "%s ", Title); \
904 yy_symbol_print (stderr, \
906 YYFPRINTF (stderr, "\n"); \
911 /*--------------------------------.
912 | Print this symbol on YYOUTPUT. |
913 `--------------------------------*/
916 #if (defined __STDC__ || defined __C99__FUNC__ \
917 || defined __cplusplus || defined _MSC_VER)
919 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
922 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
925 YYSTYPE const * const yyvaluep;
931 if (yytype < YYNTOKENS)
932 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
944 /*--------------------------------.
945 | Print this symbol on YYOUTPUT. |
946 `--------------------------------*/
948 #if (defined __STDC__ || defined __C99__FUNC__ \
949 || defined __cplusplus || defined _MSC_VER)
951 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
954 yy_symbol_print (yyoutput, yytype, yyvaluep)
957 YYSTYPE const * const yyvaluep;
960 if (yytype < YYNTOKENS)
961 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
963 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
965 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
966 YYFPRINTF (yyoutput, ")");
969 /*------------------------------------------------------------------.
970 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
972 `------------------------------------------------------------------*/
974 #if (defined __STDC__ || defined __C99__FUNC__ \
975 || defined __cplusplus || defined _MSC_VER)
977 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
980 yy_stack_print (yybottom, yytop)
981 yytype_int16 *yybottom;
985 YYFPRINTF (stderr, "Stack now");
986 for (; yybottom <= yytop; yybottom++)
988 int yybot = *yybottom;
989 YYFPRINTF (stderr, " %d", yybot);
991 YYFPRINTF (stderr, "\n");
994 # define YY_STACK_PRINT(Bottom, Top) \
997 yy_stack_print ((Bottom), (Top)); \
1001 /*------------------------------------------------.
1002 | Report that the YYRULE is going to be reduced. |
1003 `------------------------------------------------*/
1005 #if (defined __STDC__ || defined __C99__FUNC__ \
1006 || defined __cplusplus || defined _MSC_VER)
1008 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
1011 yy_reduce_print (yyvsp, yyrule)
1016 int yynrhs = yyr2[yyrule];
1018 unsigned long int yylno = yyrline[yyrule];
1019 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1021 /* The symbols being reduced. */
1022 for (yyi = 0; yyi < yynrhs; yyi++)
1024 YYFPRINTF (stderr, " $%d = ", yyi + 1);
1025 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1026 &(yyvsp[(yyi + 1) - (yynrhs)])
1028 YYFPRINTF (stderr, "\n");
1032 # define YY_REDUCE_PRINT(Rule) \
1035 yy_reduce_print (yyvsp, Rule); \
1038 /* Nonzero means print parse trace. It is left uninitialized so that
1039 multiple parsers can coexist. */
1041 #else /* !YYDEBUG */
1042 # define YYDPRINTF(Args)
1043 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1044 # define YY_STACK_PRINT(Bottom, Top)
1045 # define YY_REDUCE_PRINT(Rule)
1046 #endif /* !YYDEBUG */
1049 /* YYINITDEPTH -- initial size of the parser's stacks. */
1051 # define YYINITDEPTH 200
1054 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1055 if the built-in stack extension method is used).
1057 Do not make this value too large; the results are undefined if
1058 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1059 evaluated with infinite-precision integer arithmetic. */
1062 # define YYMAXDEPTH 10000
1069 # if defined __GLIBC__ && defined _STRING_H
1070 # define yystrlen strlen
1072 /* Return the length of YYSTR. */
1073 #if (defined __STDC__ || defined __C99__FUNC__ \
1074 || defined __cplusplus || defined _MSC_VER)
1076 yystrlen (const char *yystr)
1084 for (yylen = 0; yystr[yylen]; yylen++)
1092 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1093 # define yystpcpy stpcpy
1095 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1097 #if (defined __STDC__ || defined __C99__FUNC__ \
1098 || defined __cplusplus || defined _MSC_VER)
1100 yystpcpy (char *yydest, const char *yysrc)
1103 yystpcpy (yydest, yysrc)
1109 const char *yys = yysrc;
1111 while ((*yyd++ = *yys++) != '\0')
1120 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1121 quotes and backslashes, so that it's suitable for yyerror. The
1122 heuristic is that double-quoting is unnecessary unless the string
1123 contains an apostrophe, a comma, or backslash (other than
1124 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1125 null, do not copy; instead, return the length of what the result
1128 yytnamerr (char *yyres, const char *yystr)
1133 char const *yyp = yystr;
1140 goto do_not_strip_quotes;
1144 goto do_not_strip_quotes;
1157 do_not_strip_quotes: ;
1161 return yystrlen (yystr);
1163 return yystpcpy (yyres, yystr) - yyres;
1167 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1168 about the unexpected token YYTOKEN for the state stack whose top is
1171 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1172 not large enough to hold the message. In that case, also set
1173 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1174 required number of bytes is too large to store. */
1176 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1177 yytype_int16 *yyssp, int yytoken)
1179 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
1180 YYSIZE_T yysize = yysize0;
1182 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1183 /* Internationalized format string. */
1184 const char *yyformat = 0;
1185 /* Arguments of yyformat. */
1186 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1187 /* Number of reported tokens (one for the "unexpected", one per
1191 /* There are many possibilities here to consider:
1192 - Assume YYFAIL is not used. It's too flawed to consider. See
1193 <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
1194 for details. YYERROR is fine as it does not invoke this
1196 - If this state is a consistent state with a default action, then
1197 the only way this function was invoked is if the default action
1198 is an error action. In that case, don't check for expected
1199 tokens because there are none.
1200 - The only way there can be no lookahead present (in yychar) is if
1201 this state is a consistent state with a default action. Thus,
1202 detecting the absence of a lookahead is sufficient to determine
1203 that there is no unexpected or expected token to report. In that
1204 case, just report a simple "syntax error".
1205 - Don't assume there isn't a lookahead just because this state is a
1206 consistent state with a default action. There might have been a
1207 previous inconsistent state, consistent state with a non-default
1208 action, or user semantic action that manipulated yychar.
1209 - Of course, the expected token list depends on states to have
1210 correct lookahead information, and it depends on the parser not
1211 to perform extra reductions after fetching a lookahead from the
1212 scanner and before detecting a syntax error. Thus, state merging
1213 (from LALR or IELR) and default reductions corrupt the expected
1214 token list. However, the list is correct for canonical LR with
1215 one exception: it will still contain any token that will not be
1216 accepted due to an error action in a later state.
1218 if (yytoken != YYEMPTY)
1220 int yyn = yypact[*yyssp];
1221 yyarg[yycount++] = yytname[yytoken];
1222 if (!yypact_value_is_default (yyn))
1224 /* Start YYX at -YYN if negative to avoid negative indexes in
1225 YYCHECK. In other words, skip the first -YYN actions for
1226 this state because they are default actions. */
1227 int yyxbegin = yyn < 0 ? -yyn : 0;
1228 /* Stay within bounds of both yycheck and yytname. */
1229 int yychecklim = YYLAST - yyn + 1;
1230 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1233 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1234 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1235 && !yytable_value_is_error (yytable[yyx + yyn]))
1237 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1243 yyarg[yycount++] = yytname[yyx];
1244 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1245 if (! (yysize <= yysize1
1246 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1255 # define YYCASE_(N, S) \
1259 YYCASE_(0, YY_("syntax error"));
1260 YYCASE_(1, YY_("syntax error, unexpected %s"));
1261 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1262 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1263 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1264 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1268 yysize1 = yysize + yystrlen (yyformat);
1269 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1273 if (*yymsg_alloc < yysize)
1275 *yymsg_alloc = 2 * yysize;
1276 if (! (yysize <= *yymsg_alloc
1277 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1278 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1282 /* Avoid sprintf, as that infringes on the user's name space.
1283 Don't have undefined behavior even if the translation
1284 produced a string with the wrong number of "%s"s. */
1288 while ((*yyp = *yyformat) != '\0')
1289 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1291 yyp += yytnamerr (yyp, yyarg[yyi++]);
1302 #endif /* YYERROR_VERBOSE */
1304 /*-----------------------------------------------.
1305 | Release the memory associated to this symbol. |
1306 `-----------------------------------------------*/
1309 #if (defined __STDC__ || defined __C99__FUNC__ \
1310 || defined __cplusplus || defined _MSC_VER)
1312 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1315 yydestruct (yymsg, yytype, yyvaluep)
1325 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1336 /* Prevent warnings from -Wmissing-prototypes. */
1337 #ifdef YYPARSE_PARAM
1338 #if defined __STDC__ || defined __cplusplus
1339 int yyparse (void *YYPARSE_PARAM);
1343 #else /* ! YYPARSE_PARAM */
1344 #if defined __STDC__ || defined __cplusplus
1349 #endif /* ! YYPARSE_PARAM */
1352 /* The lookahead symbol. */
1355 /* The semantic value of the lookahead symbol. */
1358 /* Number of syntax errors so far. */
1366 #ifdef YYPARSE_PARAM
1367 #if (defined __STDC__ || defined __C99__FUNC__ \
1368 || defined __cplusplus || defined _MSC_VER)
1370 yyparse (void *YYPARSE_PARAM)
1373 yyparse (YYPARSE_PARAM)
1374 void *YYPARSE_PARAM;
1376 #else /* ! YYPARSE_PARAM */
1377 #if (defined __STDC__ || defined __C99__FUNC__ \
1378 || defined __cplusplus || defined _MSC_VER)
1389 /* Number of tokens to shift before error messages enabled. */
1392 /* The stacks and their tools:
1393 `yyss': related to states.
1394 `yyvs': related to semantic values.
1396 Refer to the stacks thru separate pointers, to allow yyoverflow
1397 to reallocate them elsewhere. */
1399 /* The state stack. */
1400 yytype_int16 yyssa[YYINITDEPTH];
1402 yytype_int16 *yyssp;
1404 /* The semantic value stack. */
1405 YYSTYPE yyvsa[YYINITDEPTH];
1409 YYSIZE_T yystacksize;
1413 /* Lookahead token as an internal (translated) token number. */
1415 /* The variables used to return semantic value and location from the
1420 /* Buffer for error messages, and its allocated size. */
1422 char *yymsg = yymsgbuf;
1423 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1426 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1428 /* The number of symbols on the RHS of the reduced rule.
1429 Keep to zero when no symbol should be popped. */
1435 yystacksize = YYINITDEPTH;
1437 YYDPRINTF ((stderr, "Starting parse\n"));
1442 yychar = YYEMPTY; /* Cause a token to be read. */
1444 /* Initialize stack pointers.
1445 Waste one element of value and location stack
1446 so that they stay on the same level as the state stack.
1447 The wasted elements are never initialized. */
1453 /*------------------------------------------------------------.
1454 | yynewstate -- Push a new state, which is found in yystate. |
1455 `------------------------------------------------------------*/
1457 /* In all cases, when you get here, the value and location stacks
1458 have just been pushed. So pushing a state here evens the stacks. */
1464 if (yyss + yystacksize - 1 <= yyssp)
1466 /* Get the current used size of the three stacks, in elements. */
1467 YYSIZE_T yysize = yyssp - yyss + 1;
1471 /* Give user a chance to reallocate the stack. Use copies of
1472 these so that the &'s don't force the real ones into
1474 YYSTYPE *yyvs1 = yyvs;
1475 yytype_int16 *yyss1 = yyss;
1477 /* Each stack pointer address is followed by the size of the
1478 data in use in that stack, in bytes. This used to be a
1479 conditional around just the two extra args, but that might
1480 be undefined if yyoverflow is a macro. */
1481 yyoverflow (YY_("memory exhausted"),
1482 &yyss1, yysize * sizeof (*yyssp),
1483 &yyvs1, yysize * sizeof (*yyvsp),
1489 #else /* no yyoverflow */
1490 # ifndef YYSTACK_RELOCATE
1491 goto yyexhaustedlab;
1493 /* Extend the stack our own way. */
1494 if (YYMAXDEPTH <= yystacksize)
1495 goto yyexhaustedlab;
1497 if (YYMAXDEPTH < yystacksize)
1498 yystacksize = YYMAXDEPTH;
1501 yytype_int16 *yyss1 = yyss;
1502 union yyalloc *yyptr =
1503 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1505 goto yyexhaustedlab;
1506 YYSTACK_RELOCATE (yyss_alloc, yyss);
1507 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1508 # undef YYSTACK_RELOCATE
1510 YYSTACK_FREE (yyss1);
1513 #endif /* no yyoverflow */
1515 yyssp = yyss + yysize - 1;
1516 yyvsp = yyvs + yysize - 1;
1518 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1519 (unsigned long int) yystacksize));
1521 if (yyss + yystacksize - 1 <= yyssp)
1525 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1527 if (yystate == YYFINAL)
1537 /* Do appropriate processing given the current state. Read a
1538 lookahead token if we need one and don't already have one. */
1540 /* First try to decide what to do without reference to lookahead token. */
1541 yyn = yypact[yystate];
1542 if (yypact_value_is_default (yyn))
1545 /* Not known => get a lookahead token if don't already have one. */
1547 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1548 if (yychar == YYEMPTY)
1550 YYDPRINTF ((stderr, "Reading a token: "));
1554 if (yychar <= YYEOF)
1556 yychar = yytoken = YYEOF;
1557 YYDPRINTF ((stderr, "Now at end of input.\n"));
1561 yytoken = YYTRANSLATE (yychar);
1562 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1565 /* If the proper action on seeing token YYTOKEN is to reduce or to
1566 detect an error, take that action. */
1568 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1573 if (yytable_value_is_error (yyn))
1579 /* Count tokens shifted since error; after three, turn off error
1584 /* Shift the lookahead token. */
1585 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1587 /* Discard the shifted token. */
1596 /*-----------------------------------------------------------.
1597 | yydefault -- do the default action for the current state. |
1598 `-----------------------------------------------------------*/
1600 yyn = yydefact[yystate];
1606 /*-----------------------------.
1607 | yyreduce -- Do a reduction. |
1608 `-----------------------------*/
1610 /* yyn is the number of a rule to reduce with. */
1613 /* If YYLEN is nonzero, implement the default value of the action:
1616 Otherwise, the following line sets YYVAL to garbage.
1617 This behavior is undocumented and Bison
1618 users should not rely upon it. Assigning to YYVAL
1619 unconditionally makes the parser a bit smaller, and it avoids a
1620 GCC warning that YYVAL may be used uninitialized. */
1621 yyval = yyvsp[1-yylen];
1624 YY_REDUCE_PRINT (yyn);
1629 /* Line 1806 of yacc.c */
1630 #line 137 "ldscript.y"
1631 { add_versions ((yyvsp[(2) - (2)].version)); }
1636 /* Line 1806 of yacc.c */
1637 #line 145 "ldscript.y"
1639 if (likely (ld_state.entry == NULL))
1640 ld_state.entry = (yyvsp[(3) - (5)].str);
1646 /* Line 1806 of yacc.c */
1647 #line 150 "ldscript.y"
1649 ld_new_searchdir ((yyvsp[(3) - (5)].str));
1655 /* Line 1806 of yacc.c */
1656 #line 154 "ldscript.y"
1658 if (likely (ld_state.pagesize == 0))
1659 ld_state.pagesize = (yyvsp[(3) - (5)].num);
1665 /* Line 1806 of yacc.c */
1666 #line 159 "ldscript.y"
1668 if (likely (ld_state.interp == NULL)
1669 && ld_state.file_type != dso_file_type)
1670 ld_state.interp = (yyvsp[(3) - (5)].str);
1676 /* Line 1806 of yacc.c */
1677 #line 165 "ldscript.y"
1679 new_segment ((yyvsp[(2) - (5)].num), (yyvsp[(4) - (5)].output_rule));
1685 /* Line 1806 of yacc.c */
1686 #line 169 "ldscript.y"
1688 fputs_unlocked (gettext ("mode for segment invalid\n"),
1690 new_segment (0, (yyvsp[(4) - (5)].output_rule));
1696 /* Line 1806 of yacc.c */
1697 #line 175 "ldscript.y"
1699 /* First little optimization. If there is only one
1700 file in the group don't do anything. */
1701 if ((yyvsp[(3) - (4)].filename_list) != (yyvsp[(3) - (4)].filename_list)->next)
1703 (yyvsp[(3) - (4)].filename_list)->next->group_start = 1;
1704 (yyvsp[(3) - (4)].filename_list)->group_end = 1;
1706 add_inputfiles ((yyvsp[(3) - (4)].filename_list));
1712 /* Line 1806 of yacc.c */
1713 #line 186 "ldscript.y"
1714 { add_inputfiles ((yyvsp[(3) - (4)].filename_list)); }
1719 /* Line 1806 of yacc.c */
1720 #line 188 "ldscript.y"
1721 { add_inputfiles (mark_as_needed ((yyvsp[(3) - (4)].filename_list))); }
1726 /* Line 1806 of yacc.c */
1727 #line 190 "ldscript.y"
1728 { add_versions ((yyvsp[(3) - (4)].version)); }
1733 /* Line 1806 of yacc.c */
1734 #line 192 "ldscript.y"
1740 /* Line 1806 of yacc.c */
1741 #line 196 "ldscript.y"
1743 (yyvsp[(2) - (2)].output_rule)->next = (yyvsp[(1) - (2)].output_rule)->next;
1744 (yyval.output_rule) = (yyvsp[(1) - (2)].output_rule)->next = (yyvsp[(2) - (2)].output_rule);
1750 /* Line 1806 of yacc.c */
1751 #line 201 "ldscript.y"
1752 { (yyval.output_rule) = (yyvsp[(1) - (1)].output_rule); }
1757 /* Line 1806 of yacc.c */
1758 #line 205 "ldscript.y"
1760 (yyval.output_rule) = new_output_rule (output_assignment);
1761 (yyval.output_rule)->val.assignment = (yyvsp[(1) - (2)].assignment);
1767 /* Line 1806 of yacc.c */
1768 #line 210 "ldscript.y"
1770 (yyval.output_rule) = new_output_rule (output_section);
1771 (yyval.output_rule)->val.section.name = (yyvsp[(1) - (4)].str);
1772 (yyval.output_rule)->val.section.input = (yyvsp[(3) - (4)].input_rule)->next;
1773 if (ld_state.strip == strip_debug
1774 && ebl_debugscn_p (ld_state.ebl, (yyvsp[(1) - (4)].str)))
1775 (yyval.output_rule)->val.section.ignored = true;
1777 (yyval.output_rule)->val.section.ignored = false;
1778 (yyvsp[(3) - (4)].input_rule)->next = NULL;
1784 /* Line 1806 of yacc.c */
1785 #line 222 "ldscript.y"
1787 /* This is a short cut for "ID { *(ID) }". */
1788 (yyval.output_rule) = new_output_rule (output_section);
1789 (yyval.output_rule)->val.section.name = (yyvsp[(1) - (2)].str);
1790 (yyval.output_rule)->val.section.input = new_input_rule (input_section);
1791 (yyval.output_rule)->val.section.input->next = NULL;
1792 (yyval.output_rule)->val.section.input->val.section =
1793 (struct filemask_section_name *)
1794 obstack_alloc (&ld_state.smem,
1795 sizeof (struct filemask_section_name));
1796 (yyval.output_rule)->val.section.input->val.section->filemask = NULL;
1797 (yyval.output_rule)->val.section.input->val.section->excludemask = NULL;
1798 (yyval.output_rule)->val.section.input->val.section->section_name =
1799 new_input_section_name ((yyvsp[(1) - (2)].str), false);
1800 (yyval.output_rule)->val.section.input->val.section->keep_flag = false;
1801 if (ld_state.strip == strip_debug
1802 && ebl_debugscn_p (ld_state.ebl, (yyvsp[(1) - (2)].str)))
1803 (yyval.output_rule)->val.section.ignored = true;
1805 (yyval.output_rule)->val.section.ignored = false;
1811 /* Line 1806 of yacc.c */
1812 #line 246 "ldscript.y"
1813 { (yyval.assignment) = new_assignment ((yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].expr), false); }
1818 /* Line 1806 of yacc.c */
1819 #line 248 "ldscript.y"
1820 { (yyval.assignment) = new_assignment ((yyvsp[(3) - (6)].str), (yyvsp[(5) - (6)].expr), true); }
1825 /* Line 1806 of yacc.c */
1826 #line 252 "ldscript.y"
1828 (yyvsp[(2) - (2)].input_rule)->next = (yyvsp[(1) - (2)].input_rule)->next;
1829 (yyval.input_rule) = (yyvsp[(1) - (2)].input_rule)->next = (yyvsp[(2) - (2)].input_rule);
1835 /* Line 1806 of yacc.c */
1836 #line 257 "ldscript.y"
1837 { (yyval.input_rule) = (yyvsp[(1) - (1)].input_rule); }
1842 /* Line 1806 of yacc.c */
1843 #line 261 "ldscript.y"
1845 (yyval.input_rule) = new_input_rule (input_section);
1846 (yyval.input_rule)->val.section = (yyvsp[(1) - (1)].filemask_section_name);
1852 /* Line 1806 of yacc.c */
1853 #line 266 "ldscript.y"
1855 (yyvsp[(3) - (4)].filemask_section_name)->keep_flag = true;
1857 (yyval.input_rule) = new_input_rule (input_section);
1858 (yyval.input_rule)->val.section = (yyvsp[(3) - (4)].filemask_section_name);
1864 /* Line 1806 of yacc.c */
1865 #line 273 "ldscript.y"
1867 (yyval.input_rule) = new_input_rule (input_assignment);
1868 (yyval.input_rule)->val.assignment = (yyvsp[(1) - (2)].assignment);
1874 /* Line 1806 of yacc.c */
1875 #line 280 "ldscript.y"
1877 (yyval.filemask_section_name) = (struct filemask_section_name *)
1878 obstack_alloc (&ld_state.smem, sizeof (*(yyval.filemask_section_name)));
1879 (yyval.filemask_section_name)->filemask = (yyvsp[(1) - (5)].str);
1880 (yyval.filemask_section_name)->excludemask = (yyvsp[(3) - (5)].str);
1881 (yyval.filemask_section_name)->section_name = (yyvsp[(4) - (5)].sectionname);
1882 (yyval.filemask_section_name)->keep_flag = false;
1888 /* Line 1806 of yacc.c */
1889 #line 291 "ldscript.y"
1890 { (yyval.sectionname) = new_input_section_name ((yyvsp[(1) - (1)].str), false); }
1895 /* Line 1806 of yacc.c */
1896 #line 293 "ldscript.y"
1897 { (yyval.sectionname) = new_input_section_name ((yyvsp[(3) - (4)].str), true); }
1902 /* Line 1806 of yacc.c */
1903 #line 297 "ldscript.y"
1904 { (yyval.str) = (yyvsp[(3) - (4)].str); }
1909 /* Line 1806 of yacc.c */
1910 #line 299 "ldscript.y"
1911 { (yyval.str) = NULL; }
1916 /* Line 1806 of yacc.c */
1917 #line 303 "ldscript.y"
1919 (yyval.expr) = new_expr (exp_align);
1920 (yyval.expr)->val.child = (yyvsp[(3) - (4)].expr);
1926 /* Line 1806 of yacc.c */
1927 #line 308 "ldscript.y"
1928 { (yyval.expr) = (yyvsp[(2) - (3)].expr); }
1933 /* Line 1806 of yacc.c */
1934 #line 310 "ldscript.y"
1936 (yyval.expr) = new_expr (exp_mult);
1937 (yyval.expr)->val.binary.left = (yyvsp[(1) - (3)].expr);
1938 (yyval.expr)->val.binary.right = (yyvsp[(3) - (3)].expr);
1944 /* Line 1806 of yacc.c */
1945 #line 316 "ldscript.y"
1947 (yyval.expr) = new_expr ((yyvsp[(2) - (3)].op));
1948 (yyval.expr)->val.binary.left = (yyvsp[(1) - (3)].expr);
1949 (yyval.expr)->val.binary.right = (yyvsp[(3) - (3)].expr);
1955 /* Line 1806 of yacc.c */
1956 #line 322 "ldscript.y"
1958 (yyval.expr) = new_expr ((yyvsp[(2) - (3)].op));
1959 (yyval.expr)->val.binary.left = (yyvsp[(1) - (3)].expr);
1960 (yyval.expr)->val.binary.right = (yyvsp[(3) - (3)].expr);
1966 /* Line 1806 of yacc.c */
1967 #line 328 "ldscript.y"
1969 (yyval.expr) = new_expr (exp_and);
1970 (yyval.expr)->val.binary.left = (yyvsp[(1) - (3)].expr);
1971 (yyval.expr)->val.binary.right = (yyvsp[(3) - (3)].expr);
1977 /* Line 1806 of yacc.c */
1978 #line 334 "ldscript.y"
1980 (yyval.expr) = new_expr (exp_or);
1981 (yyval.expr)->val.binary.left = (yyvsp[(1) - (3)].expr);
1982 (yyval.expr)->val.binary.right = (yyvsp[(3) - (3)].expr);
1988 /* Line 1806 of yacc.c */
1989 #line 340 "ldscript.y"
1991 (yyval.expr) = new_expr (exp_num);
1992 (yyval.expr)->val.num = (yyvsp[(1) - (1)].num);
1998 /* Line 1806 of yacc.c */
1999 #line 345 "ldscript.y"
2001 (yyval.expr) = new_expr (exp_id);
2002 (yyval.expr)->val.str = (yyvsp[(1) - (1)].str);
2008 /* Line 1806 of yacc.c */
2009 #line 350 "ldscript.y"
2010 { (yyval.expr) = new_expr (exp_sizeof_headers); }
2015 /* Line 1806 of yacc.c */
2016 #line 352 "ldscript.y"
2017 { (yyval.expr) = new_expr (exp_pagesize); }
2022 /* Line 1806 of yacc.c */
2023 #line 356 "ldscript.y"
2025 (yyvsp[(3) - (3)].filename_list)->next = (yyvsp[(1) - (3)].filename_list)->next;
2026 (yyval.filename_list) = (yyvsp[(1) - (3)].filename_list)->next = (yyvsp[(3) - (3)].filename_list);
2032 /* Line 1806 of yacc.c */
2033 #line 361 "ldscript.y"
2034 { (yyval.filename_list) = (yyvsp[(1) - (1)].filename_list); }
2039 /* Line 1806 of yacc.c */
2040 #line 369 "ldscript.y"
2042 /* First little optimization. If there is only one
2043 file in the group don't do anything. */
2044 if ((yyvsp[(3) - (4)].filename_list) != (yyvsp[(3) - (4)].filename_list)->next)
2046 (yyvsp[(3) - (4)].filename_list)->next->group_start = 1;
2047 (yyvsp[(3) - (4)].filename_list)->group_end = 1;
2049 (yyval.filename_list) = (yyvsp[(3) - (4)].filename_list);
2055 /* Line 1806 of yacc.c */
2056 #line 380 "ldscript.y"
2057 { (yyval.filename_list) = mark_as_needed ((yyvsp[(3) - (4)].filename_list)); }
2062 /* Line 1806 of yacc.c */
2063 #line 382 "ldscript.y"
2064 { (yyval.filename_list) = new_filename_listelem ((yyvsp[(1) - (1)].str)); }
2069 /* Line 1806 of yacc.c */
2070 #line 387 "ldscript.y"
2072 (yyvsp[(2) - (2)].version)->next = (yyvsp[(1) - (2)].version)->next;
2073 (yyval.version) = (yyvsp[(1) - (2)].version)->next = (yyvsp[(2) - (2)].version);
2079 /* Line 1806 of yacc.c */
2080 #line 392 "ldscript.y"
2081 { (yyval.version) = (yyvsp[(1) - (1)].version); }
2086 /* Line 1806 of yacc.c */
2087 #line 396 "ldscript.y"
2089 (yyvsp[(2) - (4)].version)->versionname = "";
2090 (yyvsp[(2) - (4)].version)->parentname = NULL;
2091 (yyval.version) = (yyvsp[(2) - (4)].version);
2097 /* Line 1806 of yacc.c */
2098 #line 402 "ldscript.y"
2100 (yyvsp[(3) - (5)].version)->versionname = (yyvsp[(1) - (5)].str);
2101 (yyvsp[(3) - (5)].version)->parentname = NULL;
2102 (yyval.version) = (yyvsp[(3) - (5)].version);
2108 /* Line 1806 of yacc.c */
2109 #line 408 "ldscript.y"
2111 (yyvsp[(3) - (6)].version)->versionname = (yyvsp[(1) - (6)].str);
2112 (yyvsp[(3) - (6)].version)->parentname = (yyvsp[(5) - (6)].str);
2113 (yyval.version) = (yyvsp[(3) - (6)].version);
2119 /* Line 1806 of yacc.c */
2120 #line 417 "ldscript.y"
2121 { (yyval.version) = merge_versions ((yyvsp[(1) - (2)].version), (yyvsp[(2) - (2)].version)); }
2126 /* Line 1806 of yacc.c */
2127 #line 419 "ldscript.y"
2128 { (yyval.version) = (yyvsp[(1) - (1)].version); }
2133 /* Line 1806 of yacc.c */
2134 #line 423 "ldscript.y"
2135 { (yyval.version) = new_version (NULL, (yyvsp[(2) - (2)].id_list)); }
2140 /* Line 1806 of yacc.c */
2141 #line 425 "ldscript.y"
2142 { (yyval.version) = new_version ((yyvsp[(2) - (2)].id_list), NULL); }
2147 /* Line 1806 of yacc.c */
2148 #line 430 "ldscript.y"
2150 struct id_list *newp = new_id_listelem ((yyvsp[(2) - (3)].str));
2151 newp->next = (yyvsp[(1) - (3)].id_list)->next;
2152 (yyval.id_list) = (yyvsp[(1) - (3)].id_list)->next = newp;
2158 /* Line 1806 of yacc.c */
2159 #line 436 "ldscript.y"
2160 { (yyval.id_list) = new_id_listelem ((yyvsp[(1) - (2)].str)); }
2165 /* Line 1806 of yacc.c */
2166 #line 440 "ldscript.y"
2167 { (yyval.str) = (yyvsp[(1) - (1)].str); }
2172 /* Line 1806 of yacc.c */
2173 #line 442 "ldscript.y"
2174 { (yyval.str) = (yyvsp[(1) - (1)].str); }
2179 /* Line 1806 of yacc.c */
2180 #line 446 "ldscript.y"
2181 { (yyval.str) = (yyvsp[(1) - (1)].str); }
2186 /* Line 1806 of yacc.c */
2187 #line 448 "ldscript.y"
2188 { (yyval.str) = NULL; }
2193 /* Line 1806 of yacc.c */
2194 #line 2195 "ldscript.c"
2197 /* User semantic actions sometimes alter yychar, and that requires
2198 that yytoken be updated with the new translation. We take the
2199 approach of translating immediately before every use of yytoken.
2200 One alternative is translating here after every semantic action,
2201 but that translation would be missed if the semantic action invokes
2202 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2203 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2204 incorrect destructor might then be invoked immediately. In the
2205 case of YYERROR or YYBACKUP, subsequent parser actions might lead
2206 to an incorrect destructor call or verbose syntax error message
2207 before the lookahead is translated. */
2208 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2212 YY_STACK_PRINT (yyss, yyssp);
2216 /* Now `shift' the result of the reduction. Determine what state
2217 that goes to, based on the state we popped back to and the rule
2218 number reduced by. */
2222 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2223 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2224 yystate = yytable[yystate];
2226 yystate = yydefgoto[yyn - YYNTOKENS];
2231 /*------------------------------------.
2232 | yyerrlab -- here on detecting error |
2233 `------------------------------------*/
2235 /* Make sure we have latest lookahead translation. See comments at
2236 user semantic actions for why this is necessary. */
2237 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
2239 /* If not already recovering from an error, report this error. */
2243 #if ! YYERROR_VERBOSE
2244 yyerror (YY_("syntax error"));
2246 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2249 char const *yymsgp = YY_("syntax error");
2250 int yysyntax_error_status;
2251 yysyntax_error_status = YYSYNTAX_ERROR;
2252 if (yysyntax_error_status == 0)
2254 else if (yysyntax_error_status == 1)
2256 if (yymsg != yymsgbuf)
2257 YYSTACK_FREE (yymsg);
2258 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
2262 yymsg_alloc = sizeof yymsgbuf;
2263 yysyntax_error_status = 2;
2267 yysyntax_error_status = YYSYNTAX_ERROR;
2272 if (yysyntax_error_status == 2)
2273 goto yyexhaustedlab;
2275 # undef YYSYNTAX_ERROR
2281 if (yyerrstatus == 3)
2283 /* If just tried and failed to reuse lookahead token after an
2284 error, discard it. */
2286 if (yychar <= YYEOF)
2288 /* Return failure if at end of input. */
2289 if (yychar == YYEOF)
2294 yydestruct ("Error: discarding",
2300 /* Else will try to reuse lookahead token after shifting the error
2305 /*---------------------------------------------------.
2306 | yyerrorlab -- error raised explicitly by YYERROR. |
2307 `---------------------------------------------------*/
2310 /* Pacify compilers like GCC when the user code never invokes
2311 YYERROR and the label yyerrorlab therefore never appears in user
2313 if (/*CONSTCOND*/ 0)
2316 /* Do not reclaim the symbols of the rule which action triggered
2320 YY_STACK_PRINT (yyss, yyssp);
2325 /*-------------------------------------------------------------.
2326 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2327 `-------------------------------------------------------------*/
2329 yyerrstatus = 3; /* Each real token shifted decrements this. */
2333 yyn = yypact[yystate];
2334 if (!yypact_value_is_default (yyn))
2337 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2345 /* Pop the current state because it cannot handle the error token. */
2350 yydestruct ("Error: popping",
2351 yystos[yystate], yyvsp);
2354 YY_STACK_PRINT (yyss, yyssp);
2360 /* Shift the error token. */
2361 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2367 /*-------------------------------------.
2368 | yyacceptlab -- YYACCEPT comes here. |
2369 `-------------------------------------*/
2374 /*-----------------------------------.
2375 | yyabortlab -- YYABORT comes here. |
2376 `-----------------------------------*/
2381 #if !defined(yyoverflow) || YYERROR_VERBOSE
2382 /*-------------------------------------------------.
2383 | yyexhaustedlab -- memory exhaustion comes here. |
2384 `-------------------------------------------------*/
2386 yyerror (YY_("memory exhausted"));
2392 if (yychar != YYEMPTY)
2394 /* Make sure we have latest lookahead translation. See comments at
2395 user semantic actions for why this is necessary. */
2396 yytoken = YYTRANSLATE (yychar);
2397 yydestruct ("Cleanup: discarding lookahead",
2400 /* Do not reclaim the symbols of the rule which action triggered
2401 this YYABORT or YYACCEPT. */
2403 YY_STACK_PRINT (yyss, yyssp);
2404 while (yyssp != yyss)
2406 yydestruct ("Cleanup: popping",
2407 yystos[*yyssp], yyvsp);
2412 YYSTACK_FREE (yyss);
2415 if (yymsg != yymsgbuf)
2416 YYSTACK_FREE (yymsg);
2418 /* Make sure YYID is used. */
2419 return YYID (yyresult);
2424 /* Line 2067 of yacc.c */
2425 #line 451 "ldscript.y"
2429 yyerror (const char *s)
2431 error (0, 0, (ld_scan_version_script
2432 ? gettext ("while reading version script '%s': %s at line %d")
2433 : gettext ("while reading linker script '%s': %s at line %d")),
2434 ldin_fname, gettext (s), ldlineno);
2438 static struct expression *
2441 struct expression *newp = (struct expression *)
2442 obstack_alloc (&ld_state.smem, sizeof (*newp));
2449 static struct input_section_name *
2450 new_input_section_name (const char *name, bool sort_flag)
2452 struct input_section_name *newp = (struct input_section_name *)
2453 obstack_alloc (&ld_state.smem, sizeof (*newp));
2456 newp->sort_flag = sort_flag;
2461 static struct input_rule *
2462 new_input_rule (int tag)
2464 struct input_rule *newp = (struct input_rule *)
2465 obstack_alloc (&ld_state.smem, sizeof (*newp));
2473 static struct output_rule *
2474 new_output_rule (int tag)
2476 struct output_rule *newp = (struct output_rule *)
2477 memset (obstack_alloc (&ld_state.smem, sizeof (*newp)),
2478 '\0', sizeof (*newp));
2486 static struct assignment *
2487 new_assignment (const char *variable, struct expression *expression,
2490 struct assignment *newp = (struct assignment *)
2491 obstack_alloc (&ld_state.smem, sizeof (*newp));
2493 newp->variable = variable;
2494 newp->expression = expression;
2496 newp->provide_flag = provide_flag;
2498 /* Insert the symbol into a hash table. We will later have to matc*/
2504 new_segment (int mode, struct output_rule *output_rule)
2506 struct output_segment *newp;
2509 = (struct output_segment *) obstack_alloc (&ld_state.smem, sizeof (*newp));
2513 newp->output_rules = output_rule->next;
2514 output_rule->next = NULL;
2516 /* Enqueue the output segment description. */
2517 if (ld_state.output_segments == NULL)
2518 ld_state.output_segments = newp;
2521 newp->next = ld_state.output_segments->next;
2522 ld_state.output_segments = ld_state.output_segments->next = newp;
2525 /* If the output file should be stripped of all symbol set the flag
2526 in the structures of all output sections. */
2527 if (mode == 0 && ld_state.strip == strip_all)
2529 struct output_rule *runp;
2531 for (runp = newp->output_rules; runp != NULL; runp = runp->next)
2532 if (runp->tag == output_section)
2533 runp->val.section.ignored = true;
2538 static struct filename_list *
2539 new_filename_listelem (const char *string)
2541 struct filename_list *newp;
2543 /* We use calloc and not the obstack since this object can be freed soon. */
2544 newp = (struct filename_list *) xcalloc (1, sizeof (*newp));
2545 newp->name = string;
2551 static struct filename_list *
2552 mark_as_needed (struct filename_list *listp)
2554 struct filename_list *runp = listp;
2557 runp->as_needed = true;
2560 while (runp != listp);
2567 add_inputfiles (struct filename_list *fnames)
2569 assert (fnames != NULL);
2571 if (ld_state.srcfiles == NULL)
2572 ld_state.srcfiles = fnames;
2575 struct filename_list *first = ld_state.srcfiles->next;
2577 ld_state.srcfiles->next = fnames->next;
2578 fnames->next = first;
2579 ld_state.srcfiles->next = fnames;
2585 special_char_p (const char *str)
2587 while (*str != '\0')
2589 if (__builtin_expect (*str == '*', 0)
2590 || __builtin_expect (*str == '?', 0)
2591 || __builtin_expect (*str == '[', 0))
2601 static struct id_list *
2602 new_id_listelem (const char *str)
2604 struct id_list *newp;
2606 newp = (struct id_list *) obstack_alloc (&ld_state.smem, sizeof (*newp));
2608 newp->u.id_type = id_all;
2609 else if (__builtin_expect (special_char_p (str), false))
2610 newp->u.id_type = id_wild;
2612 newp->u.id_type = id_str;
2620 static struct version *
2621 new_version (struct id_list *local, struct id_list *global)
2623 struct version *newp;
2625 newp = (struct version *) obstack_alloc (&ld_state.smem, sizeof (*newp));
2627 newp->local_names = local;
2628 newp->global_names = global;
2629 newp->versionname = NULL;
2630 newp->parentname = NULL;
2636 static struct version *
2637 merge_versions (struct version *one, struct version *two)
2639 assert (two->local_names == NULL || two->global_names == NULL);
2641 if (two->local_names != NULL)
2643 if (one->local_names == NULL)
2644 one->local_names = two->local_names;
2647 two->local_names->next = one->local_names->next;
2648 one->local_names = one->local_names->next = two->local_names;
2653 if (one->global_names == NULL)
2654 one->global_names = two->global_names;
2657 two->global_names->next = one->global_names->next;
2658 one->global_names = one->global_names->next = two->global_names;
2667 add_id_list (const char *versionname, struct id_list *runp, _Bool local)
2669 struct id_list *lastp = runp;
2672 /* Nothing to do. */
2675 /* Convert into a simple single-linked list. */
2677 assert (runp != NULL);
2681 if (runp->u.id_type == id_str)
2683 struct id_list *curp;
2684 struct id_list *defp;
2685 unsigned long int hval = elf_hash (runp->id);
2690 defp = ld_version_str_tab_find (&ld_state.version_str_tab, hval, curp);
2693 /* There is already a version definition for this symbol. */
2694 while (strcmp (defp->u.s.versionname, versionname) != 0)
2696 if (defp->next == NULL)
2698 /* No version like this so far. */
2700 curp->u.s.local = local;
2701 curp->u.s.versionname = versionname;
2710 if (defp != NULL && defp->u.s.local != local)
2711 error (EXIT_FAILURE, 0, versionname[0] == '\0'
2713 symbol '%s' is declared both local and global for unnamed version")
2715 symbol '%s' is declared both local and global for version '%s'"),
2716 runp->id, versionname);
2720 /* This is the first version definition for this symbol. */
2721 ld_version_str_tab_insert (&ld_state.version_str_tab, hval, curp);
2723 curp->u.s.local = local;
2724 curp->u.s.versionname = versionname;
2728 else if (runp->u.id_type == id_all)
2732 if (ld_state.default_bind_global)
2733 error (EXIT_FAILURE, 0,
2734 gettext ("default visibility set as local and global"));
2735 ld_state.default_bind_local = true;
2739 if (ld_state.default_bind_local)
2740 error (EXIT_FAILURE, 0,
2741 gettext ("default visibility set as local and global"));
2742 ld_state.default_bind_global = true;
2749 assert (runp->u.id_type == id_wild);
2753 while (runp != NULL);
2758 add_versions (struct version *versions)
2760 struct version *lastp = versions;
2762 if (versions == NULL)
2765 /* Convert into a simple single-linked list. */
2766 versions = versions->next;
2767 assert (versions != NULL);
2772 add_id_list (versions->versionname, versions->local_names, true);
2773 add_id_list (versions->versionname, versions->global_names, false);
2775 versions = versions->next;
2777 while (versions != NULL);