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 Red Hat elfutils.
82 Written by Ulrich Drepper <drepper@redhat.com>, 2001.
84 Red Hat elfutils is free software; you can redistribute it and/or modify
85 it under the terms of the GNU General Public License as published by the
86 Free Software Foundation; version 2 of the License.
88 Red Hat elfutils is distributed in the hope that it will be useful, but
89 WITHOUT ANY WARRANTY; without even the implied warranty of
90 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
91 General Public License for more details.
93 You should have received a copy of the GNU General Public License along
94 with Red Hat elfutils; if not, write to the Free Software Foundation,
95 Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
97 Red Hat elfutils is an included package of the Open Invention Network.
98 An included package of the Open Invention Network is a package for which
99 Open Invention Network licensees cross-license their patents. No patent
100 license is granted, either expressly or impliedly, by designation as an
101 included package. Should you wish to participate in the Open Invention
102 Network licensing program, please visit www.openinventionnetwork.com
103 <http://www.openinventionnetwork.com>. */
121 /* The error handler. */
122 static void yyerror (const char *s);
124 /* Some helper functions we need to construct the data structures
125 describing information from the file. */
126 static struct expression *new_expr (int tag);
127 static struct input_section_name *new_input_section_name (const char *name,
129 static struct input_rule *new_input_rule (int tag);
130 static struct output_rule *new_output_rule (int tag);
131 static struct assignment *new_assignment (const char *variable,
132 struct expression *expression,
134 static void new_segment (int mode, struct output_rule *output_rule);
135 static struct filename_list *new_filename_listelem (const char *string);
136 static void add_inputfiles (struct filename_list *fnames);
137 static struct id_list *new_id_listelem (const char *str);
138 static struct filename_list *mark_as_needed (struct filename_list *listp);
139 static struct version *new_version (struct id_list *local,
140 struct id_list *global);
141 static struct version *merge_versions (struct version *one,
142 struct version *two);
143 static void add_versions (struct version *versions);
145 extern int yylex (void);
148 /* Line 268 of yacc.c */
149 #line 150 "ldscript.c"
151 /* Enabling traces. */
156 /* Enabling verbose error messages. */
157 #ifdef YYERROR_VERBOSE
158 # undef YYERROR_VERBOSE
159 # define YYERROR_VERBOSE 1
161 # define YYERROR_VERBOSE 0
164 /* Enabling the token table. */
165 #ifndef YYTOKEN_TABLE
166 # define YYTOKEN_TABLE 0
173 /* Put the tokens into the symbol table, so that GDB and other debuggers
192 kOUTPUT_FORMAT = 274,
197 kSIZEOF_HEADERS = 279,
200 kVERSION_SCRIPT = 282,
208 #define kAS_NEEDED 260
210 #define kEXCLUDE_FILE 262
211 #define kFILENAME 263
222 #define kOUTPUT_FORMAT 274
223 #define kPAGESIZE 275
225 #define kSEARCH_DIR 277
227 #define kSIZEOF_HEADERS 279
230 #define kVERSION_SCRIPT 282
237 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
238 typedef union YYSTYPE
241 /* Line 293 of yacc.c */
242 #line 71 "ldscript.y"
245 enum expression_tag op;
247 struct expression *expr;
248 struct input_section_name *sectionname;
249 struct filemask_section_name *filemask_section_name;
250 struct input_rule *input_rule;
251 struct output_rule *output_rule;
252 struct assignment *assignment;
253 struct filename_list *filename_list;
254 struct version *version;
255 struct id_list *id_list;
259 /* Line 293 of yacc.c */
260 #line 261 "ldscript.c"
262 # define YYSTYPE_IS_TRIVIAL 1
263 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
264 # define YYSTYPE_IS_DECLARED 1
268 /* Copy the second part of user declarations. */
271 /* Line 343 of yacc.c */
272 #line 273 "ldscript.c"
279 typedef YYTYPE_UINT8 yytype_uint8;
281 typedef unsigned char yytype_uint8;
285 typedef YYTYPE_INT8 yytype_int8;
286 #elif (defined __STDC__ || defined __C99__FUNC__ \
287 || defined __cplusplus || defined _MSC_VER)
288 typedef signed char yytype_int8;
290 typedef short int yytype_int8;
294 typedef YYTYPE_UINT16 yytype_uint16;
296 typedef unsigned short int yytype_uint16;
300 typedef YYTYPE_INT16 yytype_int16;
302 typedef short int yytype_int16;
306 # ifdef __SIZE_TYPE__
307 # define YYSIZE_T __SIZE_TYPE__
308 # elif defined size_t
309 # define YYSIZE_T size_t
310 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
311 || defined __cplusplus || defined _MSC_VER)
312 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
313 # define YYSIZE_T size_t
315 # define YYSIZE_T unsigned int
319 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
322 # if defined YYENABLE_NLS && YYENABLE_NLS
324 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
325 # define YY_(msgid) dgettext ("bison-runtime", msgid)
329 # define YY_(msgid) msgid
333 /* Suppress unused-variable warnings by "using" E. */
334 #if ! defined lint || defined __GNUC__
335 # define YYUSE(e) ((void) (e))
337 # define YYUSE(e) /* empty */
340 /* Identity function, used to suppress warnings about constant conditions. */
344 #if (defined __STDC__ || defined __C99__FUNC__ \
345 || defined __cplusplus || defined _MSC_VER)
358 #if ! defined yyoverflow || YYERROR_VERBOSE
360 /* The parser invokes alloca or malloc; define the necessary symbols. */
362 # ifdef YYSTACK_USE_ALLOCA
363 # if YYSTACK_USE_ALLOCA
365 # define YYSTACK_ALLOC __builtin_alloca
366 # elif defined __BUILTIN_VA_ARG_INCR
367 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
369 # define YYSTACK_ALLOC __alloca
370 # elif defined _MSC_VER
371 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
372 # define alloca _alloca
374 # define YYSTACK_ALLOC alloca
375 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
376 || defined __cplusplus || defined _MSC_VER)
377 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
378 # ifndef EXIT_SUCCESS
379 # define EXIT_SUCCESS 0
386 # ifdef YYSTACK_ALLOC
387 /* Pacify GCC's `empty if-body' warning. */
388 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
389 # ifndef YYSTACK_ALLOC_MAXIMUM
390 /* The OS might guarantee only one guard page at the bottom of the stack,
391 and a page size can be as small as 4096 bytes. So we cannot safely
392 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
393 to allow for a few compiler-allocated temporary stack slots. */
394 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
397 # define YYSTACK_ALLOC YYMALLOC
398 # define YYSTACK_FREE YYFREE
399 # ifndef YYSTACK_ALLOC_MAXIMUM
400 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
402 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
403 && ! ((defined YYMALLOC || defined malloc) \
404 && (defined YYFREE || defined free)))
405 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
406 # ifndef EXIT_SUCCESS
407 # define EXIT_SUCCESS 0
411 # define YYMALLOC malloc
412 # if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
413 || defined __cplusplus || defined _MSC_VER)
414 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
419 # if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
420 || defined __cplusplus || defined _MSC_VER)
421 void free (void *); /* INFRINGES ON USER NAME SPACE */
425 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
428 #if (! defined yyoverflow \
429 && (! defined __cplusplus \
430 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
432 /* A type that is properly aligned for any stack member. */
435 yytype_int16 yyss_alloc;
439 /* The size of the maximum gap between one aligned stack and the next. */
440 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
442 /* The size of an array large to enough to hold all stacks, each with
444 # define YYSTACK_BYTES(N) \
445 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
446 + YYSTACK_GAP_MAXIMUM)
448 # define YYCOPY_NEEDED 1
450 /* Relocate STACK from its old location to the new one. The
451 local variables YYSIZE and YYSTACKSIZE give the old and new number of
452 elements in the stack, and YYPTR gives the new location of the
453 stack. Advance YYPTR to a properly aligned location for the next
455 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
458 YYSIZE_T yynewbytes; \
459 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
460 Stack = &yyptr->Stack_alloc; \
461 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
462 yyptr += yynewbytes / sizeof (*yyptr); \
468 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
469 /* Copy COUNT objects from FROM to TO. The source and destination do
472 # if defined __GNUC__ && 1 < __GNUC__
473 # define YYCOPY(To, From, Count) \
474 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
476 # define YYCOPY(To, From, Count) \
480 for (yyi = 0; yyi < (Count); yyi++) \
481 (To)[yyi] = (From)[yyi]; \
486 #endif /* !YYCOPY_NEEDED */
488 /* YYFINAL -- State number of the termination state. */
490 /* YYLAST -- Last index in YYTABLE. */
493 /* YYNTOKENS -- Number of terminals. */
495 /* YYNNTS -- Number of nonterminals. */
497 /* YYNRULES -- Number of rules. */
499 /* YYNRULES -- Number of states. */
500 #define YYNSTATES 159
502 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
504 #define YYMAXUTOK 284
506 #define YYTRANSLATE(YYX) \
507 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
509 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
510 static const yytype_uint8 yytranslate[] =
512 0, 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, 29, 2,
516 33, 34, 31, 2, 39, 2, 2, 2, 2, 2,
517 2, 2, 2, 2, 2, 2, 2, 2, 2, 35,
518 2, 38, 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, 36, 28, 37, 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, 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, 2, 2, 2, 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, 1, 2, 3, 4,
538 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
539 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
544 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
546 static const yytype_uint8 yyprhs[] =
548 0, 0, 3, 5, 8, 11, 13, 19, 25, 31,
549 37, 43, 49, 54, 59, 64, 69, 74, 77, 79,
550 82, 87, 90, 94, 101, 104, 106, 108, 113, 116,
551 122, 124, 129, 134, 135, 140, 144, 148, 152, 156,
552 160, 164, 166, 168, 170, 172, 176, 178, 180, 181,
553 186, 191, 193, 196, 198, 203, 209, 216, 219, 221,
554 224, 227, 231, 234, 236, 238, 240
557 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
558 static const yytype_int8 yyrhs[] =
560 41, 0, -1, 42, -1, 27, 56, -1, 42, 43,
561 -1, 43, -1, 6, 33, 11, 34, 35, -1, 22,
562 33, 61, 34, 35, -1, 20, 33, 18, 34, 35,
563 -1, 13, 33, 61, 34, 35, -1, 23, 16, 36,
564 44, 37, -1, 23, 1, 36, 44, 37, -1, 10,
565 33, 53, 34, -1, 12, 33, 53, 34, -1, 5,
566 33, 53, 34, -1, 26, 36, 56, 37, -1, 19,
567 33, 61, 34, -1, 44, 45, -1, 45, -1, 46,
568 35, -1, 11, 36, 47, 37, -1, 11, 35, -1,
569 11, 38, 52, -1, 21, 33, 11, 38, 52, 34,
570 -1, 47, 48, -1, 48, -1, 49, -1, 14, 33,
571 49, 34, -1, 46, 35, -1, 62, 33, 51, 50,
572 34, -1, 11, -1, 25, 33, 11, 34, -1, 7,
573 33, 61, 34, -1, -1, 4, 33, 52, 34, -1,
574 33, 52, 34, -1, 52, 31, 52, -1, 52, 17,
575 52, -1, 52, 3, 52, -1, 52, 29, 52, -1,
576 52, 28, 52, -1, 18, -1, 11, -1, 24, -1,
577 20, -1, 53, 54, 55, -1, 55, -1, 39, -1,
578 -1, 10, 33, 53, 34, -1, 5, 33, 53, 34,
579 -1, 61, -1, 56, 57, -1, 57, -1, 36, 58,
580 37, 35, -1, 61, 36, 58, 37, 35, -1, 61,
581 36, 58, 37, 61, 35, -1, 58, 59, -1, 59,
582 -1, 9, 60, -1, 15, 60, -1, 60, 62, 35,
583 -1, 62, 35, -1, 8, -1, 11, -1, 61, -1,
587 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
588 static const yytype_uint16 yyrline[] =
590 0, 143, 143, 144, 148, 149, 152, 157, 161, 166,
591 172, 176, 182, 193, 195, 197, 199, 203, 208, 212,
592 217, 229, 253, 255, 259, 264, 268, 273, 280, 287,
593 298, 300, 304, 307, 310, 315, 317, 323, 329, 335,
594 341, 347, 352, 357, 359, 363, 368, 372, 373, 376,
595 387, 389, 394, 399, 403, 409, 415, 424, 426, 430,
596 432, 437, 443, 447, 449, 453, 455
600 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
601 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
602 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
603 static const char *const yytname[] =
605 "$end", "error", "$undefined", "kADD_OP", "kALIGN", "kAS_NEEDED",
606 "kENTRY", "kEXCLUDE_FILE", "kFILENAME", "kGLOBAL", "kGROUP", "kID",
607 "kINPUT", "kINTERP", "kKEEP", "kLOCAL", "kMODE", "kMUL_OP", "kNUM",
608 "kOUTPUT_FORMAT", "kPAGESIZE", "kPROVIDE", "kSEARCH_DIR", "kSEGMENT",
609 "kSIZEOF_HEADERS", "kSORT", "kVERSION", "kVERSION_SCRIPT", "'|'", "'&'",
610 "ADD_OP", "'*'", "MUL_OP", "'('", "')'", "';'", "'{'", "'}'", "'='",
611 "','", "$accept", "script_or_version", "file", "content",
612 "outputsections", "outputsection", "assignment", "inputsections",
613 "inputsection", "sectionname", "sort_opt_name", "exclude_opt", "expr",
614 "filename_id_list", "comma_opt", "filename_id_listelem", "versionlist",
615 "version", "version_stmt_list", "version_stmt", "filename_id_star_list",
616 "filename_id", "filename_id_star", 0
621 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
623 static const yytype_uint16 yytoknum[] =
625 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
626 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
627 275, 276, 277, 278, 279, 280, 281, 282, 124, 38,
628 283, 42, 284, 40, 41, 59, 123, 125, 61, 44
632 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
633 static const yytype_uint8 yyr1[] =
635 0, 40, 41, 41, 42, 42, 43, 43, 43, 43,
636 43, 43, 43, 43, 43, 43, 43, 44, 44, 45,
637 45, 45, 46, 46, 47, 47, 48, 48, 48, 49,
638 50, 50, 51, 51, 52, 52, 52, 52, 52, 52,
639 52, 52, 52, 52, 52, 53, 53, 54, 54, 55,
640 55, 55, 56, 56, 57, 57, 57, 58, 58, 59,
641 59, 60, 60, 61, 61, 62, 62
644 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
645 static const yytype_uint8 yyr2[] =
647 0, 2, 1, 2, 2, 1, 5, 5, 5, 5,
648 5, 5, 4, 4, 4, 4, 4, 2, 1, 2,
649 4, 2, 3, 6, 2, 1, 1, 4, 2, 5,
650 1, 4, 4, 0, 4, 3, 3, 3, 3, 3,
651 3, 1, 1, 1, 1, 3, 1, 1, 0, 4,
652 4, 1, 2, 1, 4, 5, 6, 2, 1, 2,
656 /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
657 Performed when YYTABLE doesn't specify something else to do. Zero
658 means the default is an error. */
659 static const yytype_uint8 yydefact[] =
661 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
662 0, 0, 0, 2, 5, 0, 0, 0, 0, 0,
663 0, 0, 0, 0, 0, 0, 63, 64, 0, 3,
664 53, 0, 1, 4, 0, 0, 48, 46, 51, 0,
665 48, 48, 0, 0, 0, 0, 0, 0, 0, 0,
666 0, 0, 58, 52, 0, 0, 0, 14, 47, 0,
667 0, 12, 13, 0, 16, 0, 0, 0, 0, 0,
668 18, 0, 0, 15, 66, 59, 65, 0, 60, 0,
669 57, 0, 48, 48, 45, 6, 9, 8, 7, 21,
670 0, 0, 0, 11, 17, 19, 10, 0, 62, 54,
671 0, 50, 49, 64, 0, 0, 0, 25, 26, 0,
672 0, 42, 41, 44, 43, 0, 22, 0, 61, 55,
673 0, 0, 28, 20, 24, 33, 0, 0, 0, 0,
674 0, 0, 0, 0, 56, 0, 0, 0, 0, 35,
675 38, 37, 40, 39, 36, 0, 27, 0, 30, 0,
676 0, 34, 23, 0, 0, 29, 32, 0, 31
679 /* YYDEFGOTO[NTERM-NUM]. */
680 static const yytype_int16 yydefgoto[] =
682 -1, 12, 13, 14, 69, 70, 71, 106, 107, 108,
683 150, 137, 116, 36, 59, 37, 29, 30, 51, 52,
687 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
689 #define YYPACT_NINF -86
690 static const yytype_int16 yypact[] =
692 111, -18, -14, 23, 45, 70, 75, 85, 92, 97,
693 91, 19, 128, 134, -86, 162, 96, 162, 162, 5,
694 5, 123, 5, 93, 99, 19, -86, -86, 117, 19,
695 -86, 115, -86, -86, 125, 144, 71, -86, -86, 145,
696 116, 135, 147, 148, 149, 150, 101, 101, 14, 83,
697 83, 55, -86, -86, 117, 162, 162, -86, -86, 162,
698 133, -86, -86, 143, -86, 151, 152, 107, 155, 63,
699 -86, 154, 74, -86, -86, 83, -86, 156, 83, 157,
700 -86, 56, 137, 141, -86, -86, -86, -86, -86, -86,
701 88, 48, 174, -86, -86, -86, -86, 158, -86, -86,
702 69, -86, -86, 159, 161, 160, 12, -86, -86, 163,
703 165, -86, -86, -86, -86, 48, 59, 164, -86, -86,
704 166, 83, -86, -86, -86, 183, 48, 0, 48, 48,
705 48, 48, 48, 48, -86, 169, 167, 90, 7, -86,
706 59, 59, 44, 66, 103, 29, -86, 5, -86, 171,
707 172, -86, -86, 173, 188, -86, -86, 175, -86
710 /* YYPGOTO[NTERM-NUM]. */
711 static const yytype_int16 yypgoto[] =
713 -86, -86, -86, 192, 168, 80, -85, -86, 102, 89,
714 -86, -86, 33, -16, -86, 153, 186, 38, 170, -39,
718 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
719 positive, shift that token. If negative, reduce the rule which
720 number is the opposite. If YYTABLE_NINF, syntax error. */
721 #define YYTABLE_NINF -1
722 static const yytype_uint8 yytable[] =
724 31, 40, 41, 128, 38, 105, 38, 38, 42, 43,
725 128, 45, 80, 26, 31, 15, 27, 129, 31, 16,
726 26, 105, 26, 103, 129, 27, 104, 26, 130, 131,
727 27, 132, 128, 68, 139, 130, 131, 31, 132, 82,
728 83, 151, 80, 74, 38, 38, 129, 128, 38, 123,
729 28, 73, 110, 77, 77, 28, 17, 130, 131, 111,
730 132, 129, 128, 152, 49, 49, 112, 53, 113, 128,
731 50, 50, 114, 131, 67, 132, 129, 26, 18, 97,
732 27, 115, 97, 129, 68, 67, 53, 130, 131, 120,
733 132, 26, 79, 100, 27, 68, 26, 132, 23, 103,
734 93, 148, 104, 19, 119, 57, 128, 39, 20, 68,
735 58, 96, 67, 24, 74, 149, 1, 2, 21, 74,
736 129, 3, 68, 4, 5, 22, 49, 25, 32, 46,
737 6, 7, 50, 8, 9, 47, 153, 10, 11, 1,
738 2, 44, 89, 90, 3, 91, 4, 5, 127, 94,
739 61, 54, 94, 6, 7, 58, 8, 9, 55, 138,
740 10, 140, 141, 142, 143, 144, 145, 34, 85, 62,
741 26, 101, 35, 27, 58, 102, 58, 56, 86, 60,
742 58, 63, 64, 65, 66, 117, 87, 88, 92, 95,
743 136, 98, 99, 118, 121, 122, 125, 91, 126, 157,
744 147, 134, 133, 146, 154, 33, 155, 156, 124, 158,
745 135, 48, 84, 0, 0, 72, 0, 0, 0, 0,
746 0, 0, 0, 0, 81, 0, 78
749 #define yypact_value_is_default(yystate) \
752 #define yytable_value_is_error(yytable_value) \
755 static const yytype_int16 yycheck[] =
757 11, 17, 18, 3, 15, 90, 17, 18, 19, 20,
758 3, 22, 51, 8, 25, 33, 11, 17, 29, 33,
759 8, 106, 8, 11, 17, 11, 14, 8, 28, 29,
760 11, 31, 3, 21, 34, 28, 29, 48, 31, 55,
761 56, 34, 81, 31, 55, 56, 17, 3, 59, 37,
762 36, 37, 4, 49, 50, 36, 33, 28, 29, 11,
763 31, 17, 3, 34, 9, 9, 18, 29, 20, 3,
764 15, 15, 24, 29, 11, 31, 17, 8, 33, 75,
765 11, 33, 78, 17, 21, 11, 48, 28, 29, 100,
766 31, 8, 37, 37, 11, 21, 8, 31, 1, 11,
767 37, 11, 14, 33, 35, 34, 3, 11, 33, 21,
768 39, 37, 11, 16, 31, 25, 5, 6, 33, 31,
769 17, 10, 21, 12, 13, 33, 9, 36, 0, 36,
770 19, 20, 15, 22, 23, 36, 147, 26, 27, 5,
771 6, 18, 35, 36, 10, 38, 12, 13, 115, 69,
772 34, 36, 72, 19, 20, 39, 22, 23, 33, 126,
773 26, 128, 129, 130, 131, 132, 133, 5, 35, 34,
774 8, 34, 10, 11, 39, 34, 39, 33, 35, 34,
775 39, 34, 34, 34, 34, 11, 35, 35, 33, 35,
776 7, 35, 35, 35, 33, 35, 33, 38, 33, 11,
777 33, 35, 38, 34, 33, 13, 34, 34, 106, 34,
778 121, 25, 59, -1, -1, 47, -1, -1, -1, -1,
779 -1, -1, -1, -1, 54, -1, 50
782 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
783 symbol of state STATE-NUM. */
784 static const yytype_uint8 yystos[] =
786 0, 5, 6, 10, 12, 13, 19, 20, 22, 23,
787 26, 27, 41, 42, 43, 33, 33, 33, 33, 33,
788 33, 33, 33, 1, 16, 36, 8, 11, 36, 56,
789 57, 61, 0, 43, 5, 10, 53, 55, 61, 11,
790 53, 53, 61, 61, 18, 61, 36, 36, 56, 9,
791 15, 58, 59, 57, 36, 33, 33, 34, 39, 54,
792 34, 34, 34, 34, 34, 34, 34, 11, 21, 44,
793 45, 46, 44, 37, 31, 60, 61, 62, 60, 37,
794 59, 58, 53, 53, 55, 35, 35, 35, 35, 35,
795 36, 38, 33, 37, 45, 35, 37, 62, 35, 35,
796 37, 34, 34, 11, 14, 46, 47, 48, 49, 62,
797 4, 11, 18, 20, 24, 33, 52, 11, 35, 35,
798 61, 33, 35, 37, 48, 33, 33, 52, 3, 17,
799 28, 29, 31, 38, 35, 49, 7, 51, 52, 34,
800 52, 52, 52, 52, 52, 52, 34, 33, 11, 25,
801 50, 34, 34, 61, 33, 34, 34, 11, 34
804 #define yyerrok (yyerrstatus = 0)
805 #define yyclearin (yychar = YYEMPTY)
809 #define YYACCEPT goto yyacceptlab
810 #define YYABORT goto yyabortlab
811 #define YYERROR goto yyerrorlab
814 /* Like YYERROR except do call yyerror. This remains here temporarily
815 to ease the transition to the new meaning of YYERROR, for GCC.
816 Once GCC version 2 has supplanted version 1, this can go. However,
817 YYFAIL appears to be in use. Nevertheless, it is formally deprecated
818 in Bison 2.4.2's NEWS entry, where a plan to phase it out is
821 #define YYFAIL goto yyerrlab
823 /* This is here to suppress warnings from the GCC cpp's
824 -Wunused-macros. Normally we don't worry about that warning, but
825 some users do, and we want to make it easy for users to remove
826 YYFAIL uses, which will produce warnings from Bison 2.5. */
829 #define YYRECOVERING() (!!yyerrstatus)
831 #define YYBACKUP(Token, Value) \
833 if (yychar == YYEMPTY && yylen == 1) \
842 yyerror (YY_("syntax error: cannot back up")); \
849 #define YYERRCODE 256
852 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
853 If N is 0, then set CURRENT to the empty location which ends
854 the previous symbol: RHS[0] (always defined). */
856 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
857 #ifndef YYLLOC_DEFAULT
858 # define YYLLOC_DEFAULT(Current, Rhs, N) \
862 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
863 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
864 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
865 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
869 (Current).first_line = (Current).last_line = \
870 YYRHSLOC (Rhs, 0).last_line; \
871 (Current).first_column = (Current).last_column = \
872 YYRHSLOC (Rhs, 0).last_column; \
878 /* This macro is provided for backward compatibility. */
880 #ifndef YY_LOCATION_PRINT
881 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
885 /* YYLEX -- calling `yylex' with the right arguments. */
888 # define YYLEX yylex (YYLEX_PARAM)
890 # define YYLEX yylex ()
893 /* Enable debugging if requested. */
897 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
898 # define YYFPRINTF fprintf
901 # define YYDPRINTF(Args) \
907 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
911 YYFPRINTF (stderr, "%s ", Title); \
912 yy_symbol_print (stderr, \
914 YYFPRINTF (stderr, "\n"); \
919 /*--------------------------------.
920 | Print this symbol on YYOUTPUT. |
921 `--------------------------------*/
924 #if (defined __STDC__ || defined __C99__FUNC__ \
925 || defined __cplusplus || defined _MSC_VER)
927 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
930 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
933 YYSTYPE const * const yyvaluep;
939 if (yytype < YYNTOKENS)
940 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
952 /*--------------------------------.
953 | Print this symbol on YYOUTPUT. |
954 `--------------------------------*/
956 #if (defined __STDC__ || defined __C99__FUNC__ \
957 || defined __cplusplus || defined _MSC_VER)
959 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
962 yy_symbol_print (yyoutput, yytype, yyvaluep)
965 YYSTYPE const * const yyvaluep;
968 if (yytype < YYNTOKENS)
969 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
971 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
973 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
974 YYFPRINTF (yyoutput, ")");
977 /*------------------------------------------------------------------.
978 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
980 `------------------------------------------------------------------*/
982 #if (defined __STDC__ || defined __C99__FUNC__ \
983 || defined __cplusplus || defined _MSC_VER)
985 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
988 yy_stack_print (yybottom, yytop)
989 yytype_int16 *yybottom;
993 YYFPRINTF (stderr, "Stack now");
994 for (; yybottom <= yytop; yybottom++)
996 int yybot = *yybottom;
997 YYFPRINTF (stderr, " %d", yybot);
999 YYFPRINTF (stderr, "\n");
1002 # define YY_STACK_PRINT(Bottom, Top) \
1005 yy_stack_print ((Bottom), (Top)); \
1009 /*------------------------------------------------.
1010 | Report that the YYRULE is going to be reduced. |
1011 `------------------------------------------------*/
1013 #if (defined __STDC__ || defined __C99__FUNC__ \
1014 || defined __cplusplus || defined _MSC_VER)
1016 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
1019 yy_reduce_print (yyvsp, yyrule)
1024 int yynrhs = yyr2[yyrule];
1026 unsigned long int yylno = yyrline[yyrule];
1027 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1029 /* The symbols being reduced. */
1030 for (yyi = 0; yyi < yynrhs; yyi++)
1032 YYFPRINTF (stderr, " $%d = ", yyi + 1);
1033 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1034 &(yyvsp[(yyi + 1) - (yynrhs)])
1036 YYFPRINTF (stderr, "\n");
1040 # define YY_REDUCE_PRINT(Rule) \
1043 yy_reduce_print (yyvsp, Rule); \
1046 /* Nonzero means print parse trace. It is left uninitialized so that
1047 multiple parsers can coexist. */
1049 #else /* !YYDEBUG */
1050 # define YYDPRINTF(Args)
1051 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1052 # define YY_STACK_PRINT(Bottom, Top)
1053 # define YY_REDUCE_PRINT(Rule)
1054 #endif /* !YYDEBUG */
1057 /* YYINITDEPTH -- initial size of the parser's stacks. */
1059 # define YYINITDEPTH 200
1062 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1063 if the built-in stack extension method is used).
1065 Do not make this value too large; the results are undefined if
1066 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1067 evaluated with infinite-precision integer arithmetic. */
1070 # define YYMAXDEPTH 10000
1077 # if defined __GLIBC__ && defined _STRING_H
1078 # define yystrlen strlen
1080 /* Return the length of YYSTR. */
1081 #if (defined __STDC__ || defined __C99__FUNC__ \
1082 || defined __cplusplus || defined _MSC_VER)
1084 yystrlen (const char *yystr)
1092 for (yylen = 0; yystr[yylen]; yylen++)
1100 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1101 # define yystpcpy stpcpy
1103 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1105 #if (defined __STDC__ || defined __C99__FUNC__ \
1106 || defined __cplusplus || defined _MSC_VER)
1108 yystpcpy (char *yydest, const char *yysrc)
1111 yystpcpy (yydest, yysrc)
1117 const char *yys = yysrc;
1119 while ((*yyd++ = *yys++) != '\0')
1128 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1129 quotes and backslashes, so that it's suitable for yyerror. The
1130 heuristic is that double-quoting is unnecessary unless the string
1131 contains an apostrophe, a comma, or backslash (other than
1132 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1133 null, do not copy; instead, return the length of what the result
1136 yytnamerr (char *yyres, const char *yystr)
1141 char const *yyp = yystr;
1148 goto do_not_strip_quotes;
1152 goto do_not_strip_quotes;
1165 do_not_strip_quotes: ;
1169 return yystrlen (yystr);
1171 return yystpcpy (yyres, yystr) - yyres;
1175 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1176 about the unexpected token YYTOKEN for the state stack whose top is
1179 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1180 not large enough to hold the message. In that case, also set
1181 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1182 required number of bytes is too large to store. */
1184 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1185 yytype_int16 *yyssp, int yytoken)
1187 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
1188 YYSIZE_T yysize = yysize0;
1190 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1191 /* Internationalized format string. */
1192 const char *yyformat = 0;
1193 /* Arguments of yyformat. */
1194 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1195 /* Number of reported tokens (one for the "unexpected", one per
1199 /* There are many possibilities here to consider:
1200 - Assume YYFAIL is not used. It's too flawed to consider. See
1201 <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
1202 for details. YYERROR is fine as it does not invoke this
1204 - If this state is a consistent state with a default action, then
1205 the only way this function was invoked is if the default action
1206 is an error action. In that case, don't check for expected
1207 tokens because there are none.
1208 - The only way there can be no lookahead present (in yychar) is if
1209 this state is a consistent state with a default action. Thus,
1210 detecting the absence of a lookahead is sufficient to determine
1211 that there is no unexpected or expected token to report. In that
1212 case, just report a simple "syntax error".
1213 - Don't assume there isn't a lookahead just because this state is a
1214 consistent state with a default action. There might have been a
1215 previous inconsistent state, consistent state with a non-default
1216 action, or user semantic action that manipulated yychar.
1217 - Of course, the expected token list depends on states to have
1218 correct lookahead information, and it depends on the parser not
1219 to perform extra reductions after fetching a lookahead from the
1220 scanner and before detecting a syntax error. Thus, state merging
1221 (from LALR or IELR) and default reductions corrupt the expected
1222 token list. However, the list is correct for canonical LR with
1223 one exception: it will still contain any token that will not be
1224 accepted due to an error action in a later state.
1226 if (yytoken != YYEMPTY)
1228 int yyn = yypact[*yyssp];
1229 yyarg[yycount++] = yytname[yytoken];
1230 if (!yypact_value_is_default (yyn))
1232 /* Start YYX at -YYN if negative to avoid negative indexes in
1233 YYCHECK. In other words, skip the first -YYN actions for
1234 this state because they are default actions. */
1235 int yyxbegin = yyn < 0 ? -yyn : 0;
1236 /* Stay within bounds of both yycheck and yytname. */
1237 int yychecklim = YYLAST - yyn + 1;
1238 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1241 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1242 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1243 && !yytable_value_is_error (yytable[yyx + yyn]))
1245 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1251 yyarg[yycount++] = yytname[yyx];
1252 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1253 if (! (yysize <= yysize1
1254 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1263 # define YYCASE_(N, S) \
1267 YYCASE_(0, YY_("syntax error"));
1268 YYCASE_(1, YY_("syntax error, unexpected %s"));
1269 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1270 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1271 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1272 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1276 yysize1 = yysize + yystrlen (yyformat);
1277 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1281 if (*yymsg_alloc < yysize)
1283 *yymsg_alloc = 2 * yysize;
1284 if (! (yysize <= *yymsg_alloc
1285 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1286 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1290 /* Avoid sprintf, as that infringes on the user's name space.
1291 Don't have undefined behavior even if the translation
1292 produced a string with the wrong number of "%s"s. */
1296 while ((*yyp = *yyformat) != '\0')
1297 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1299 yyp += yytnamerr (yyp, yyarg[yyi++]);
1310 #endif /* YYERROR_VERBOSE */
1312 /*-----------------------------------------------.
1313 | Release the memory associated to this symbol. |
1314 `-----------------------------------------------*/
1317 #if (defined __STDC__ || defined __C99__FUNC__ \
1318 || defined __cplusplus || defined _MSC_VER)
1320 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1323 yydestruct (yymsg, yytype, yyvaluep)
1333 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1344 /* Prevent warnings from -Wmissing-prototypes. */
1345 #ifdef YYPARSE_PARAM
1346 #if defined __STDC__ || defined __cplusplus
1347 int yyparse (void *YYPARSE_PARAM);
1351 #else /* ! YYPARSE_PARAM */
1352 #if defined __STDC__ || defined __cplusplus
1357 #endif /* ! YYPARSE_PARAM */
1360 /* The lookahead symbol. */
1363 /* The semantic value of the lookahead symbol. */
1366 /* Number of syntax errors so far. */
1374 #ifdef YYPARSE_PARAM
1375 #if (defined __STDC__ || defined __C99__FUNC__ \
1376 || defined __cplusplus || defined _MSC_VER)
1378 yyparse (void *YYPARSE_PARAM)
1381 yyparse (YYPARSE_PARAM)
1382 void *YYPARSE_PARAM;
1384 #else /* ! YYPARSE_PARAM */
1385 #if (defined __STDC__ || defined __C99__FUNC__ \
1386 || defined __cplusplus || defined _MSC_VER)
1397 /* Number of tokens to shift before error messages enabled. */
1400 /* The stacks and their tools:
1401 `yyss': related to states.
1402 `yyvs': related to semantic values.
1404 Refer to the stacks thru separate pointers, to allow yyoverflow
1405 to reallocate them elsewhere. */
1407 /* The state stack. */
1408 yytype_int16 yyssa[YYINITDEPTH];
1410 yytype_int16 *yyssp;
1412 /* The semantic value stack. */
1413 YYSTYPE yyvsa[YYINITDEPTH];
1417 YYSIZE_T yystacksize;
1421 /* Lookahead token as an internal (translated) token number. */
1423 /* The variables used to return semantic value and location from the
1428 /* Buffer for error messages, and its allocated size. */
1430 char *yymsg = yymsgbuf;
1431 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1434 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1436 /* The number of symbols on the RHS of the reduced rule.
1437 Keep to zero when no symbol should be popped. */
1443 yystacksize = YYINITDEPTH;
1445 YYDPRINTF ((stderr, "Starting parse\n"));
1450 yychar = YYEMPTY; /* Cause a token to be read. */
1452 /* Initialize stack pointers.
1453 Waste one element of value and location stack
1454 so that they stay on the same level as the state stack.
1455 The wasted elements are never initialized. */
1461 /*------------------------------------------------------------.
1462 | yynewstate -- Push a new state, which is found in yystate. |
1463 `------------------------------------------------------------*/
1465 /* In all cases, when you get here, the value and location stacks
1466 have just been pushed. So pushing a state here evens the stacks. */
1472 if (yyss + yystacksize - 1 <= yyssp)
1474 /* Get the current used size of the three stacks, in elements. */
1475 YYSIZE_T yysize = yyssp - yyss + 1;
1479 /* Give user a chance to reallocate the stack. Use copies of
1480 these so that the &'s don't force the real ones into
1482 YYSTYPE *yyvs1 = yyvs;
1483 yytype_int16 *yyss1 = yyss;
1485 /* Each stack pointer address is followed by the size of the
1486 data in use in that stack, in bytes. This used to be a
1487 conditional around just the two extra args, but that might
1488 be undefined if yyoverflow is a macro. */
1489 yyoverflow (YY_("memory exhausted"),
1490 &yyss1, yysize * sizeof (*yyssp),
1491 &yyvs1, yysize * sizeof (*yyvsp),
1497 #else /* no yyoverflow */
1498 # ifndef YYSTACK_RELOCATE
1499 goto yyexhaustedlab;
1501 /* Extend the stack our own way. */
1502 if (YYMAXDEPTH <= yystacksize)
1503 goto yyexhaustedlab;
1505 if (YYMAXDEPTH < yystacksize)
1506 yystacksize = YYMAXDEPTH;
1509 yytype_int16 *yyss1 = yyss;
1510 union yyalloc *yyptr =
1511 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1513 goto yyexhaustedlab;
1514 YYSTACK_RELOCATE (yyss_alloc, yyss);
1515 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1516 # undef YYSTACK_RELOCATE
1518 YYSTACK_FREE (yyss1);
1521 #endif /* no yyoverflow */
1523 yyssp = yyss + yysize - 1;
1524 yyvsp = yyvs + yysize - 1;
1526 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1527 (unsigned long int) yystacksize));
1529 if (yyss + yystacksize - 1 <= yyssp)
1533 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1535 if (yystate == YYFINAL)
1545 /* Do appropriate processing given the current state. Read a
1546 lookahead token if we need one and don't already have one. */
1548 /* First try to decide what to do without reference to lookahead token. */
1549 yyn = yypact[yystate];
1550 if (yypact_value_is_default (yyn))
1553 /* Not known => get a lookahead token if don't already have one. */
1555 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1556 if (yychar == YYEMPTY)
1558 YYDPRINTF ((stderr, "Reading a token: "));
1562 if (yychar <= YYEOF)
1564 yychar = yytoken = YYEOF;
1565 YYDPRINTF ((stderr, "Now at end of input.\n"));
1569 yytoken = YYTRANSLATE (yychar);
1570 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1573 /* If the proper action on seeing token YYTOKEN is to reduce or to
1574 detect an error, take that action. */
1576 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1581 if (yytable_value_is_error (yyn))
1587 /* Count tokens shifted since error; after three, turn off error
1592 /* Shift the lookahead token. */
1593 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1595 /* Discard the shifted token. */
1604 /*-----------------------------------------------------------.
1605 | yydefault -- do the default action for the current state. |
1606 `-----------------------------------------------------------*/
1608 yyn = yydefact[yystate];
1614 /*-----------------------------.
1615 | yyreduce -- Do a reduction. |
1616 `-----------------------------*/
1618 /* yyn is the number of a rule to reduce with. */
1621 /* If YYLEN is nonzero, implement the default value of the action:
1624 Otherwise, the following line sets YYVAL to garbage.
1625 This behavior is undocumented and Bison
1626 users should not rely upon it. Assigning to YYVAL
1627 unconditionally makes the parser a bit smaller, and it avoids a
1628 GCC warning that YYVAL may be used uninitialized. */
1629 yyval = yyvsp[1-yylen];
1632 YY_REDUCE_PRINT (yyn);
1637 /* Line 1806 of yacc.c */
1638 #line 145 "ldscript.y"
1639 { add_versions ((yyvsp[(2) - (2)].version)); }
1644 /* Line 1806 of yacc.c */
1645 #line 153 "ldscript.y"
1647 if (likely (ld_state.entry == NULL))
1648 ld_state.entry = (yyvsp[(3) - (5)].str);
1654 /* Line 1806 of yacc.c */
1655 #line 158 "ldscript.y"
1657 ld_new_searchdir ((yyvsp[(3) - (5)].str));
1663 /* Line 1806 of yacc.c */
1664 #line 162 "ldscript.y"
1666 if (likely (ld_state.pagesize == 0))
1667 ld_state.pagesize = (yyvsp[(3) - (5)].num);
1673 /* Line 1806 of yacc.c */
1674 #line 167 "ldscript.y"
1676 if (likely (ld_state.interp == NULL)
1677 && ld_state.file_type != dso_file_type)
1678 ld_state.interp = (yyvsp[(3) - (5)].str);
1684 /* Line 1806 of yacc.c */
1685 #line 173 "ldscript.y"
1687 new_segment ((yyvsp[(2) - (5)].num), (yyvsp[(4) - (5)].output_rule));
1693 /* Line 1806 of yacc.c */
1694 #line 177 "ldscript.y"
1696 fputs_unlocked (gettext ("mode for segment invalid\n"),
1698 new_segment (0, (yyvsp[(4) - (5)].output_rule));
1704 /* Line 1806 of yacc.c */
1705 #line 183 "ldscript.y"
1707 /* First little optimization. If there is only one
1708 file in the group don't do anything. */
1709 if ((yyvsp[(3) - (4)].filename_list) != (yyvsp[(3) - (4)].filename_list)->next)
1711 (yyvsp[(3) - (4)].filename_list)->next->group_start = 1;
1712 (yyvsp[(3) - (4)].filename_list)->group_end = 1;
1714 add_inputfiles ((yyvsp[(3) - (4)].filename_list));
1720 /* Line 1806 of yacc.c */
1721 #line 194 "ldscript.y"
1722 { add_inputfiles ((yyvsp[(3) - (4)].filename_list)); }
1727 /* Line 1806 of yacc.c */
1728 #line 196 "ldscript.y"
1729 { add_inputfiles (mark_as_needed ((yyvsp[(3) - (4)].filename_list))); }
1734 /* Line 1806 of yacc.c */
1735 #line 198 "ldscript.y"
1736 { add_versions ((yyvsp[(3) - (4)].version)); }
1741 /* Line 1806 of yacc.c */
1742 #line 200 "ldscript.y"
1748 /* Line 1806 of yacc.c */
1749 #line 204 "ldscript.y"
1751 (yyvsp[(2) - (2)].output_rule)->next = (yyvsp[(1) - (2)].output_rule)->next;
1752 (yyval.output_rule) = (yyvsp[(1) - (2)].output_rule)->next = (yyvsp[(2) - (2)].output_rule);
1758 /* Line 1806 of yacc.c */
1759 #line 209 "ldscript.y"
1760 { (yyval.output_rule) = (yyvsp[(1) - (1)].output_rule); }
1765 /* Line 1806 of yacc.c */
1766 #line 213 "ldscript.y"
1768 (yyval.output_rule) = new_output_rule (output_assignment);
1769 (yyval.output_rule)->val.assignment = (yyvsp[(1) - (2)].assignment);
1775 /* Line 1806 of yacc.c */
1776 #line 218 "ldscript.y"
1778 (yyval.output_rule) = new_output_rule (output_section);
1779 (yyval.output_rule)->val.section.name = (yyvsp[(1) - (4)].str);
1780 (yyval.output_rule)->val.section.input = (yyvsp[(3) - (4)].input_rule)->next;
1781 if (ld_state.strip == strip_debug
1782 && ebl_debugscn_p (ld_state.ebl, (yyvsp[(1) - (4)].str)))
1783 (yyval.output_rule)->val.section.ignored = true;
1785 (yyval.output_rule)->val.section.ignored = false;
1786 (yyvsp[(3) - (4)].input_rule)->next = NULL;
1792 /* Line 1806 of yacc.c */
1793 #line 230 "ldscript.y"
1795 /* This is a short cut for "ID { *(ID) }". */
1796 (yyval.output_rule) = new_output_rule (output_section);
1797 (yyval.output_rule)->val.section.name = (yyvsp[(1) - (2)].str);
1798 (yyval.output_rule)->val.section.input = new_input_rule (input_section);
1799 (yyval.output_rule)->val.section.input->next = NULL;
1800 (yyval.output_rule)->val.section.input->val.section =
1801 (struct filemask_section_name *)
1802 obstack_alloc (&ld_state.smem,
1803 sizeof (struct filemask_section_name));
1804 (yyval.output_rule)->val.section.input->val.section->filemask = NULL;
1805 (yyval.output_rule)->val.section.input->val.section->excludemask = NULL;
1806 (yyval.output_rule)->val.section.input->val.section->section_name =
1807 new_input_section_name ((yyvsp[(1) - (2)].str), false);
1808 (yyval.output_rule)->val.section.input->val.section->keep_flag = false;
1809 if (ld_state.strip == strip_debug
1810 && ebl_debugscn_p (ld_state.ebl, (yyvsp[(1) - (2)].str)))
1811 (yyval.output_rule)->val.section.ignored = true;
1813 (yyval.output_rule)->val.section.ignored = false;
1819 /* Line 1806 of yacc.c */
1820 #line 254 "ldscript.y"
1821 { (yyval.assignment) = new_assignment ((yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].expr), false); }
1826 /* Line 1806 of yacc.c */
1827 #line 256 "ldscript.y"
1828 { (yyval.assignment) = new_assignment ((yyvsp[(3) - (6)].str), (yyvsp[(5) - (6)].expr), true); }
1833 /* Line 1806 of yacc.c */
1834 #line 260 "ldscript.y"
1836 (yyvsp[(2) - (2)].input_rule)->next = (yyvsp[(1) - (2)].input_rule)->next;
1837 (yyval.input_rule) = (yyvsp[(1) - (2)].input_rule)->next = (yyvsp[(2) - (2)].input_rule);
1843 /* Line 1806 of yacc.c */
1844 #line 265 "ldscript.y"
1845 { (yyval.input_rule) = (yyvsp[(1) - (1)].input_rule); }
1850 /* Line 1806 of yacc.c */
1851 #line 269 "ldscript.y"
1853 (yyval.input_rule) = new_input_rule (input_section);
1854 (yyval.input_rule)->val.section = (yyvsp[(1) - (1)].filemask_section_name);
1860 /* Line 1806 of yacc.c */
1861 #line 274 "ldscript.y"
1863 (yyvsp[(3) - (4)].filemask_section_name)->keep_flag = true;
1865 (yyval.input_rule) = new_input_rule (input_section);
1866 (yyval.input_rule)->val.section = (yyvsp[(3) - (4)].filemask_section_name);
1872 /* Line 1806 of yacc.c */
1873 #line 281 "ldscript.y"
1875 (yyval.input_rule) = new_input_rule (input_assignment);
1876 (yyval.input_rule)->val.assignment = (yyvsp[(1) - (2)].assignment);
1882 /* Line 1806 of yacc.c */
1883 #line 288 "ldscript.y"
1885 (yyval.filemask_section_name) = (struct filemask_section_name *)
1886 obstack_alloc (&ld_state.smem, sizeof (*(yyval.filemask_section_name)));
1887 (yyval.filemask_section_name)->filemask = (yyvsp[(1) - (5)].str);
1888 (yyval.filemask_section_name)->excludemask = (yyvsp[(3) - (5)].str);
1889 (yyval.filemask_section_name)->section_name = (yyvsp[(4) - (5)].sectionname);
1890 (yyval.filemask_section_name)->keep_flag = false;
1896 /* Line 1806 of yacc.c */
1897 #line 299 "ldscript.y"
1898 { (yyval.sectionname) = new_input_section_name ((yyvsp[(1) - (1)].str), false); }
1903 /* Line 1806 of yacc.c */
1904 #line 301 "ldscript.y"
1905 { (yyval.sectionname) = new_input_section_name ((yyvsp[(3) - (4)].str), true); }
1910 /* Line 1806 of yacc.c */
1911 #line 305 "ldscript.y"
1912 { (yyval.str) = (yyvsp[(3) - (4)].str); }
1917 /* Line 1806 of yacc.c */
1918 #line 307 "ldscript.y"
1919 { (yyval.str) = NULL; }
1924 /* Line 1806 of yacc.c */
1925 #line 311 "ldscript.y"
1927 (yyval.expr) = new_expr (exp_align);
1928 (yyval.expr)->val.child = (yyvsp[(3) - (4)].expr);
1934 /* Line 1806 of yacc.c */
1935 #line 316 "ldscript.y"
1936 { (yyval.expr) = (yyvsp[(2) - (3)].expr); }
1941 /* Line 1806 of yacc.c */
1942 #line 318 "ldscript.y"
1944 (yyval.expr) = new_expr (exp_mult);
1945 (yyval.expr)->val.binary.left = (yyvsp[(1) - (3)].expr);
1946 (yyval.expr)->val.binary.right = (yyvsp[(3) - (3)].expr);
1952 /* Line 1806 of yacc.c */
1953 #line 324 "ldscript.y"
1955 (yyval.expr) = new_expr ((yyvsp[(2) - (3)].op));
1956 (yyval.expr)->val.binary.left = (yyvsp[(1) - (3)].expr);
1957 (yyval.expr)->val.binary.right = (yyvsp[(3) - (3)].expr);
1963 /* Line 1806 of yacc.c */
1964 #line 330 "ldscript.y"
1966 (yyval.expr) = new_expr ((yyvsp[(2) - (3)].op));
1967 (yyval.expr)->val.binary.left = (yyvsp[(1) - (3)].expr);
1968 (yyval.expr)->val.binary.right = (yyvsp[(3) - (3)].expr);
1974 /* Line 1806 of yacc.c */
1975 #line 336 "ldscript.y"
1977 (yyval.expr) = new_expr (exp_and);
1978 (yyval.expr)->val.binary.left = (yyvsp[(1) - (3)].expr);
1979 (yyval.expr)->val.binary.right = (yyvsp[(3) - (3)].expr);
1985 /* Line 1806 of yacc.c */
1986 #line 342 "ldscript.y"
1988 (yyval.expr) = new_expr (exp_or);
1989 (yyval.expr)->val.binary.left = (yyvsp[(1) - (3)].expr);
1990 (yyval.expr)->val.binary.right = (yyvsp[(3) - (3)].expr);
1996 /* Line 1806 of yacc.c */
1997 #line 348 "ldscript.y"
1999 (yyval.expr) = new_expr (exp_num);
2000 (yyval.expr)->val.num = (yyvsp[(1) - (1)].num);
2006 /* Line 1806 of yacc.c */
2007 #line 353 "ldscript.y"
2009 (yyval.expr) = new_expr (exp_id);
2010 (yyval.expr)->val.str = (yyvsp[(1) - (1)].str);
2016 /* Line 1806 of yacc.c */
2017 #line 358 "ldscript.y"
2018 { (yyval.expr) = new_expr (exp_sizeof_headers); }
2023 /* Line 1806 of yacc.c */
2024 #line 360 "ldscript.y"
2025 { (yyval.expr) = new_expr (exp_pagesize); }
2030 /* Line 1806 of yacc.c */
2031 #line 364 "ldscript.y"
2033 (yyvsp[(3) - (3)].filename_list)->next = (yyvsp[(1) - (3)].filename_list)->next;
2034 (yyval.filename_list) = (yyvsp[(1) - (3)].filename_list)->next = (yyvsp[(3) - (3)].filename_list);
2040 /* Line 1806 of yacc.c */
2041 #line 369 "ldscript.y"
2042 { (yyval.filename_list) = (yyvsp[(1) - (1)].filename_list); }
2047 /* Line 1806 of yacc.c */
2048 #line 377 "ldscript.y"
2050 /* First little optimization. If there is only one
2051 file in the group don't do anything. */
2052 if ((yyvsp[(3) - (4)].filename_list) != (yyvsp[(3) - (4)].filename_list)->next)
2054 (yyvsp[(3) - (4)].filename_list)->next->group_start = 1;
2055 (yyvsp[(3) - (4)].filename_list)->group_end = 1;
2057 (yyval.filename_list) = (yyvsp[(3) - (4)].filename_list);
2063 /* Line 1806 of yacc.c */
2064 #line 388 "ldscript.y"
2065 { (yyval.filename_list) = mark_as_needed ((yyvsp[(3) - (4)].filename_list)); }
2070 /* Line 1806 of yacc.c */
2071 #line 390 "ldscript.y"
2072 { (yyval.filename_list) = new_filename_listelem ((yyvsp[(1) - (1)].str)); }
2077 /* Line 1806 of yacc.c */
2078 #line 395 "ldscript.y"
2080 (yyvsp[(2) - (2)].version)->next = (yyvsp[(1) - (2)].version)->next;
2081 (yyval.version) = (yyvsp[(1) - (2)].version)->next = (yyvsp[(2) - (2)].version);
2087 /* Line 1806 of yacc.c */
2088 #line 400 "ldscript.y"
2089 { (yyval.version) = (yyvsp[(1) - (1)].version); }
2094 /* Line 1806 of yacc.c */
2095 #line 404 "ldscript.y"
2097 (yyvsp[(2) - (4)].version)->versionname = "";
2098 (yyvsp[(2) - (4)].version)->parentname = NULL;
2099 (yyval.version) = (yyvsp[(2) - (4)].version);
2105 /* Line 1806 of yacc.c */
2106 #line 410 "ldscript.y"
2108 (yyvsp[(3) - (5)].version)->versionname = (yyvsp[(1) - (5)].str);
2109 (yyvsp[(3) - (5)].version)->parentname = NULL;
2110 (yyval.version) = (yyvsp[(3) - (5)].version);
2116 /* Line 1806 of yacc.c */
2117 #line 416 "ldscript.y"
2119 (yyvsp[(3) - (6)].version)->versionname = (yyvsp[(1) - (6)].str);
2120 (yyvsp[(3) - (6)].version)->parentname = (yyvsp[(5) - (6)].str);
2121 (yyval.version) = (yyvsp[(3) - (6)].version);
2127 /* Line 1806 of yacc.c */
2128 #line 425 "ldscript.y"
2129 { (yyval.version) = merge_versions ((yyvsp[(1) - (2)].version), (yyvsp[(2) - (2)].version)); }
2134 /* Line 1806 of yacc.c */
2135 #line 427 "ldscript.y"
2136 { (yyval.version) = (yyvsp[(1) - (1)].version); }
2141 /* Line 1806 of yacc.c */
2142 #line 431 "ldscript.y"
2143 { (yyval.version) = new_version (NULL, (yyvsp[(2) - (2)].id_list)); }
2148 /* Line 1806 of yacc.c */
2149 #line 433 "ldscript.y"
2150 { (yyval.version) = new_version ((yyvsp[(2) - (2)].id_list), NULL); }
2155 /* Line 1806 of yacc.c */
2156 #line 438 "ldscript.y"
2158 struct id_list *newp = new_id_listelem ((yyvsp[(2) - (3)].str));
2159 newp->next = (yyvsp[(1) - (3)].id_list)->next;
2160 (yyval.id_list) = (yyvsp[(1) - (3)].id_list)->next = newp;
2166 /* Line 1806 of yacc.c */
2167 #line 444 "ldscript.y"
2168 { (yyval.id_list) = new_id_listelem ((yyvsp[(1) - (2)].str)); }
2173 /* Line 1806 of yacc.c */
2174 #line 448 "ldscript.y"
2175 { (yyval.str) = (yyvsp[(1) - (1)].str); }
2180 /* Line 1806 of yacc.c */
2181 #line 450 "ldscript.y"
2182 { (yyval.str) = (yyvsp[(1) - (1)].str); }
2187 /* Line 1806 of yacc.c */
2188 #line 454 "ldscript.y"
2189 { (yyval.str) = (yyvsp[(1) - (1)].str); }
2194 /* Line 1806 of yacc.c */
2195 #line 456 "ldscript.y"
2196 { (yyval.str) = NULL; }
2201 /* Line 1806 of yacc.c */
2202 #line 2203 "ldscript.c"
2205 /* User semantic actions sometimes alter yychar, and that requires
2206 that yytoken be updated with the new translation. We take the
2207 approach of translating immediately before every use of yytoken.
2208 One alternative is translating here after every semantic action,
2209 but that translation would be missed if the semantic action invokes
2210 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2211 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2212 incorrect destructor might then be invoked immediately. In the
2213 case of YYERROR or YYBACKUP, subsequent parser actions might lead
2214 to an incorrect destructor call or verbose syntax error message
2215 before the lookahead is translated. */
2216 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2220 YY_STACK_PRINT (yyss, yyssp);
2224 /* Now `shift' the result of the reduction. Determine what state
2225 that goes to, based on the state we popped back to and the rule
2226 number reduced by. */
2230 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2231 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2232 yystate = yytable[yystate];
2234 yystate = yydefgoto[yyn - YYNTOKENS];
2239 /*------------------------------------.
2240 | yyerrlab -- here on detecting error |
2241 `------------------------------------*/
2243 /* Make sure we have latest lookahead translation. See comments at
2244 user semantic actions for why this is necessary. */
2245 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
2247 /* If not already recovering from an error, report this error. */
2251 #if ! YYERROR_VERBOSE
2252 yyerror (YY_("syntax error"));
2254 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2257 char const *yymsgp = YY_("syntax error");
2258 int yysyntax_error_status;
2259 yysyntax_error_status = YYSYNTAX_ERROR;
2260 if (yysyntax_error_status == 0)
2262 else if (yysyntax_error_status == 1)
2264 if (yymsg != yymsgbuf)
2265 YYSTACK_FREE (yymsg);
2266 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
2270 yymsg_alloc = sizeof yymsgbuf;
2271 yysyntax_error_status = 2;
2275 yysyntax_error_status = YYSYNTAX_ERROR;
2280 if (yysyntax_error_status == 2)
2281 goto yyexhaustedlab;
2283 # undef YYSYNTAX_ERROR
2289 if (yyerrstatus == 3)
2291 /* If just tried and failed to reuse lookahead token after an
2292 error, discard it. */
2294 if (yychar <= YYEOF)
2296 /* Return failure if at end of input. */
2297 if (yychar == YYEOF)
2302 yydestruct ("Error: discarding",
2308 /* Else will try to reuse lookahead token after shifting the error
2313 /*---------------------------------------------------.
2314 | yyerrorlab -- error raised explicitly by YYERROR. |
2315 `---------------------------------------------------*/
2318 /* Pacify compilers like GCC when the user code never invokes
2319 YYERROR and the label yyerrorlab therefore never appears in user
2321 if (/*CONSTCOND*/ 0)
2324 /* Do not reclaim the symbols of the rule which action triggered
2328 YY_STACK_PRINT (yyss, yyssp);
2333 /*-------------------------------------------------------------.
2334 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2335 `-------------------------------------------------------------*/
2337 yyerrstatus = 3; /* Each real token shifted decrements this. */
2341 yyn = yypact[yystate];
2342 if (!yypact_value_is_default (yyn))
2345 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2353 /* Pop the current state because it cannot handle the error token. */
2358 yydestruct ("Error: popping",
2359 yystos[yystate], yyvsp);
2362 YY_STACK_PRINT (yyss, yyssp);
2368 /* Shift the error token. */
2369 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2375 /*-------------------------------------.
2376 | yyacceptlab -- YYACCEPT comes here. |
2377 `-------------------------------------*/
2382 /*-----------------------------------.
2383 | yyabortlab -- YYABORT comes here. |
2384 `-----------------------------------*/
2389 #if !defined(yyoverflow) || YYERROR_VERBOSE
2390 /*-------------------------------------------------.
2391 | yyexhaustedlab -- memory exhaustion comes here. |
2392 `-------------------------------------------------*/
2394 yyerror (YY_("memory exhausted"));
2400 if (yychar != YYEMPTY)
2402 /* Make sure we have latest lookahead translation. See comments at
2403 user semantic actions for why this is necessary. */
2404 yytoken = YYTRANSLATE (yychar);
2405 yydestruct ("Cleanup: discarding lookahead",
2408 /* Do not reclaim the symbols of the rule which action triggered
2409 this YYABORT or YYACCEPT. */
2411 YY_STACK_PRINT (yyss, yyssp);
2412 while (yyssp != yyss)
2414 yydestruct ("Cleanup: popping",
2415 yystos[*yyssp], yyvsp);
2420 YYSTACK_FREE (yyss);
2423 if (yymsg != yymsgbuf)
2424 YYSTACK_FREE (yymsg);
2426 /* Make sure YYID is used. */
2427 return YYID (yyresult);
2432 /* Line 2067 of yacc.c */
2433 #line 459 "ldscript.y"
2437 yyerror (const char *s)
2439 error (0, 0, (ld_scan_version_script
2440 ? gettext ("while reading version script '%s': %s at line %d")
2441 : gettext ("while reading linker script '%s': %s at line %d")),
2442 ldin_fname, gettext (s), ldlineno);
2446 static struct expression *
2449 struct expression *newp = (struct expression *)
2450 obstack_alloc (&ld_state.smem, sizeof (*newp));
2457 static struct input_section_name *
2458 new_input_section_name (const char *name, bool sort_flag)
2460 struct input_section_name *newp = (struct input_section_name *)
2461 obstack_alloc (&ld_state.smem, sizeof (*newp));
2464 newp->sort_flag = sort_flag;
2469 static struct input_rule *
2470 new_input_rule (int tag)
2472 struct input_rule *newp = (struct input_rule *)
2473 obstack_alloc (&ld_state.smem, sizeof (*newp));
2481 static struct output_rule *
2482 new_output_rule (int tag)
2484 struct output_rule *newp = (struct output_rule *)
2485 memset (obstack_alloc (&ld_state.smem, sizeof (*newp)),
2486 '\0', sizeof (*newp));
2494 static struct assignment *
2495 new_assignment (const char *variable, struct expression *expression,
2498 struct assignment *newp = (struct assignment *)
2499 obstack_alloc (&ld_state.smem, sizeof (*newp));
2501 newp->variable = variable;
2502 newp->expression = expression;
2504 newp->provide_flag = provide_flag;
2506 /* Insert the symbol into a hash table. We will later have to matc*/
2512 new_segment (int mode, struct output_rule *output_rule)
2514 struct output_segment *newp;
2517 = (struct output_segment *) obstack_alloc (&ld_state.smem, sizeof (*newp));
2521 newp->output_rules = output_rule->next;
2522 output_rule->next = NULL;
2524 /* Enqueue the output segment description. */
2525 if (ld_state.output_segments == NULL)
2526 ld_state.output_segments = newp;
2529 newp->next = ld_state.output_segments->next;
2530 ld_state.output_segments = ld_state.output_segments->next = newp;
2533 /* If the output file should be stripped of all symbol set the flag
2534 in the structures of all output sections. */
2535 if (mode == 0 && ld_state.strip == strip_all)
2537 struct output_rule *runp;
2539 for (runp = newp->output_rules; runp != NULL; runp = runp->next)
2540 if (runp->tag == output_section)
2541 runp->val.section.ignored = true;
2546 static struct filename_list *
2547 new_filename_listelem (const char *string)
2549 struct filename_list *newp;
2551 /* We use calloc and not the obstack since this object can be freed soon. */
2552 newp = (struct filename_list *) xcalloc (1, sizeof (*newp));
2553 newp->name = string;
2559 static struct filename_list *
2560 mark_as_needed (struct filename_list *listp)
2562 struct filename_list *runp = listp;
2565 runp->as_needed = true;
2568 while (runp != listp);
2575 add_inputfiles (struct filename_list *fnames)
2577 assert (fnames != NULL);
2579 if (ld_state.srcfiles == NULL)
2580 ld_state.srcfiles = fnames;
2583 struct filename_list *first = ld_state.srcfiles->next;
2585 ld_state.srcfiles->next = fnames->next;
2586 fnames->next = first;
2587 ld_state.srcfiles->next = fnames;
2593 special_char_p (const char *str)
2595 while (*str != '\0')
2597 if (__builtin_expect (*str == '*', 0)
2598 || __builtin_expect (*str == '?', 0)
2599 || __builtin_expect (*str == '[', 0))
2609 static struct id_list *
2610 new_id_listelem (const char *str)
2612 struct id_list *newp;
2614 newp = (struct id_list *) obstack_alloc (&ld_state.smem, sizeof (*newp));
2616 newp->u.id_type = id_all;
2617 else if (__builtin_expect (special_char_p (str), false))
2618 newp->u.id_type = id_wild;
2620 newp->u.id_type = id_str;
2628 static struct version *
2629 new_version (struct id_list *local, struct id_list *global)
2631 struct version *newp;
2633 newp = (struct version *) obstack_alloc (&ld_state.smem, sizeof (*newp));
2635 newp->local_names = local;
2636 newp->global_names = global;
2637 newp->versionname = NULL;
2638 newp->parentname = NULL;
2644 static struct version *
2645 merge_versions (struct version *one, struct version *two)
2647 assert (two->local_names == NULL || two->global_names == NULL);
2649 if (two->local_names != NULL)
2651 if (one->local_names == NULL)
2652 one->local_names = two->local_names;
2655 two->local_names->next = one->local_names->next;
2656 one->local_names = one->local_names->next = two->local_names;
2661 if (one->global_names == NULL)
2662 one->global_names = two->global_names;
2665 two->global_names->next = one->global_names->next;
2666 one->global_names = one->global_names->next = two->global_names;
2675 add_id_list (const char *versionname, struct id_list *runp, _Bool local)
2677 struct id_list *lastp = runp;
2680 /* Nothing to do. */
2683 /* Convert into a simple single-linked list. */
2685 assert (runp != NULL);
2689 if (runp->u.id_type == id_str)
2691 struct id_list *curp;
2692 struct id_list *defp;
2693 unsigned long int hval = elf_hash (runp->id);
2698 defp = ld_version_str_tab_find (&ld_state.version_str_tab, hval, curp);
2701 /* There is already a version definition for this symbol. */
2702 while (strcmp (defp->u.s.versionname, versionname) != 0)
2704 if (defp->next == NULL)
2706 /* No version like this so far. */
2708 curp->u.s.local = local;
2709 curp->u.s.versionname = versionname;
2718 if (defp != NULL && defp->u.s.local != local)
2719 error (EXIT_FAILURE, 0, versionname[0] == '\0'
2721 symbol '%s' is declared both local and global for unnamed version")
2723 symbol '%s' is declared both local and global for version '%s'"),
2724 runp->id, versionname);
2728 /* This is the first version definition for this symbol. */
2729 ld_version_str_tab_insert (&ld_state.version_str_tab, hval, curp);
2731 curp->u.s.local = local;
2732 curp->u.s.versionname = versionname;
2736 else if (runp->u.id_type == id_all)
2740 if (ld_state.default_bind_global)
2741 error (EXIT_FAILURE, 0,
2742 gettext ("default visibility set as local and global"));
2743 ld_state.default_bind_local = true;
2747 if (ld_state.default_bind_local)
2748 error (EXIT_FAILURE, 0,
2749 gettext ("default visibility set as local and global"));
2750 ld_state.default_bind_global = true;
2757 assert (runp->u.id_type == id_wild);
2761 while (runp != NULL);
2766 add_versions (struct version *versions)
2768 struct version *lastp = versions;
2770 if (versions == NULL)
2773 /* Convert into a simple single-linked list. */
2774 versions = versions->next;
2775 assert (versions != NULL);
2780 add_id_list (versions->versionname, versions->local_names, true);
2781 add_id_list (versions->versionname, versions->global_names, false);
2783 versions = versions->next;
2785 while (versions != NULL);