1 /* A Bison parser, made by GNU Bison 2.7. */
3 /* Bison implementation for Yacc-like parsers in C
5 Copyright (C) 1984, 1989-1990, 2000-2012 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.7"
50 #define YYSKELETON_NAME "yacc.c"
62 /* Substitute the variable and function names. */
63 #define yyparse ldparse
65 #define yyerror lderror
68 #define yydebug lddebug
69 #define yynerrs ldnerrs
71 /* Copy the first part of user declarations. */
72 /* Line 371 of yacc.c */
75 /* Parser for linker scripts.
76 Copyright (C) 2001-2011 Red Hat, Inc.
77 This file is part of elfutils.
78 Written by Ulrich Drepper <drepper@redhat.com>, 2001.
80 This file is free software; you can redistribute it and/or modify
81 it under the terms of the GNU General Public License as published by
82 the Free Software Foundation; either version 3 of the License, or
83 (at your option) any later version.
85 elfutils is distributed in the hope that it will be useful, but
86 WITHOUT ANY WARRANTY; without even the implied warranty of
87 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
88 GNU General Public License for more details.
90 You should have received a copy of the GNU General Public License
91 along with this program. If not, see <http://www.gnu.org/licenses/>. */
109 /* The error handler. */
110 static void yyerror (const char *s);
112 /* Some helper functions we need to construct the data structures
113 describing information from the file. */
114 static struct expression *new_expr (int tag);
115 static struct input_section_name *new_input_section_name (const char *name,
117 static struct input_rule *new_input_rule (int tag);
118 static struct output_rule *new_output_rule (int tag);
119 static struct assignment *new_assignment (const char *variable,
120 struct expression *expression,
122 static void new_segment (int mode, struct output_rule *output_rule);
123 static struct filename_list *new_filename_listelem (const char *string);
124 static void add_inputfiles (struct filename_list *fnames);
125 static struct id_list *new_id_listelem (const char *str);
126 static struct filename_list *mark_as_needed (struct filename_list *listp);
127 static struct version *new_version (struct id_list *local,
128 struct id_list *global);
129 static struct version *merge_versions (struct version *one,
130 struct version *two);
131 static void add_versions (struct version *versions);
133 extern int yylex (void);
135 /* Line 371 of yacc.c */
136 #line 137 "ldscript.c"
139 # if defined __cplusplus && 201103L <= __cplusplus
140 # define YY_NULL nullptr
146 /* Enabling verbose error messages. */
147 #ifdef YYERROR_VERBOSE
148 # undef YYERROR_VERBOSE
149 # define YYERROR_VERBOSE 1
151 # define YYERROR_VERBOSE 0
154 /* In a future release of Bison, this section will be replaced
155 by #include "y.tab.h". */
156 #ifndef YY_LD_LDSCRIPT_H_INCLUDED
157 # define YY_LD_LDSCRIPT_H_INCLUDED
158 /* Enabling traces. */
169 /* Put the tokens into the symbol table, so that GDB and other debuggers
188 kOUTPUT_FORMAT = 274,
193 kSIZEOF_HEADERS = 279,
196 kVERSION_SCRIPT = 282,
204 #define kAS_NEEDED 260
206 #define kEXCLUDE_FILE 262
207 #define kFILENAME 263
218 #define kOUTPUT_FORMAT 274
219 #define kPAGESIZE 275
221 #define kSEARCH_DIR 277
223 #define kSIZEOF_HEADERS 279
226 #define kVERSION_SCRIPT 282
232 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
233 typedef union YYSTYPE
235 /* Line 387 of yacc.c */
236 #line 63 "ldscript.y"
239 enum expression_tag op;
241 struct expression *expr;
242 struct input_section_name *sectionname;
243 struct filemask_section_name *filemask_section_name;
244 struct input_rule *input_rule;
245 struct output_rule *output_rule;
246 struct assignment *assignment;
247 struct filename_list *filename_list;
248 struct version *version;
249 struct id_list *id_list;
252 /* Line 387 of yacc.c */
253 #line 254 "ldscript.c"
255 # define YYSTYPE_IS_TRIVIAL 1
256 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
257 # define YYSTYPE_IS_DECLARED 1
260 extern YYSTYPE ldlval;
263 #if defined __STDC__ || defined __cplusplus
264 int ldparse (void *YYPARSE_PARAM);
268 #else /* ! YYPARSE_PARAM */
269 #if defined __STDC__ || defined __cplusplus
274 #endif /* ! YYPARSE_PARAM */
276 #endif /* !YY_LD_LDSCRIPT_H_INCLUDED */
278 /* Copy the second part of user declarations. */
280 /* Line 390 of yacc.c */
281 #line 282 "ldscript.c"
288 typedef YYTYPE_UINT8 yytype_uint8;
290 typedef unsigned char yytype_uint8;
294 typedef YYTYPE_INT8 yytype_int8;
295 #elif (defined __STDC__ || defined __C99__FUNC__ \
296 || defined __cplusplus || defined _MSC_VER)
297 typedef signed char yytype_int8;
299 typedef short int yytype_int8;
303 typedef YYTYPE_UINT16 yytype_uint16;
305 typedef unsigned short int yytype_uint16;
309 typedef YYTYPE_INT16 yytype_int16;
311 typedef short int yytype_int16;
315 # ifdef __SIZE_TYPE__
316 # define YYSIZE_T __SIZE_TYPE__
317 # elif defined size_t
318 # define YYSIZE_T size_t
319 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
320 || defined __cplusplus || defined _MSC_VER)
321 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
322 # define YYSIZE_T size_t
324 # define YYSIZE_T unsigned int
328 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
331 # if defined YYENABLE_NLS && YYENABLE_NLS
333 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
334 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
338 # define YY_(Msgid) Msgid
342 /* Suppress unused-variable warnings by "using" E. */
343 #if ! defined lint || defined __GNUC__
344 # define YYUSE(E) ((void) (E))
346 # define YYUSE(E) /* empty */
349 /* Identity function, used to suppress warnings about constant conditions. */
353 #if (defined __STDC__ || defined __C99__FUNC__ \
354 || defined __cplusplus || defined _MSC_VER)
367 #if ! defined yyoverflow || YYERROR_VERBOSE
369 /* The parser invokes alloca or malloc; define the necessary symbols. */
371 # ifdef YYSTACK_USE_ALLOCA
372 # if YYSTACK_USE_ALLOCA
374 # define YYSTACK_ALLOC __builtin_alloca
375 # elif defined __BUILTIN_VA_ARG_INCR
376 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
378 # define YYSTACK_ALLOC __alloca
379 # elif defined _MSC_VER
380 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
381 # define alloca _alloca
383 # define YYSTACK_ALLOC alloca
384 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
385 || defined __cplusplus || defined _MSC_VER)
386 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
387 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
388 # ifndef EXIT_SUCCESS
389 # define EXIT_SUCCESS 0
396 # ifdef YYSTACK_ALLOC
397 /* Pacify GCC's `empty if-body' warning. */
398 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
399 # ifndef YYSTACK_ALLOC_MAXIMUM
400 /* The OS might guarantee only one guard page at the bottom of the stack,
401 and a page size can be as small as 4096 bytes. So we cannot safely
402 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
403 to allow for a few compiler-allocated temporary stack slots. */
404 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
407 # define YYSTACK_ALLOC YYMALLOC
408 # define YYSTACK_FREE YYFREE
409 # ifndef YYSTACK_ALLOC_MAXIMUM
410 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
412 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
413 && ! ((defined YYMALLOC || defined malloc) \
414 && (defined YYFREE || defined free)))
415 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
416 # ifndef EXIT_SUCCESS
417 # define EXIT_SUCCESS 0
421 # define YYMALLOC malloc
422 # if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
423 || defined __cplusplus || defined _MSC_VER)
424 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
429 # if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
430 || defined __cplusplus || defined _MSC_VER)
431 void free (void *); /* INFRINGES ON USER NAME SPACE */
435 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
438 #if (! defined yyoverflow \
439 && (! defined __cplusplus \
440 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
442 /* A type that is properly aligned for any stack member. */
445 yytype_int16 yyss_alloc;
449 /* The size of the maximum gap between one aligned stack and the next. */
450 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
452 /* The size of an array large to enough to hold all stacks, each with
454 # define YYSTACK_BYTES(N) \
455 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
456 + YYSTACK_GAP_MAXIMUM)
458 # define YYCOPY_NEEDED 1
460 /* Relocate STACK from its old location to the new one. The
461 local variables YYSIZE and YYSTACKSIZE give the old and new number of
462 elements in the stack, and YYPTR gives the new location of the
463 stack. Advance YYPTR to a properly aligned location for the next
465 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
468 YYSIZE_T yynewbytes; \
469 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
470 Stack = &yyptr->Stack_alloc; \
471 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
472 yyptr += yynewbytes / sizeof (*yyptr); \
478 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
479 /* Copy COUNT objects from SRC to DST. The source and destination do
482 # if defined __GNUC__ && 1 < __GNUC__
483 # define YYCOPY(Dst, Src, Count) \
484 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
486 # define YYCOPY(Dst, Src, Count) \
490 for (yyi = 0; yyi < (Count); yyi++) \
491 (Dst)[yyi] = (Src)[yyi]; \
496 #endif /* !YYCOPY_NEEDED */
498 /* YYFINAL -- State number of the termination state. */
500 /* YYLAST -- Last index in YYTABLE. */
503 /* YYNTOKENS -- Number of terminals. */
505 /* YYNNTS -- Number of nonterminals. */
507 /* YYNRULES -- Number of rules. */
509 /* YYNRULES -- Number of states. */
510 #define YYNSTATES 159
512 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
514 #define YYMAXUTOK 284
516 #define YYTRANSLATE(YYX) \
517 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
519 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
520 static const yytype_uint8 yytranslate[] =
522 0, 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, 29, 2,
526 33, 34, 31, 2, 39, 2, 2, 2, 2, 2,
527 2, 2, 2, 2, 2, 2, 2, 2, 2, 35,
528 2, 38, 2, 2, 2, 2, 2, 2, 2, 2,
529 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
530 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
531 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
532 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
533 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
534 2, 2, 2, 36, 28, 37, 2, 2, 2, 2,
535 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
536 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
537 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
538 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
539 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
540 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
541 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
542 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
543 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
544 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
545 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
546 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
547 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
548 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
549 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
554 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
556 static const yytype_uint8 yyprhs[] =
558 0, 0, 3, 5, 8, 11, 13, 19, 25, 31,
559 37, 43, 49, 54, 59, 64, 69, 74, 77, 79,
560 82, 87, 90, 94, 101, 104, 106, 108, 113, 116,
561 122, 124, 129, 134, 135, 140, 144, 148, 152, 156,
562 160, 164, 166, 168, 170, 172, 176, 178, 180, 181,
563 186, 191, 193, 196, 198, 203, 209, 216, 219, 221,
564 224, 227, 231, 234, 236, 238, 240
567 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
568 static const yytype_int8 yyrhs[] =
570 41, 0, -1, 42, -1, 27, 56, -1, 42, 43,
571 -1, 43, -1, 6, 33, 11, 34, 35, -1, 22,
572 33, 61, 34, 35, -1, 20, 33, 18, 34, 35,
573 -1, 13, 33, 61, 34, 35, -1, 23, 16, 36,
574 44, 37, -1, 23, 1, 36, 44, 37, -1, 10,
575 33, 53, 34, -1, 12, 33, 53, 34, -1, 5,
576 33, 53, 34, -1, 26, 36, 56, 37, -1, 19,
577 33, 61, 34, -1, 44, 45, -1, 45, -1, 46,
578 35, -1, 11, 36, 47, 37, -1, 11, 35, -1,
579 11, 38, 52, -1, 21, 33, 11, 38, 52, 34,
580 -1, 47, 48, -1, 48, -1, 49, -1, 14, 33,
581 49, 34, -1, 46, 35, -1, 62, 33, 51, 50,
582 34, -1, 11, -1, 25, 33, 11, 34, -1, 7,
583 33, 61, 34, -1, -1, 4, 33, 52, 34, -1,
584 33, 52, 34, -1, 52, 31, 52, -1, 52, 17,
585 52, -1, 52, 3, 52, -1, 52, 29, 52, -1,
586 52, 28, 52, -1, 18, -1, 11, -1, 24, -1,
587 20, -1, 53, 54, 55, -1, 55, -1, 39, -1,
588 -1, 10, 33, 53, 34, -1, 5, 33, 53, 34,
589 -1, 61, -1, 56, 57, -1, 57, -1, 36, 58,
590 37, 35, -1, 61, 36, 58, 37, 35, -1, 61,
591 36, 58, 37, 61, 35, -1, 58, 59, -1, 59,
592 -1, 9, 60, -1, 15, 60, -1, 60, 62, 35,
593 -1, 62, 35, -1, 8, -1, 11, -1, 61, -1,
597 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
598 static const yytype_uint16 yyrline[] =
600 0, 135, 135, 136, 140, 141, 144, 149, 153, 158,
601 164, 168, 174, 185, 187, 189, 191, 195, 200, 204,
602 209, 221, 245, 247, 251, 256, 260, 265, 272, 279,
603 290, 292, 296, 299, 302, 307, 309, 315, 321, 327,
604 333, 339, 344, 349, 351, 355, 360, 364, 365, 368,
605 379, 381, 386, 391, 395, 401, 407, 416, 418, 422,
606 424, 429, 435, 439, 441, 445, 447
610 #if YYDEBUG || YYERROR_VERBOSE || 0
611 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
612 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
613 static const char *const yytname[] =
615 "$end", "error", "$undefined", "kADD_OP", "kALIGN", "kAS_NEEDED",
616 "kENTRY", "kEXCLUDE_FILE", "kFILENAME", "kGLOBAL", "kGROUP", "kID",
617 "kINPUT", "kINTERP", "kKEEP", "kLOCAL", "kMODE", "kMUL_OP", "kNUM",
618 "kOUTPUT_FORMAT", "kPAGESIZE", "kPROVIDE", "kSEARCH_DIR", "kSEGMENT",
619 "kSIZEOF_HEADERS", "kSORT", "kVERSION", "kVERSION_SCRIPT", "'|'", "'&'",
620 "ADD_OP", "'*'", "MUL_OP", "'('", "')'", "';'", "'{'", "'}'", "'='",
621 "','", "$accept", "script_or_version", "file", "content",
622 "outputsections", "outputsection", "assignment", "inputsections",
623 "inputsection", "sectionname", "sort_opt_name", "exclude_opt", "expr",
624 "filename_id_list", "comma_opt", "filename_id_listelem", "versionlist",
625 "version", "version_stmt_list", "version_stmt", "filename_id_star_list",
626 "filename_id", "filename_id_star", YY_NULL
631 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
633 static const yytype_uint16 yytoknum[] =
635 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
636 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
637 275, 276, 277, 278, 279, 280, 281, 282, 124, 38,
638 283, 42, 284, 40, 41, 59, 123, 125, 61, 44
642 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
643 static const yytype_uint8 yyr1[] =
645 0, 40, 41, 41, 42, 42, 43, 43, 43, 43,
646 43, 43, 43, 43, 43, 43, 43, 44, 44, 45,
647 45, 45, 46, 46, 47, 47, 48, 48, 48, 49,
648 50, 50, 51, 51, 52, 52, 52, 52, 52, 52,
649 52, 52, 52, 52, 52, 53, 53, 54, 54, 55,
650 55, 55, 56, 56, 57, 57, 57, 58, 58, 59,
651 59, 60, 60, 61, 61, 62, 62
654 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
655 static const yytype_uint8 yyr2[] =
657 0, 2, 1, 2, 2, 1, 5, 5, 5, 5,
658 5, 5, 4, 4, 4, 4, 4, 2, 1, 2,
659 4, 2, 3, 6, 2, 1, 1, 4, 2, 5,
660 1, 4, 4, 0, 4, 3, 3, 3, 3, 3,
661 3, 1, 1, 1, 1, 3, 1, 1, 0, 4,
662 4, 1, 2, 1, 4, 5, 6, 2, 1, 2,
666 /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
667 Performed when YYTABLE doesn't specify something else to do. Zero
668 means the default is an error. */
669 static const yytype_uint8 yydefact[] =
671 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
672 0, 0, 0, 2, 5, 0, 0, 0, 0, 0,
673 0, 0, 0, 0, 0, 0, 63, 64, 0, 3,
674 53, 0, 1, 4, 0, 0, 48, 46, 51, 0,
675 48, 48, 0, 0, 0, 0, 0, 0, 0, 0,
676 0, 0, 58, 52, 0, 0, 0, 14, 47, 0,
677 0, 12, 13, 0, 16, 0, 0, 0, 0, 0,
678 18, 0, 0, 15, 66, 59, 65, 0, 60, 0,
679 57, 0, 48, 48, 45, 6, 9, 8, 7, 21,
680 0, 0, 0, 11, 17, 19, 10, 0, 62, 54,
681 0, 50, 49, 64, 0, 0, 0, 25, 26, 0,
682 0, 42, 41, 44, 43, 0, 22, 0, 61, 55,
683 0, 0, 28, 20, 24, 33, 0, 0, 0, 0,
684 0, 0, 0, 0, 56, 0, 0, 0, 0, 35,
685 38, 37, 40, 39, 36, 0, 27, 0, 30, 0,
686 0, 34, 23, 0, 0, 29, 32, 0, 31
689 /* YYDEFGOTO[NTERM-NUM]. */
690 static const yytype_int16 yydefgoto[] =
692 -1, 12, 13, 14, 69, 70, 71, 106, 107, 108,
693 150, 137, 116, 36, 59, 37, 29, 30, 51, 52,
697 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
699 #define YYPACT_NINF -86
700 static const yytype_int16 yypact[] =
702 111, -18, -14, 23, 45, 70, 75, 85, 92, 97,
703 91, 19, 128, 134, -86, 162, 96, 162, 162, 5,
704 5, 123, 5, 93, 99, 19, -86, -86, 117, 19,
705 -86, 115, -86, -86, 125, 144, 71, -86, -86, 145,
706 116, 135, 147, 148, 149, 150, 101, 101, 14, 83,
707 83, 55, -86, -86, 117, 162, 162, -86, -86, 162,
708 133, -86, -86, 143, -86, 151, 152, 107, 155, 63,
709 -86, 154, 74, -86, -86, 83, -86, 156, 83, 157,
710 -86, 56, 137, 141, -86, -86, -86, -86, -86, -86,
711 88, 48, 174, -86, -86, -86, -86, 158, -86, -86,
712 69, -86, -86, 159, 161, 160, 12, -86, -86, 163,
713 165, -86, -86, -86, -86, 48, 59, 164, -86, -86,
714 166, 83, -86, -86, -86, 183, 48, 0, 48, 48,
715 48, 48, 48, 48, -86, 169, 167, 90, 7, -86,
716 59, 59, 44, 66, 103, 29, -86, 5, -86, 171,
717 172, -86, -86, 173, 188, -86, -86, 175, -86
720 /* YYPGOTO[NTERM-NUM]. */
721 static const yytype_int16 yypgoto[] =
723 -86, -86, -86, 192, 168, 80, -85, -86, 102, 89,
724 -86, -86, 33, -16, -86, 153, 186, 38, 170, -39,
728 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
729 positive, shift that token. If negative, reduce the rule which
730 number is the opposite. If YYTABLE_NINF, syntax error. */
731 #define YYTABLE_NINF -1
732 static const yytype_uint8 yytable[] =
734 31, 40, 41, 128, 38, 105, 38, 38, 42, 43,
735 128, 45, 80, 26, 31, 15, 27, 129, 31, 16,
736 26, 105, 26, 103, 129, 27, 104, 26, 130, 131,
737 27, 132, 128, 68, 139, 130, 131, 31, 132, 82,
738 83, 151, 80, 74, 38, 38, 129, 128, 38, 123,
739 28, 73, 110, 77, 77, 28, 17, 130, 131, 111,
740 132, 129, 128, 152, 49, 49, 112, 53, 113, 128,
741 50, 50, 114, 131, 67, 132, 129, 26, 18, 97,
742 27, 115, 97, 129, 68, 67, 53, 130, 131, 120,
743 132, 26, 79, 100, 27, 68, 26, 132, 23, 103,
744 93, 148, 104, 19, 119, 57, 128, 39, 20, 68,
745 58, 96, 67, 24, 74, 149, 1, 2, 21, 74,
746 129, 3, 68, 4, 5, 22, 49, 25, 32, 46,
747 6, 7, 50, 8, 9, 47, 153, 10, 11, 1,
748 2, 44, 89, 90, 3, 91, 4, 5, 127, 94,
749 61, 54, 94, 6, 7, 58, 8, 9, 55, 138,
750 10, 140, 141, 142, 143, 144, 145, 34, 85, 62,
751 26, 101, 35, 27, 58, 102, 58, 56, 86, 60,
752 58, 63, 64, 65, 66, 117, 87, 88, 92, 95,
753 136, 98, 99, 118, 121, 122, 125, 91, 126, 157,
754 147, 134, 133, 146, 154, 33, 155, 156, 124, 158,
755 135, 48, 84, 0, 0, 72, 0, 0, 0, 0,
756 0, 0, 0, 0, 81, 0, 78
759 #define yypact_value_is_default(Yystate) \
760 (!!((Yystate) == (-86)))
762 #define yytable_value_is_error(Yytable_value) \
765 static const yytype_int16 yycheck[] =
767 11, 17, 18, 3, 15, 90, 17, 18, 19, 20,
768 3, 22, 51, 8, 25, 33, 11, 17, 29, 33,
769 8, 106, 8, 11, 17, 11, 14, 8, 28, 29,
770 11, 31, 3, 21, 34, 28, 29, 48, 31, 55,
771 56, 34, 81, 31, 55, 56, 17, 3, 59, 37,
772 36, 37, 4, 49, 50, 36, 33, 28, 29, 11,
773 31, 17, 3, 34, 9, 9, 18, 29, 20, 3,
774 15, 15, 24, 29, 11, 31, 17, 8, 33, 75,
775 11, 33, 78, 17, 21, 11, 48, 28, 29, 100,
776 31, 8, 37, 37, 11, 21, 8, 31, 1, 11,
777 37, 11, 14, 33, 35, 34, 3, 11, 33, 21,
778 39, 37, 11, 16, 31, 25, 5, 6, 33, 31,
779 17, 10, 21, 12, 13, 33, 9, 36, 0, 36,
780 19, 20, 15, 22, 23, 36, 147, 26, 27, 5,
781 6, 18, 35, 36, 10, 38, 12, 13, 115, 69,
782 34, 36, 72, 19, 20, 39, 22, 23, 33, 126,
783 26, 128, 129, 130, 131, 132, 133, 5, 35, 34,
784 8, 34, 10, 11, 39, 34, 39, 33, 35, 34,
785 39, 34, 34, 34, 34, 11, 35, 35, 33, 35,
786 7, 35, 35, 35, 33, 35, 33, 38, 33, 11,
787 33, 35, 38, 34, 33, 13, 34, 34, 106, 34,
788 121, 25, 59, -1, -1, 47, -1, -1, -1, -1,
789 -1, -1, -1, -1, 54, -1, 50
792 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
793 symbol of state STATE-NUM. */
794 static const yytype_uint8 yystos[] =
796 0, 5, 6, 10, 12, 13, 19, 20, 22, 23,
797 26, 27, 41, 42, 43, 33, 33, 33, 33, 33,
798 33, 33, 33, 1, 16, 36, 8, 11, 36, 56,
799 57, 61, 0, 43, 5, 10, 53, 55, 61, 11,
800 53, 53, 61, 61, 18, 61, 36, 36, 56, 9,
801 15, 58, 59, 57, 36, 33, 33, 34, 39, 54,
802 34, 34, 34, 34, 34, 34, 34, 11, 21, 44,
803 45, 46, 44, 37, 31, 60, 61, 62, 60, 37,
804 59, 58, 53, 53, 55, 35, 35, 35, 35, 35,
805 36, 38, 33, 37, 45, 35, 37, 62, 35, 35,
806 37, 34, 34, 11, 14, 46, 47, 48, 49, 62,
807 4, 11, 18, 20, 24, 33, 52, 11, 35, 35,
808 61, 33, 35, 37, 48, 33, 33, 52, 3, 17,
809 28, 29, 31, 38, 35, 49, 7, 51, 52, 34,
810 52, 52, 52, 52, 52, 52, 34, 33, 11, 25,
811 50, 34, 34, 61, 33, 34, 34, 11, 34
814 #define yyerrok (yyerrstatus = 0)
815 #define yyclearin (yychar = YYEMPTY)
819 #define YYACCEPT goto yyacceptlab
820 #define YYABORT goto yyabortlab
821 #define YYERROR goto yyerrorlab
824 /* Like YYERROR except do call yyerror. This remains here temporarily
825 to ease the transition to the new meaning of YYERROR, for GCC.
826 Once GCC version 2 has supplanted version 1, this can go. However,
827 YYFAIL appears to be in use. Nevertheless, it is formally deprecated
828 in Bison 2.4.2's NEWS entry, where a plan to phase it out is
831 #define YYFAIL goto yyerrlab
833 /* This is here to suppress warnings from the GCC cpp's
834 -Wunused-macros. Normally we don't worry about that warning, but
835 some users do, and we want to make it easy for users to remove
836 YYFAIL uses, which will produce warnings from Bison 2.5. */
839 #define YYRECOVERING() (!!yyerrstatus)
841 #define YYBACKUP(Token, Value) \
843 if (yychar == YYEMPTY) \
847 YYPOPSTACK (yylen); \
853 yyerror (YY_("syntax error: cannot back up")); \
858 /* Error token number */
860 #define YYERRCODE 256
863 /* This macro is provided for backward compatibility. */
864 #ifndef YY_LOCATION_PRINT
865 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
869 /* YYLEX -- calling `yylex' with the right arguments. */
871 # define YYLEX yylex (YYLEX_PARAM)
873 # define YYLEX yylex ()
876 /* Enable debugging if requested. */
880 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
881 # define YYFPRINTF fprintf
884 # define YYDPRINTF(Args) \
890 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
894 YYFPRINTF (stderr, "%s ", Title); \
895 yy_symbol_print (stderr, \
897 YYFPRINTF (stderr, "\n"); \
902 /*--------------------------------.
903 | Print this symbol on YYOUTPUT. |
904 `--------------------------------*/
907 #if (defined __STDC__ || defined __C99__FUNC__ \
908 || defined __cplusplus || defined _MSC_VER)
910 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
913 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
916 YYSTYPE const * const yyvaluep;
919 FILE *yyo = yyoutput;
924 if (yytype < YYNTOKENS)
925 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
937 /*--------------------------------.
938 | Print this symbol on YYOUTPUT. |
939 `--------------------------------*/
941 #if (defined __STDC__ || defined __C99__FUNC__ \
942 || defined __cplusplus || defined _MSC_VER)
944 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
947 yy_symbol_print (yyoutput, yytype, yyvaluep)
950 YYSTYPE const * const yyvaluep;
953 if (yytype < YYNTOKENS)
954 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
956 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
958 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
959 YYFPRINTF (yyoutput, ")");
962 /*------------------------------------------------------------------.
963 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
965 `------------------------------------------------------------------*/
967 #if (defined __STDC__ || defined __C99__FUNC__ \
968 || defined __cplusplus || defined _MSC_VER)
970 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
973 yy_stack_print (yybottom, yytop)
974 yytype_int16 *yybottom;
978 YYFPRINTF (stderr, "Stack now");
979 for (; yybottom <= yytop; yybottom++)
981 int yybot = *yybottom;
982 YYFPRINTF (stderr, " %d", yybot);
984 YYFPRINTF (stderr, "\n");
987 # define YY_STACK_PRINT(Bottom, Top) \
990 yy_stack_print ((Bottom), (Top)); \
994 /*------------------------------------------------.
995 | Report that the YYRULE is going to be reduced. |
996 `------------------------------------------------*/
998 #if (defined __STDC__ || defined __C99__FUNC__ \
999 || defined __cplusplus || defined _MSC_VER)
1001 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
1004 yy_reduce_print (yyvsp, yyrule)
1009 int yynrhs = yyr2[yyrule];
1011 unsigned long int yylno = yyrline[yyrule];
1012 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1014 /* The symbols being reduced. */
1015 for (yyi = 0; yyi < yynrhs; yyi++)
1017 YYFPRINTF (stderr, " $%d = ", yyi + 1);
1018 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1019 &(yyvsp[(yyi + 1) - (yynrhs)])
1021 YYFPRINTF (stderr, "\n");
1025 # define YY_REDUCE_PRINT(Rule) \
1028 yy_reduce_print (yyvsp, Rule); \
1031 /* Nonzero means print parse trace. It is left uninitialized so that
1032 multiple parsers can coexist. */
1034 #else /* !YYDEBUG */
1035 # define YYDPRINTF(Args)
1036 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1037 # define YY_STACK_PRINT(Bottom, Top)
1038 # define YY_REDUCE_PRINT(Rule)
1039 #endif /* !YYDEBUG */
1042 /* YYINITDEPTH -- initial size of the parser's stacks. */
1044 # define YYINITDEPTH 200
1047 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1048 if the built-in stack extension method is used).
1050 Do not make this value too large; the results are undefined if
1051 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1052 evaluated with infinite-precision integer arithmetic. */
1055 # define YYMAXDEPTH 10000
1062 # if defined __GLIBC__ && defined _STRING_H
1063 # define yystrlen strlen
1065 /* Return the length of YYSTR. */
1066 #if (defined __STDC__ || defined __C99__FUNC__ \
1067 || defined __cplusplus || defined _MSC_VER)
1069 yystrlen (const char *yystr)
1077 for (yylen = 0; yystr[yylen]; yylen++)
1085 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1086 # define yystpcpy stpcpy
1088 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1090 #if (defined __STDC__ || defined __C99__FUNC__ \
1091 || defined __cplusplus || defined _MSC_VER)
1093 yystpcpy (char *yydest, const char *yysrc)
1096 yystpcpy (yydest, yysrc)
1102 const char *yys = yysrc;
1104 while ((*yyd++ = *yys++) != '\0')
1113 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1114 quotes and backslashes, so that it's suitable for yyerror. The
1115 heuristic is that double-quoting is unnecessary unless the string
1116 contains an apostrophe, a comma, or backslash (other than
1117 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1118 null, do not copy; instead, return the length of what the result
1121 yytnamerr (char *yyres, const char *yystr)
1126 char const *yyp = yystr;
1133 goto do_not_strip_quotes;
1137 goto do_not_strip_quotes;
1150 do_not_strip_quotes: ;
1154 return yystrlen (yystr);
1156 return yystpcpy (yyres, yystr) - yyres;
1160 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1161 about the unexpected token YYTOKEN for the state stack whose top is
1164 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1165 not large enough to hold the message. In that case, also set
1166 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1167 required number of bytes is too large to store. */
1169 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1170 yytype_int16 *yyssp, int yytoken)
1172 YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
1173 YYSIZE_T yysize = yysize0;
1174 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1175 /* Internationalized format string. */
1176 const char *yyformat = YY_NULL;
1177 /* Arguments of yyformat. */
1178 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1179 /* Number of reported tokens (one for the "unexpected", one per
1183 /* There are many possibilities here to consider:
1184 - Assume YYFAIL is not used. It's too flawed to consider. See
1185 <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
1186 for details. YYERROR is fine as it does not invoke this
1188 - If this state is a consistent state with a default action, then
1189 the only way this function was invoked is if the default action
1190 is an error action. In that case, don't check for expected
1191 tokens because there are none.
1192 - The only way there can be no lookahead present (in yychar) is if
1193 this state is a consistent state with a default action. Thus,
1194 detecting the absence of a lookahead is sufficient to determine
1195 that there is no unexpected or expected token to report. In that
1196 case, just report a simple "syntax error".
1197 - Don't assume there isn't a lookahead just because this state is a
1198 consistent state with a default action. There might have been a
1199 previous inconsistent state, consistent state with a non-default
1200 action, or user semantic action that manipulated yychar.
1201 - Of course, the expected token list depends on states to have
1202 correct lookahead information, and it depends on the parser not
1203 to perform extra reductions after fetching a lookahead from the
1204 scanner and before detecting a syntax error. Thus, state merging
1205 (from LALR or IELR) and default reductions corrupt the expected
1206 token list. However, the list is correct for canonical LR with
1207 one exception: it will still contain any token that will not be
1208 accepted due to an error action in a later state.
1210 if (yytoken != YYEMPTY)
1212 int yyn = yypact[*yyssp];
1213 yyarg[yycount++] = yytname[yytoken];
1214 if (!yypact_value_is_default (yyn))
1216 /* Start YYX at -YYN if negative to avoid negative indexes in
1217 YYCHECK. In other words, skip the first -YYN actions for
1218 this state because they are default actions. */
1219 int yyxbegin = yyn < 0 ? -yyn : 0;
1220 /* Stay within bounds of both yycheck and yytname. */
1221 int yychecklim = YYLAST - yyn + 1;
1222 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1225 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1226 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1227 && !yytable_value_is_error (yytable[yyx + yyn]))
1229 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1235 yyarg[yycount++] = yytname[yyx];
1237 YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
1238 if (! (yysize <= yysize1
1239 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1249 # define YYCASE_(N, S) \
1253 YYCASE_(0, YY_("syntax error"));
1254 YYCASE_(1, YY_("syntax error, unexpected %s"));
1255 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1256 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1257 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1258 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1263 YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
1264 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1269 if (*yymsg_alloc < yysize)
1271 *yymsg_alloc = 2 * yysize;
1272 if (! (yysize <= *yymsg_alloc
1273 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1274 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1278 /* Avoid sprintf, as that infringes on the user's name space.
1279 Don't have undefined behavior even if the translation
1280 produced a string with the wrong number of "%s"s. */
1284 while ((*yyp = *yyformat) != '\0')
1285 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1287 yyp += yytnamerr (yyp, yyarg[yyi++]);
1298 #endif /* YYERROR_VERBOSE */
1300 /*-----------------------------------------------.
1301 | Release the memory associated to this symbol. |
1302 `-----------------------------------------------*/
1305 #if (defined __STDC__ || defined __C99__FUNC__ \
1306 || defined __cplusplus || defined _MSC_VER)
1308 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1311 yydestruct (yymsg, yytype, yyvaluep)
1321 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1334 /* The lookahead symbol. */
1338 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1339 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1340 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
1342 #ifndef YY_INITIAL_VALUE
1343 # define YY_INITIAL_VALUE(Value) /* Nothing. */
1346 /* The semantic value of the lookahead symbol. */
1347 YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
1349 /* Number of syntax errors so far. */
1357 #ifdef YYPARSE_PARAM
1358 #if (defined __STDC__ || defined __C99__FUNC__ \
1359 || defined __cplusplus || defined _MSC_VER)
1361 yyparse (void *YYPARSE_PARAM)
1364 yyparse (YYPARSE_PARAM)
1365 void *YYPARSE_PARAM;
1367 #else /* ! YYPARSE_PARAM */
1368 #if (defined __STDC__ || defined __C99__FUNC__ \
1369 || defined __cplusplus || defined _MSC_VER)
1380 /* Number of tokens to shift before error messages enabled. */
1383 /* The stacks and their tools:
1384 `yyss': related to states.
1385 `yyvs': related to semantic values.
1387 Refer to the stacks through separate pointers, to allow yyoverflow
1388 to reallocate them elsewhere. */
1390 /* The state stack. */
1391 yytype_int16 yyssa[YYINITDEPTH];
1393 yytype_int16 *yyssp;
1395 /* The semantic value stack. */
1396 YYSTYPE yyvsa[YYINITDEPTH];
1400 YYSIZE_T yystacksize;
1404 /* Lookahead token as an internal (translated) token number. */
1406 /* The variables used to return semantic value and location from the
1411 /* Buffer for error messages, and its allocated size. */
1413 char *yymsg = yymsgbuf;
1414 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1417 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1419 /* The number of symbols on the RHS of the reduced rule.
1420 Keep to zero when no symbol should be popped. */
1423 yyssp = yyss = yyssa;
1424 yyvsp = yyvs = yyvsa;
1425 yystacksize = YYINITDEPTH;
1427 YYDPRINTF ((stderr, "Starting parse\n"));
1432 yychar = YYEMPTY; /* Cause a token to be read. */
1435 /*------------------------------------------------------------.
1436 | yynewstate -- Push a new state, which is found in yystate. |
1437 `------------------------------------------------------------*/
1439 /* In all cases, when you get here, the value and location stacks
1440 have just been pushed. So pushing a state here evens the stacks. */
1446 if (yyss + yystacksize - 1 <= yyssp)
1448 /* Get the current used size of the three stacks, in elements. */
1449 YYSIZE_T yysize = yyssp - yyss + 1;
1453 /* Give user a chance to reallocate the stack. Use copies of
1454 these so that the &'s don't force the real ones into
1456 YYSTYPE *yyvs1 = yyvs;
1457 yytype_int16 *yyss1 = yyss;
1459 /* Each stack pointer address is followed by the size of the
1460 data in use in that stack, in bytes. This used to be a
1461 conditional around just the two extra args, but that might
1462 be undefined if yyoverflow is a macro. */
1463 yyoverflow (YY_("memory exhausted"),
1464 &yyss1, yysize * sizeof (*yyssp),
1465 &yyvs1, yysize * sizeof (*yyvsp),
1471 #else /* no yyoverflow */
1472 # ifndef YYSTACK_RELOCATE
1473 goto yyexhaustedlab;
1475 /* Extend the stack our own way. */
1476 if (YYMAXDEPTH <= yystacksize)
1477 goto yyexhaustedlab;
1479 if (YYMAXDEPTH < yystacksize)
1480 yystacksize = YYMAXDEPTH;
1483 yytype_int16 *yyss1 = yyss;
1484 union yyalloc *yyptr =
1485 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1487 goto yyexhaustedlab;
1488 YYSTACK_RELOCATE (yyss_alloc, yyss);
1489 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1490 # undef YYSTACK_RELOCATE
1492 YYSTACK_FREE (yyss1);
1495 #endif /* no yyoverflow */
1497 yyssp = yyss + yysize - 1;
1498 yyvsp = yyvs + yysize - 1;
1500 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1501 (unsigned long int) yystacksize));
1503 if (yyss + yystacksize - 1 <= yyssp)
1507 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1509 if (yystate == YYFINAL)
1519 /* Do appropriate processing given the current state. Read a
1520 lookahead token if we need one and don't already have one. */
1522 /* First try to decide what to do without reference to lookahead token. */
1523 yyn = yypact[yystate];
1524 if (yypact_value_is_default (yyn))
1527 /* Not known => get a lookahead token if don't already have one. */
1529 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1530 if (yychar == YYEMPTY)
1532 YYDPRINTF ((stderr, "Reading a token: "));
1536 if (yychar <= YYEOF)
1538 yychar = yytoken = YYEOF;
1539 YYDPRINTF ((stderr, "Now at end of input.\n"));
1543 yytoken = YYTRANSLATE (yychar);
1544 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1547 /* If the proper action on seeing token YYTOKEN is to reduce or to
1548 detect an error, take that action. */
1550 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1555 if (yytable_value_is_error (yyn))
1561 /* Count tokens shifted since error; after three, turn off error
1566 /* Shift the lookahead token. */
1567 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1569 /* Discard the shifted token. */
1573 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1575 YY_IGNORE_MAYBE_UNINITIALIZED_END
1580 /*-----------------------------------------------------------.
1581 | yydefault -- do the default action for the current state. |
1582 `-----------------------------------------------------------*/
1584 yyn = yydefact[yystate];
1590 /*-----------------------------.
1591 | yyreduce -- Do a reduction. |
1592 `-----------------------------*/
1594 /* yyn is the number of a rule to reduce with. */
1597 /* If YYLEN is nonzero, implement the default value of the action:
1600 Otherwise, the following line sets YYVAL to garbage.
1601 This behavior is undocumented and Bison
1602 users should not rely upon it. Assigning to YYVAL
1603 unconditionally makes the parser a bit smaller, and it avoids a
1604 GCC warning that YYVAL may be used uninitialized. */
1605 yyval = yyvsp[1-yylen];
1608 YY_REDUCE_PRINT (yyn);
1612 /* Line 1792 of yacc.c */
1613 #line 137 "ldscript.y"
1614 { add_versions ((yyvsp[(2) - (2)].version)); }
1618 /* Line 1792 of yacc.c */
1619 #line 145 "ldscript.y"
1621 if (likely (ld_state.entry == NULL))
1622 ld_state.entry = (yyvsp[(3) - (5)].str);
1627 /* Line 1792 of yacc.c */
1628 #line 150 "ldscript.y"
1630 ld_new_searchdir ((yyvsp[(3) - (5)].str));
1635 /* Line 1792 of yacc.c */
1636 #line 154 "ldscript.y"
1638 if (likely (ld_state.pagesize == 0))
1639 ld_state.pagesize = (yyvsp[(3) - (5)].num);
1644 /* Line 1792 of yacc.c */
1645 #line 159 "ldscript.y"
1647 if (likely (ld_state.interp == NULL)
1648 && ld_state.file_type != dso_file_type)
1649 ld_state.interp = (yyvsp[(3) - (5)].str);
1654 /* Line 1792 of yacc.c */
1655 #line 165 "ldscript.y"
1657 new_segment ((yyvsp[(2) - (5)].num), (yyvsp[(4) - (5)].output_rule));
1662 /* Line 1792 of yacc.c */
1663 #line 169 "ldscript.y"
1665 fputs_unlocked (gettext ("mode for segment invalid\n"),
1667 new_segment (0, (yyvsp[(4) - (5)].output_rule));
1672 /* Line 1792 of yacc.c */
1673 #line 175 "ldscript.y"
1675 /* First little optimization. If there is only one
1676 file in the group don't do anything. */
1677 if ((yyvsp[(3) - (4)].filename_list) != (yyvsp[(3) - (4)].filename_list)->next)
1679 (yyvsp[(3) - (4)].filename_list)->next->group_start = 1;
1680 (yyvsp[(3) - (4)].filename_list)->group_end = 1;
1682 add_inputfiles ((yyvsp[(3) - (4)].filename_list));
1687 /* Line 1792 of yacc.c */
1688 #line 186 "ldscript.y"
1689 { add_inputfiles ((yyvsp[(3) - (4)].filename_list)); }
1693 /* Line 1792 of yacc.c */
1694 #line 188 "ldscript.y"
1695 { add_inputfiles (mark_as_needed ((yyvsp[(3) - (4)].filename_list))); }
1699 /* Line 1792 of yacc.c */
1700 #line 190 "ldscript.y"
1701 { add_versions ((yyvsp[(3) - (4)].version)); }
1705 /* Line 1792 of yacc.c */
1706 #line 192 "ldscript.y"
1711 /* Line 1792 of yacc.c */
1712 #line 196 "ldscript.y"
1714 (yyvsp[(2) - (2)].output_rule)->next = (yyvsp[(1) - (2)].output_rule)->next;
1715 (yyval.output_rule) = (yyvsp[(1) - (2)].output_rule)->next = (yyvsp[(2) - (2)].output_rule);
1720 /* Line 1792 of yacc.c */
1721 #line 201 "ldscript.y"
1722 { (yyval.output_rule) = (yyvsp[(1) - (1)].output_rule); }
1726 /* Line 1792 of yacc.c */
1727 #line 205 "ldscript.y"
1729 (yyval.output_rule) = new_output_rule (output_assignment);
1730 (yyval.output_rule)->val.assignment = (yyvsp[(1) - (2)].assignment);
1735 /* Line 1792 of yacc.c */
1736 #line 210 "ldscript.y"
1738 (yyval.output_rule) = new_output_rule (output_section);
1739 (yyval.output_rule)->val.section.name = (yyvsp[(1) - (4)].str);
1740 (yyval.output_rule)->val.section.input = (yyvsp[(3) - (4)].input_rule)->next;
1741 if (ld_state.strip == strip_debug
1742 && ebl_debugscn_p (ld_state.ebl, (yyvsp[(1) - (4)].str)))
1743 (yyval.output_rule)->val.section.ignored = true;
1745 (yyval.output_rule)->val.section.ignored = false;
1746 (yyvsp[(3) - (4)].input_rule)->next = NULL;
1751 /* Line 1792 of yacc.c */
1752 #line 222 "ldscript.y"
1754 /* This is a short cut for "ID { *(ID) }". */
1755 (yyval.output_rule) = new_output_rule (output_section);
1756 (yyval.output_rule)->val.section.name = (yyvsp[(1) - (2)].str);
1757 (yyval.output_rule)->val.section.input = new_input_rule (input_section);
1758 (yyval.output_rule)->val.section.input->next = NULL;
1759 (yyval.output_rule)->val.section.input->val.section =
1760 (struct filemask_section_name *)
1761 obstack_alloc (&ld_state.smem,
1762 sizeof (struct filemask_section_name));
1763 (yyval.output_rule)->val.section.input->val.section->filemask = NULL;
1764 (yyval.output_rule)->val.section.input->val.section->excludemask = NULL;
1765 (yyval.output_rule)->val.section.input->val.section->section_name =
1766 new_input_section_name ((yyvsp[(1) - (2)].str), false);
1767 (yyval.output_rule)->val.section.input->val.section->keep_flag = false;
1768 if (ld_state.strip == strip_debug
1769 && ebl_debugscn_p (ld_state.ebl, (yyvsp[(1) - (2)].str)))
1770 (yyval.output_rule)->val.section.ignored = true;
1772 (yyval.output_rule)->val.section.ignored = false;
1777 /* Line 1792 of yacc.c */
1778 #line 246 "ldscript.y"
1779 { (yyval.assignment) = new_assignment ((yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].expr), false); }
1783 /* Line 1792 of yacc.c */
1784 #line 248 "ldscript.y"
1785 { (yyval.assignment) = new_assignment ((yyvsp[(3) - (6)].str), (yyvsp[(5) - (6)].expr), true); }
1789 /* Line 1792 of yacc.c */
1790 #line 252 "ldscript.y"
1792 (yyvsp[(2) - (2)].input_rule)->next = (yyvsp[(1) - (2)].input_rule)->next;
1793 (yyval.input_rule) = (yyvsp[(1) - (2)].input_rule)->next = (yyvsp[(2) - (2)].input_rule);
1798 /* Line 1792 of yacc.c */
1799 #line 257 "ldscript.y"
1800 { (yyval.input_rule) = (yyvsp[(1) - (1)].input_rule); }
1804 /* Line 1792 of yacc.c */
1805 #line 261 "ldscript.y"
1807 (yyval.input_rule) = new_input_rule (input_section);
1808 (yyval.input_rule)->val.section = (yyvsp[(1) - (1)].filemask_section_name);
1813 /* Line 1792 of yacc.c */
1814 #line 266 "ldscript.y"
1816 (yyvsp[(3) - (4)].filemask_section_name)->keep_flag = true;
1818 (yyval.input_rule) = new_input_rule (input_section);
1819 (yyval.input_rule)->val.section = (yyvsp[(3) - (4)].filemask_section_name);
1824 /* Line 1792 of yacc.c */
1825 #line 273 "ldscript.y"
1827 (yyval.input_rule) = new_input_rule (input_assignment);
1828 (yyval.input_rule)->val.assignment = (yyvsp[(1) - (2)].assignment);
1833 /* Line 1792 of yacc.c */
1834 #line 280 "ldscript.y"
1836 (yyval.filemask_section_name) = (struct filemask_section_name *)
1837 obstack_alloc (&ld_state.smem, sizeof (*(yyval.filemask_section_name)));
1838 (yyval.filemask_section_name)->filemask = (yyvsp[(1) - (5)].str);
1839 (yyval.filemask_section_name)->excludemask = (yyvsp[(3) - (5)].str);
1840 (yyval.filemask_section_name)->section_name = (yyvsp[(4) - (5)].sectionname);
1841 (yyval.filemask_section_name)->keep_flag = false;
1846 /* Line 1792 of yacc.c */
1847 #line 291 "ldscript.y"
1848 { (yyval.sectionname) = new_input_section_name ((yyvsp[(1) - (1)].str), false); }
1852 /* Line 1792 of yacc.c */
1853 #line 293 "ldscript.y"
1854 { (yyval.sectionname) = new_input_section_name ((yyvsp[(3) - (4)].str), true); }
1858 /* Line 1792 of yacc.c */
1859 #line 297 "ldscript.y"
1860 { (yyval.str) = (yyvsp[(3) - (4)].str); }
1864 /* Line 1792 of yacc.c */
1865 #line 299 "ldscript.y"
1866 { (yyval.str) = NULL; }
1870 /* Line 1792 of yacc.c */
1871 #line 303 "ldscript.y"
1873 (yyval.expr) = new_expr (exp_align);
1874 (yyval.expr)->val.child = (yyvsp[(3) - (4)].expr);
1879 /* Line 1792 of yacc.c */
1880 #line 308 "ldscript.y"
1881 { (yyval.expr) = (yyvsp[(2) - (3)].expr); }
1885 /* Line 1792 of yacc.c */
1886 #line 310 "ldscript.y"
1888 (yyval.expr) = new_expr (exp_mult);
1889 (yyval.expr)->val.binary.left = (yyvsp[(1) - (3)].expr);
1890 (yyval.expr)->val.binary.right = (yyvsp[(3) - (3)].expr);
1895 /* Line 1792 of yacc.c */
1896 #line 316 "ldscript.y"
1898 (yyval.expr) = new_expr ((yyvsp[(2) - (3)].op));
1899 (yyval.expr)->val.binary.left = (yyvsp[(1) - (3)].expr);
1900 (yyval.expr)->val.binary.right = (yyvsp[(3) - (3)].expr);
1905 /* Line 1792 of yacc.c */
1906 #line 322 "ldscript.y"
1908 (yyval.expr) = new_expr ((yyvsp[(2) - (3)].op));
1909 (yyval.expr)->val.binary.left = (yyvsp[(1) - (3)].expr);
1910 (yyval.expr)->val.binary.right = (yyvsp[(3) - (3)].expr);
1915 /* Line 1792 of yacc.c */
1916 #line 328 "ldscript.y"
1918 (yyval.expr) = new_expr (exp_and);
1919 (yyval.expr)->val.binary.left = (yyvsp[(1) - (3)].expr);
1920 (yyval.expr)->val.binary.right = (yyvsp[(3) - (3)].expr);
1925 /* Line 1792 of yacc.c */
1926 #line 334 "ldscript.y"
1928 (yyval.expr) = new_expr (exp_or);
1929 (yyval.expr)->val.binary.left = (yyvsp[(1) - (3)].expr);
1930 (yyval.expr)->val.binary.right = (yyvsp[(3) - (3)].expr);
1935 /* Line 1792 of yacc.c */
1936 #line 340 "ldscript.y"
1938 (yyval.expr) = new_expr (exp_num);
1939 (yyval.expr)->val.num = (yyvsp[(1) - (1)].num);
1944 /* Line 1792 of yacc.c */
1945 #line 345 "ldscript.y"
1947 (yyval.expr) = new_expr (exp_id);
1948 (yyval.expr)->val.str = (yyvsp[(1) - (1)].str);
1953 /* Line 1792 of yacc.c */
1954 #line 350 "ldscript.y"
1955 { (yyval.expr) = new_expr (exp_sizeof_headers); }
1959 /* Line 1792 of yacc.c */
1960 #line 352 "ldscript.y"
1961 { (yyval.expr) = new_expr (exp_pagesize); }
1965 /* Line 1792 of yacc.c */
1966 #line 356 "ldscript.y"
1968 (yyvsp[(3) - (3)].filename_list)->next = (yyvsp[(1) - (3)].filename_list)->next;
1969 (yyval.filename_list) = (yyvsp[(1) - (3)].filename_list)->next = (yyvsp[(3) - (3)].filename_list);
1974 /* Line 1792 of yacc.c */
1975 #line 361 "ldscript.y"
1976 { (yyval.filename_list) = (yyvsp[(1) - (1)].filename_list); }
1980 /* Line 1792 of yacc.c */
1981 #line 369 "ldscript.y"
1983 /* First little optimization. If there is only one
1984 file in the group don't do anything. */
1985 if ((yyvsp[(3) - (4)].filename_list) != (yyvsp[(3) - (4)].filename_list)->next)
1987 (yyvsp[(3) - (4)].filename_list)->next->group_start = 1;
1988 (yyvsp[(3) - (4)].filename_list)->group_end = 1;
1990 (yyval.filename_list) = (yyvsp[(3) - (4)].filename_list);
1995 /* Line 1792 of yacc.c */
1996 #line 380 "ldscript.y"
1997 { (yyval.filename_list) = mark_as_needed ((yyvsp[(3) - (4)].filename_list)); }
2001 /* Line 1792 of yacc.c */
2002 #line 382 "ldscript.y"
2003 { (yyval.filename_list) = new_filename_listelem ((yyvsp[(1) - (1)].str)); }
2007 /* Line 1792 of yacc.c */
2008 #line 387 "ldscript.y"
2010 (yyvsp[(2) - (2)].version)->next = (yyvsp[(1) - (2)].version)->next;
2011 (yyval.version) = (yyvsp[(1) - (2)].version)->next = (yyvsp[(2) - (2)].version);
2016 /* Line 1792 of yacc.c */
2017 #line 392 "ldscript.y"
2018 { (yyval.version) = (yyvsp[(1) - (1)].version); }
2022 /* Line 1792 of yacc.c */
2023 #line 396 "ldscript.y"
2025 (yyvsp[(2) - (4)].version)->versionname = "";
2026 (yyvsp[(2) - (4)].version)->parentname = NULL;
2027 (yyval.version) = (yyvsp[(2) - (4)].version);
2032 /* Line 1792 of yacc.c */
2033 #line 402 "ldscript.y"
2035 (yyvsp[(3) - (5)].version)->versionname = (yyvsp[(1) - (5)].str);
2036 (yyvsp[(3) - (5)].version)->parentname = NULL;
2037 (yyval.version) = (yyvsp[(3) - (5)].version);
2042 /* Line 1792 of yacc.c */
2043 #line 408 "ldscript.y"
2045 (yyvsp[(3) - (6)].version)->versionname = (yyvsp[(1) - (6)].str);
2046 (yyvsp[(3) - (6)].version)->parentname = (yyvsp[(5) - (6)].str);
2047 (yyval.version) = (yyvsp[(3) - (6)].version);
2052 /* Line 1792 of yacc.c */
2053 #line 417 "ldscript.y"
2054 { (yyval.version) = merge_versions ((yyvsp[(1) - (2)].version), (yyvsp[(2) - (2)].version)); }
2058 /* Line 1792 of yacc.c */
2059 #line 419 "ldscript.y"
2060 { (yyval.version) = (yyvsp[(1) - (1)].version); }
2064 /* Line 1792 of yacc.c */
2065 #line 423 "ldscript.y"
2066 { (yyval.version) = new_version (NULL, (yyvsp[(2) - (2)].id_list)); }
2070 /* Line 1792 of yacc.c */
2071 #line 425 "ldscript.y"
2072 { (yyval.version) = new_version ((yyvsp[(2) - (2)].id_list), NULL); }
2076 /* Line 1792 of yacc.c */
2077 #line 430 "ldscript.y"
2079 struct id_list *newp = new_id_listelem ((yyvsp[(2) - (3)].str));
2080 newp->next = (yyvsp[(1) - (3)].id_list)->next;
2081 (yyval.id_list) = (yyvsp[(1) - (3)].id_list)->next = newp;
2086 /* Line 1792 of yacc.c */
2087 #line 436 "ldscript.y"
2088 { (yyval.id_list) = new_id_listelem ((yyvsp[(1) - (2)].str)); }
2092 /* Line 1792 of yacc.c */
2093 #line 440 "ldscript.y"
2094 { (yyval.str) = (yyvsp[(1) - (1)].str); }
2098 /* Line 1792 of yacc.c */
2099 #line 442 "ldscript.y"
2100 { (yyval.str) = (yyvsp[(1) - (1)].str); }
2104 /* Line 1792 of yacc.c */
2105 #line 446 "ldscript.y"
2106 { (yyval.str) = (yyvsp[(1) - (1)].str); }
2110 /* Line 1792 of yacc.c */
2111 #line 448 "ldscript.y"
2112 { (yyval.str) = NULL; }
2116 /* Line 1792 of yacc.c */
2117 #line 2118 "ldscript.c"
2120 /* User semantic actions sometimes alter yychar, and that requires
2121 that yytoken be updated with the new translation. We take the
2122 approach of translating immediately before every use of yytoken.
2123 One alternative is translating here after every semantic action,
2124 but that translation would be missed if the semantic action invokes
2125 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2126 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2127 incorrect destructor might then be invoked immediately. In the
2128 case of YYERROR or YYBACKUP, subsequent parser actions might lead
2129 to an incorrect destructor call or verbose syntax error message
2130 before the lookahead is translated. */
2131 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2135 YY_STACK_PRINT (yyss, yyssp);
2139 /* Now `shift' the result of the reduction. Determine what state
2140 that goes to, based on the state we popped back to and the rule
2141 number reduced by. */
2145 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2146 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2147 yystate = yytable[yystate];
2149 yystate = yydefgoto[yyn - YYNTOKENS];
2154 /*------------------------------------.
2155 | yyerrlab -- here on detecting error |
2156 `------------------------------------*/
2158 /* Make sure we have latest lookahead translation. See comments at
2159 user semantic actions for why this is necessary. */
2160 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
2162 /* If not already recovering from an error, report this error. */
2166 #if ! YYERROR_VERBOSE
2167 yyerror (YY_("syntax error"));
2169 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2172 char const *yymsgp = YY_("syntax error");
2173 int yysyntax_error_status;
2174 yysyntax_error_status = YYSYNTAX_ERROR;
2175 if (yysyntax_error_status == 0)
2177 else if (yysyntax_error_status == 1)
2179 if (yymsg != yymsgbuf)
2180 YYSTACK_FREE (yymsg);
2181 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
2185 yymsg_alloc = sizeof yymsgbuf;
2186 yysyntax_error_status = 2;
2190 yysyntax_error_status = YYSYNTAX_ERROR;
2195 if (yysyntax_error_status == 2)
2196 goto yyexhaustedlab;
2198 # undef YYSYNTAX_ERROR
2204 if (yyerrstatus == 3)
2206 /* If just tried and failed to reuse lookahead token after an
2207 error, discard it. */
2209 if (yychar <= YYEOF)
2211 /* Return failure if at end of input. */
2212 if (yychar == YYEOF)
2217 yydestruct ("Error: discarding",
2223 /* Else will try to reuse lookahead token after shifting the error
2228 /*---------------------------------------------------.
2229 | yyerrorlab -- error raised explicitly by YYERROR. |
2230 `---------------------------------------------------*/
2233 /* Pacify compilers like GCC when the user code never invokes
2234 YYERROR and the label yyerrorlab therefore never appears in user
2236 if (/*CONSTCOND*/ 0)
2239 /* Do not reclaim the symbols of the rule which action triggered
2243 YY_STACK_PRINT (yyss, yyssp);
2248 /*-------------------------------------------------------------.
2249 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2250 `-------------------------------------------------------------*/
2252 yyerrstatus = 3; /* Each real token shifted decrements this. */
2256 yyn = yypact[yystate];
2257 if (!yypact_value_is_default (yyn))
2260 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2268 /* Pop the current state because it cannot handle the error token. */
2273 yydestruct ("Error: popping",
2274 yystos[yystate], yyvsp);
2277 YY_STACK_PRINT (yyss, yyssp);
2280 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2282 YY_IGNORE_MAYBE_UNINITIALIZED_END
2285 /* Shift the error token. */
2286 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2292 /*-------------------------------------.
2293 | yyacceptlab -- YYACCEPT comes here. |
2294 `-------------------------------------*/
2299 /*-----------------------------------.
2300 | yyabortlab -- YYABORT comes here. |
2301 `-----------------------------------*/
2306 #if !defined yyoverflow || YYERROR_VERBOSE
2307 /*-------------------------------------------------.
2308 | yyexhaustedlab -- memory exhaustion comes here. |
2309 `-------------------------------------------------*/
2311 yyerror (YY_("memory exhausted"));
2317 if (yychar != YYEMPTY)
2319 /* Make sure we have latest lookahead translation. See comments at
2320 user semantic actions for why this is necessary. */
2321 yytoken = YYTRANSLATE (yychar);
2322 yydestruct ("Cleanup: discarding lookahead",
2325 /* Do not reclaim the symbols of the rule which action triggered
2326 this YYABORT or YYACCEPT. */
2328 YY_STACK_PRINT (yyss, yyssp);
2329 while (yyssp != yyss)
2331 yydestruct ("Cleanup: popping",
2332 yystos[*yyssp], yyvsp);
2337 YYSTACK_FREE (yyss);
2340 if (yymsg != yymsgbuf)
2341 YYSTACK_FREE (yymsg);
2343 /* Make sure YYID is used. */
2344 return YYID (yyresult);
2348 /* Line 2055 of yacc.c */
2349 #line 451 "ldscript.y"
2353 yyerror (const char *s)
2355 error (0, 0, (ld_scan_version_script
2356 ? gettext ("while reading version script '%s': %s at line %d")
2357 : gettext ("while reading linker script '%s': %s at line %d")),
2358 ldin_fname, gettext (s), ldlineno);
2362 static struct expression *
2365 struct expression *newp = (struct expression *)
2366 obstack_alloc (&ld_state.smem, sizeof (*newp));
2373 static struct input_section_name *
2374 new_input_section_name (const char *name, bool sort_flag)
2376 struct input_section_name *newp = (struct input_section_name *)
2377 obstack_alloc (&ld_state.smem, sizeof (*newp));
2380 newp->sort_flag = sort_flag;
2385 static struct input_rule *
2386 new_input_rule (int tag)
2388 struct input_rule *newp = (struct input_rule *)
2389 obstack_alloc (&ld_state.smem, sizeof (*newp));
2397 static struct output_rule *
2398 new_output_rule (int tag)
2400 struct output_rule *newp = (struct output_rule *)
2401 memset (obstack_alloc (&ld_state.smem, sizeof (*newp)),
2402 '\0', sizeof (*newp));
2410 static struct assignment *
2411 new_assignment (const char *variable, struct expression *expression,
2414 struct assignment *newp = (struct assignment *)
2415 obstack_alloc (&ld_state.smem, sizeof (*newp));
2417 newp->variable = variable;
2418 newp->expression = expression;
2420 newp->provide_flag = provide_flag;
2422 /* Insert the symbol into a hash table. We will later have to matc*/
2428 new_segment (int mode, struct output_rule *output_rule)
2430 struct output_segment *newp;
2433 = (struct output_segment *) obstack_alloc (&ld_state.smem, sizeof (*newp));
2437 newp->output_rules = output_rule->next;
2438 output_rule->next = NULL;
2440 /* Enqueue the output segment description. */
2441 if (ld_state.output_segments == NULL)
2442 ld_state.output_segments = newp;
2445 newp->next = ld_state.output_segments->next;
2446 ld_state.output_segments = ld_state.output_segments->next = newp;
2449 /* If the output file should be stripped of all symbol set the flag
2450 in the structures of all output sections. */
2451 if (mode == 0 && ld_state.strip == strip_all)
2453 struct output_rule *runp;
2455 for (runp = newp->output_rules; runp != NULL; runp = runp->next)
2456 if (runp->tag == output_section)
2457 runp->val.section.ignored = true;
2462 static struct filename_list *
2463 new_filename_listelem (const char *string)
2465 struct filename_list *newp;
2467 /* We use calloc and not the obstack since this object can be freed soon. */
2468 newp = (struct filename_list *) xcalloc (1, sizeof (*newp));
2469 newp->name = string;
2475 static struct filename_list *
2476 mark_as_needed (struct filename_list *listp)
2478 struct filename_list *runp = listp;
2481 runp->as_needed = true;
2484 while (runp != listp);
2491 add_inputfiles (struct filename_list *fnames)
2493 assert (fnames != NULL);
2495 if (ld_state.srcfiles == NULL)
2496 ld_state.srcfiles = fnames;
2499 struct filename_list *first = ld_state.srcfiles->next;
2501 ld_state.srcfiles->next = fnames->next;
2502 fnames->next = first;
2503 ld_state.srcfiles->next = fnames;
2509 special_char_p (const char *str)
2511 while (*str != '\0')
2513 if (__builtin_expect (*str == '*', 0)
2514 || __builtin_expect (*str == '?', 0)
2515 || __builtin_expect (*str == '[', 0))
2525 static struct id_list *
2526 new_id_listelem (const char *str)
2528 struct id_list *newp;
2530 newp = (struct id_list *) obstack_alloc (&ld_state.smem, sizeof (*newp));
2532 newp->u.id_type = id_all;
2533 else if (__builtin_expect (special_char_p (str), false))
2534 newp->u.id_type = id_wild;
2536 newp->u.id_type = id_str;
2544 static struct version *
2545 new_version (struct id_list *local, struct id_list *global)
2547 struct version *newp;
2549 newp = (struct version *) obstack_alloc (&ld_state.smem, sizeof (*newp));
2551 newp->local_names = local;
2552 newp->global_names = global;
2553 newp->versionname = NULL;
2554 newp->parentname = NULL;
2560 static struct version *
2561 merge_versions (struct version *one, struct version *two)
2563 assert (two->local_names == NULL || two->global_names == NULL);
2565 if (two->local_names != NULL)
2567 if (one->local_names == NULL)
2568 one->local_names = two->local_names;
2571 two->local_names->next = one->local_names->next;
2572 one->local_names = one->local_names->next = two->local_names;
2577 if (one->global_names == NULL)
2578 one->global_names = two->global_names;
2581 two->global_names->next = one->global_names->next;
2582 one->global_names = one->global_names->next = two->global_names;
2591 add_id_list (const char *versionname, struct id_list *runp, _Bool local)
2593 struct id_list *lastp = runp;
2596 /* Nothing to do. */
2599 /* Convert into a simple single-linked list. */
2601 assert (runp != NULL);
2605 if (runp->u.id_type == id_str)
2607 struct id_list *curp;
2608 struct id_list *defp;
2609 unsigned long int hval = elf_hash (runp->id);
2614 defp = ld_version_str_tab_find (&ld_state.version_str_tab, hval, curp);
2617 /* There is already a version definition for this symbol. */
2618 while (strcmp (defp->u.s.versionname, versionname) != 0)
2620 if (defp->next == NULL)
2622 /* No version like this so far. */
2624 curp->u.s.local = local;
2625 curp->u.s.versionname = versionname;
2634 if (defp != NULL && defp->u.s.local != local)
2635 error (EXIT_FAILURE, 0, versionname[0] == '\0'
2637 symbol '%s' is declared both local and global for unnamed version")
2639 symbol '%s' is declared both local and global for version '%s'"),
2640 runp->id, versionname);
2644 /* This is the first version definition for this symbol. */
2645 ld_version_str_tab_insert (&ld_state.version_str_tab, hval, curp);
2647 curp->u.s.local = local;
2648 curp->u.s.versionname = versionname;
2652 else if (runp->u.id_type == id_all)
2656 if (ld_state.default_bind_global)
2657 error (EXIT_FAILURE, 0,
2658 gettext ("default visibility set as local and global"));
2659 ld_state.default_bind_local = true;
2663 if (ld_state.default_bind_local)
2664 error (EXIT_FAILURE, 0,
2665 gettext ("default visibility set as local and global"));
2666 ld_state.default_bind_global = true;
2673 assert (runp->u.id_type == id_wild);
2677 while (runp != NULL);
2682 add_versions (struct version *versions)
2684 struct version *lastp = versions;
2686 if (versions == NULL)
2689 /* Convert into a simple single-linked list. */
2690 versions = versions->next;
2691 assert (versions != NULL);
2696 add_id_list (versions->versionname, versions->local_names, true);
2697 add_id_list (versions->versionname, versions->global_names, false);
2699 versions = versions->next;
2701 while (versions != NULL);