diff options
Diffstat (limited to 'elfutils/src/ldscript.c')
-rw-r--r-- | elfutils/src/ldscript.c | 561 |
1 files changed, 301 insertions, 260 deletions
diff --git a/elfutils/src/ldscript.c b/elfutils/src/ldscript.c index e9703b63..05a393bb 100644 --- a/elfutils/src/ldscript.c +++ b/elfutils/src/ldscript.c @@ -1,9 +1,8 @@ -/* A Bison parser, made by GNU Bison 2.4.3. */ +/* A Bison parser, made by GNU Bison 2.5. */ -/* Skeleton implementation for Bison's Yacc-like parsers in C +/* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -45,7 +44,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.4.3" +#define YYBISON_VERSION "2.5" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -74,7 +73,7 @@ /* Copy the first part of user declarations. */ -/* Line 189 of yacc.c */ +/* Line 268 of yacc.c */ #line 1 "ldscript.y" /* Parser for linker scripts. @@ -146,8 +145,8 @@ static void add_versions (struct version *versions); extern int yylex (void); -/* Line 189 of yacc.c */ -#line 151 "ldscript.c" +/* Line 268 of yacc.c */ +#line 150 "ldscript.c" /* Enabling traces. */ #ifndef YYDEBUG @@ -239,7 +238,7 @@ extern int yylex (void); typedef union YYSTYPE { -/* Line 214 of yacc.c */ +/* Line 293 of yacc.c */ #line 71 "ldscript.y" uintmax_t num; @@ -257,8 +256,8 @@ typedef union YYSTYPE -/* Line 214 of yacc.c */ -#line 262 "ldscript.c" +/* Line 293 of yacc.c */ +#line 261 "ldscript.c" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ @@ -269,8 +268,8 @@ typedef union YYSTYPE /* Copy the second part of user declarations. */ -/* Line 264 of yacc.c */ -#line 274 "ldscript.c" +/* Line 343 of yacc.c */ +#line 273 "ldscript.c" #ifdef short # undef short @@ -373,11 +372,11 @@ YYID (yyi) # define alloca _alloca # else # define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 # endif # endif # endif @@ -400,24 +399,24 @@ YYID (yyi) # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif -# if (defined __cplusplus && ! defined _STDLIB_H \ +# if (defined __cplusplus && ! defined EXIT_SUCCESS \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc -# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ +# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free -# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ +# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif @@ -446,23 +445,7 @@ union yyalloc ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) -/* Copy COUNT objects from FROM to TO. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(To, From, Count) \ - __builtin_memcpy (To, From, (Count) * sizeof (*(From))) -# else -# define YYCOPY(To, From, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (To)[yyi] = (From)[yyi]; \ - } \ - while (YYID (0)) -# endif -# endif +# define YYCOPY_NEEDED 1 /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of @@ -482,6 +465,26 @@ union yyalloc #endif +#if defined YYCOPY_NEEDED && YYCOPY_NEEDED +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define YYCOPY(To, From, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (YYID (0)) +# endif +# endif +#endif /* !YYCOPY_NEEDED */ + /* YYFINAL -- State number of the termination state. */ #define YYFINAL 32 /* YYLAST -- Last index in YYTABLE. */ @@ -650,8 +653,8 @@ static const yytype_uint8 yyr2[] = 2, 3, 2, 1, 1, 1, 1 }; -/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state - STATE-NUM when YYTABLE doesn't specify something else to do. Zero +/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ static const yytype_uint8 yydefact[] = { @@ -714,8 +717,7 @@ static const yytype_int16 yypgoto[] = /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which - number is the opposite. If zero, do what YYDEFACT says. - If YYTABLE_NINF, syntax error. */ + number is the opposite. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -1 static const yytype_uint8 yytable[] = { @@ -744,6 +746,12 @@ static const yytype_uint8 yytable[] = 0, 0, 0, 0, 81, 0, 78 }; +#define yypact_value_is_default(yystate) \ + ((yystate) == (-86)) + +#define yytable_value_is_error(yytable_value) \ + YYID (0) + static const yytype_int16 yycheck[] = { 11, 17, 18, 3, 15, 90, 17, 18, 19, 20, @@ -826,7 +834,6 @@ do \ { \ yychar = (Token); \ yylval = (Value); \ - yytoken = YYTRANSLATE (yychar); \ YYPOPSTACK (1); \ goto yybackup; \ } \ @@ -868,19 +875,10 @@ while (YYID (0)) #endif -/* YY_LOCATION_PRINT -- Print the location on the stream. - This macro was not mandated originally: define only if we know - we won't break user code: when these are the locations we know. */ +/* This macro is provided for backward compatibility. */ #ifndef YY_LOCATION_PRINT -# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL -# define YY_LOCATION_PRINT(File, Loc) \ - fprintf (File, "%d.%d-%d.%d", \ - (Loc).first_line, (Loc).first_column, \ - (Loc).last_line, (Loc).last_column) -# else -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -# endif +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) #endif @@ -1072,7 +1070,6 @@ int yydebug; # define YYMAXDEPTH 10000 #endif - #if YYERROR_VERBOSE @@ -1175,115 +1172,142 @@ yytnamerr (char *yyres, const char *yystr) } # endif -/* Copy into YYRESULT an error message about the unexpected token - YYCHAR while in state YYSTATE. Return the number of bytes copied, - including the terminating null byte. If YYRESULT is null, do not - copy anything; just return the number of bytes that would be - copied. As a special case, return 0 if an ordinary "syntax error" - message will do. Return YYSIZE_MAXIMUM if overflow occurs during - size calculation. */ -static YYSIZE_T -yysyntax_error (char *yyresult, int yystate, int yychar) -{ - int yyn = yypact[yystate]; +/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message + about the unexpected token YYTOKEN for the state stack whose top is + YYSSP. - if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) - return 0; - else + Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is + not large enough to hold the message. In that case, also set + *YYMSG_ALLOC to the required number of bytes. Return 2 if the + required number of bytes is too large to store. */ +static int +yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, + yytype_int16 *yyssp, int yytoken) +{ + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + /* Internationalized format string. */ + const char *yyformat = 0; + /* Arguments of yyformat. */ + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + /* Number of reported tokens (one for the "unexpected", one per + "expected"). */ + int yycount = 0; + + /* There are many possibilities here to consider: + - Assume YYFAIL is not used. It's too flawed to consider. See + <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html> + for details. YYERROR is fine as it does not invoke this + function. + - If this state is a consistent state with a default action, then + the only way this function was invoked is if the default action + is an error action. In that case, don't check for expected + tokens because there are none. + - The only way there can be no lookahead present (in yychar) is if + this state is a consistent state with a default action. Thus, + detecting the absence of a lookahead is sufficient to determine + that there is no unexpected or expected token to report. In that + case, just report a simple "syntax error". + - Don't assume there isn't a lookahead just because this state is a + consistent state with a default action. There might have been a + previous inconsistent state, consistent state with a non-default + action, or user semantic action that manipulated yychar. + - Of course, the expected token list depends on states to have + correct lookahead information, and it depends on the parser not + to perform extra reductions after fetching a lookahead from the + scanner and before detecting a syntax error. Thus, state merging + (from LALR or IELR) and default reductions corrupt the expected + token list. However, the list is correct for canonical LR with + one exception: it will still contain any token that will not be + accepted due to an error action in a later state. + */ + if (yytoken != YYEMPTY) { - int yytype = YYTRANSLATE (yychar); - YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); - YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; - int yysize_overflow = 0; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - int yyx; - -# if 0 - /* This is so xgettext sees the translatable formats that are - constructed on the fly. */ - YY_("syntax error, unexpected %s"); - YY_("syntax error, unexpected %s, expecting %s"); - YY_("syntax error, unexpected %s, expecting %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); -# endif - char *yyfmt; - char const *yyf; - static char const yyunexpected[] = "syntax error, unexpected %s"; - static char const yyexpecting[] = ", expecting %s"; - static char const yyor[] = " or %s"; - char yyformat[sizeof yyunexpected - + sizeof yyexpecting - 1 - + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) - * (sizeof yyor - 1))]; - char const *yyprefix = yyexpecting; - - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yycount = 1; - - yyarg[0] = yytname[yytype]; - yyfmt = yystpcpy (yyformat, yyunexpected); - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - yyformat[sizeof yyunexpected - 1] = '\0'; - break; - } - yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - yyfmt = yystpcpy (yyfmt, yyprefix); - yyprefix = yyor; - } + int yyn = yypact[*yyssp]; + yyarg[yycount++] = yytname[yytoken]; + if (!yypact_value_is_default (yyn)) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. In other words, skip the first -YYN actions for + this state because they are default actions. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yyx; + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR + && !yytable_value_is_error (yytable[yyx + yyn])) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + } + } - yyf = YY_(yyformat); - yysize1 = yysize + yystrlen (yyf); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; + switch (yycount) + { +# define YYCASE_(N, S) \ + case N: \ + yyformat = S; \ + break + YYCASE_(0, YY_("syntax error")); + YYCASE_(1, YY_("syntax error, unexpected %s")); + YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); + YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); + YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); + YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); +# undef YYCASE_ + } - if (yysize_overflow) - return YYSIZE_MAXIMUM; + yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; - if (yyresult) - { - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - char *yyp = yyresult; - int yyi = 0; - while ((*yyp = *yyf) != '\0') - { - if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyf += 2; - } - else - { - yyp++; - yyf++; - } - } - } - return yysize; + if (*yymsg_alloc < yysize) + { + *yymsg_alloc = 2 * yysize; + if (! (yysize <= *yymsg_alloc + && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) + *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; + return 1; } + + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + { + char *yyp = *yymsg; + int yyi = 0; + while ((*yyp = *yyformat) != '\0') + if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyformat += 2; + } + else + { + yyp++; + yyformat++; + } + } + return 0; } #endif /* YYERROR_VERBOSE */ - /*-----------------------------------------------. | Release the memory associated to this symbol. | @@ -1316,6 +1340,7 @@ yydestruct (yymsg, yytype, yyvaluep) } } + /* Prevent warnings from -Wmissing-prototypes. */ #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus @@ -1342,10 +1367,9 @@ YYSTYPE yylval; int yynerrs; - -/*-------------------------. -| yyparse or yypush_parse. | -`-------------------------*/ +/*----------. +| yyparse. | +`----------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ @@ -1369,8 +1393,6 @@ yyparse () #endif #endif { - - int yystate; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; @@ -1525,7 +1547,7 @@ yybackup: /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; - if (yyn == YYPACT_NINF) + if (yypact_value_is_default (yyn)) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ @@ -1556,8 +1578,8 @@ yybackup: yyn = yytable[yyn]; if (yyn <= 0) { - if (yyn == 0 || yyn == YYTABLE_NINF) - goto yyerrlab; + if (yytable_value_is_error (yyn)) + goto yyerrlab; yyn = -yyn; goto yyreduce; } @@ -1612,14 +1634,14 @@ yyreduce: { case 3: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 145 "ldscript.y" { add_versions ((yyvsp[(2) - (2)].version)); } break; case 6: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 153 "ldscript.y" { if (likely (ld_state.entry == NULL)) @@ -1629,7 +1651,7 @@ yyreduce: case 7: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 158 "ldscript.y" { ld_new_searchdir ((yyvsp[(3) - (5)].str)); @@ -1638,7 +1660,7 @@ yyreduce: case 8: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 162 "ldscript.y" { if (likely (ld_state.pagesize == 0)) @@ -1648,7 +1670,7 @@ yyreduce: case 9: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 167 "ldscript.y" { if (likely (ld_state.interp == NULL) @@ -1659,7 +1681,7 @@ yyreduce: case 10: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 173 "ldscript.y" { new_segment ((yyvsp[(2) - (5)].num), (yyvsp[(4) - (5)].output_rule)); @@ -1668,7 +1690,7 @@ yyreduce: case 11: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 177 "ldscript.y" { fputs_unlocked (gettext ("mode for segment invalid\n"), @@ -1679,7 +1701,7 @@ yyreduce: case 12: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 183 "ldscript.y" { /* First little optimization. If there is only one @@ -1695,35 +1717,35 @@ yyreduce: case 13: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 194 "ldscript.y" { add_inputfiles ((yyvsp[(3) - (4)].filename_list)); } break; case 14: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 196 "ldscript.y" { add_inputfiles (mark_as_needed ((yyvsp[(3) - (4)].filename_list))); } break; case 15: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 198 "ldscript.y" { add_versions ((yyvsp[(3) - (4)].version)); } break; case 16: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 200 "ldscript.y" { /* XXX TODO */ } break; case 17: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 204 "ldscript.y" { (yyvsp[(2) - (2)].output_rule)->next = (yyvsp[(1) - (2)].output_rule)->next; @@ -1733,14 +1755,14 @@ yyreduce: case 18: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 209 "ldscript.y" { (yyval.output_rule) = (yyvsp[(1) - (1)].output_rule); } break; case 19: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 213 "ldscript.y" { (yyval.output_rule) = new_output_rule (output_assignment); @@ -1750,7 +1772,7 @@ yyreduce: case 20: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 218 "ldscript.y" { (yyval.output_rule) = new_output_rule (output_section); @@ -1767,7 +1789,7 @@ yyreduce: case 21: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 230 "ldscript.y" { /* This is a short cut for "ID { *(ID) }". */ @@ -1794,21 +1816,21 @@ yyreduce: case 22: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 254 "ldscript.y" { (yyval.assignment) = new_assignment ((yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].expr), false); } break; case 23: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 256 "ldscript.y" { (yyval.assignment) = new_assignment ((yyvsp[(3) - (6)].str), (yyvsp[(5) - (6)].expr), true); } break; case 24: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 260 "ldscript.y" { (yyvsp[(2) - (2)].input_rule)->next = (yyvsp[(1) - (2)].input_rule)->next; @@ -1818,14 +1840,14 @@ yyreduce: case 25: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 265 "ldscript.y" { (yyval.input_rule) = (yyvsp[(1) - (1)].input_rule); } break; case 26: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 269 "ldscript.y" { (yyval.input_rule) = new_input_rule (input_section); @@ -1835,7 +1857,7 @@ yyreduce: case 27: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 274 "ldscript.y" { (yyvsp[(3) - (4)].filemask_section_name)->keep_flag = true; @@ -1847,7 +1869,7 @@ yyreduce: case 28: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 281 "ldscript.y" { (yyval.input_rule) = new_input_rule (input_assignment); @@ -1857,7 +1879,7 @@ yyreduce: case 29: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 288 "ldscript.y" { (yyval.filemask_section_name) = (struct filemask_section_name *) @@ -1871,35 +1893,35 @@ yyreduce: case 30: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 299 "ldscript.y" { (yyval.sectionname) = new_input_section_name ((yyvsp[(1) - (1)].str), false); } break; case 31: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 301 "ldscript.y" { (yyval.sectionname) = new_input_section_name ((yyvsp[(3) - (4)].str), true); } break; case 32: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 305 "ldscript.y" { (yyval.str) = (yyvsp[(3) - (4)].str); } break; case 33: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 307 "ldscript.y" { (yyval.str) = NULL; } break; case 34: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 311 "ldscript.y" { (yyval.expr) = new_expr (exp_align); @@ -1909,14 +1931,14 @@ yyreduce: case 35: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 316 "ldscript.y" { (yyval.expr) = (yyvsp[(2) - (3)].expr); } break; case 36: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 318 "ldscript.y" { (yyval.expr) = new_expr (exp_mult); @@ -1927,7 +1949,7 @@ yyreduce: case 37: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 324 "ldscript.y" { (yyval.expr) = new_expr ((yyvsp[(2) - (3)].op)); @@ -1938,7 +1960,7 @@ yyreduce: case 38: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 330 "ldscript.y" { (yyval.expr) = new_expr ((yyvsp[(2) - (3)].op)); @@ -1949,7 +1971,7 @@ yyreduce: case 39: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 336 "ldscript.y" { (yyval.expr) = new_expr (exp_and); @@ -1960,7 +1982,7 @@ yyreduce: case 40: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 342 "ldscript.y" { (yyval.expr) = new_expr (exp_or); @@ -1971,7 +1993,7 @@ yyreduce: case 41: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 348 "ldscript.y" { (yyval.expr) = new_expr (exp_num); @@ -1981,7 +2003,7 @@ yyreduce: case 42: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 353 "ldscript.y" { (yyval.expr) = new_expr (exp_id); @@ -1991,21 +2013,21 @@ yyreduce: case 43: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 358 "ldscript.y" { (yyval.expr) = new_expr (exp_sizeof_headers); } break; case 44: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 360 "ldscript.y" { (yyval.expr) = new_expr (exp_pagesize); } break; case 45: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 364 "ldscript.y" { (yyvsp[(3) - (3)].filename_list)->next = (yyvsp[(1) - (3)].filename_list)->next; @@ -2015,14 +2037,14 @@ yyreduce: case 46: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 369 "ldscript.y" { (yyval.filename_list) = (yyvsp[(1) - (1)].filename_list); } break; case 49: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 377 "ldscript.y" { /* First little optimization. If there is only one @@ -2038,21 +2060,21 @@ yyreduce: case 50: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 388 "ldscript.y" { (yyval.filename_list) = mark_as_needed ((yyvsp[(3) - (4)].filename_list)); } break; case 51: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 390 "ldscript.y" { (yyval.filename_list) = new_filename_listelem ((yyvsp[(1) - (1)].str)); } break; case 52: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 395 "ldscript.y" { (yyvsp[(2) - (2)].version)->next = (yyvsp[(1) - (2)].version)->next; @@ -2062,14 +2084,14 @@ yyreduce: case 53: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 400 "ldscript.y" { (yyval.version) = (yyvsp[(1) - (1)].version); } break; case 54: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 404 "ldscript.y" { (yyvsp[(2) - (4)].version)->versionname = ""; @@ -2080,7 +2102,7 @@ yyreduce: case 55: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 410 "ldscript.y" { (yyvsp[(3) - (5)].version)->versionname = (yyvsp[(1) - (5)].str); @@ -2091,7 +2113,7 @@ yyreduce: case 56: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 416 "ldscript.y" { (yyvsp[(3) - (6)].version)->versionname = (yyvsp[(1) - (6)].str); @@ -2102,35 +2124,35 @@ yyreduce: case 57: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 425 "ldscript.y" { (yyval.version) = merge_versions ((yyvsp[(1) - (2)].version), (yyvsp[(2) - (2)].version)); } break; case 58: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 427 "ldscript.y" { (yyval.version) = (yyvsp[(1) - (1)].version); } break; case 59: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 431 "ldscript.y" { (yyval.version) = new_version (NULL, (yyvsp[(2) - (2)].id_list)); } break; case 60: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 433 "ldscript.y" { (yyval.version) = new_version ((yyvsp[(2) - (2)].id_list), NULL); } break; case 61: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 438 "ldscript.y" { struct id_list *newp = new_id_listelem ((yyvsp[(2) - (3)].str)); @@ -2141,45 +2163,56 @@ yyreduce: case 62: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 444 "ldscript.y" { (yyval.id_list) = new_id_listelem ((yyvsp[(1) - (2)].str)); } break; case 63: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 448 "ldscript.y" { (yyval.str) = (yyvsp[(1) - (1)].str); } break; case 64: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 450 "ldscript.y" { (yyval.str) = (yyvsp[(1) - (1)].str); } break; case 65: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 454 "ldscript.y" { (yyval.str) = (yyvsp[(1) - (1)].str); } break; case 66: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 456 "ldscript.y" { (yyval.str) = NULL; } break; -/* Line 1464 of yacc.c */ -#line 2181 "ldscript.c" +/* Line 1806 of yacc.c */ +#line 2203 "ldscript.c" default: break; } + /* User semantic actions sometimes alter yychar, and that requires + that yytoken be updated with the new translation. We take the + approach of translating immediately before every use of yytoken. + One alternative is translating here after every semantic action, + but that translation would be missed if the semantic action invokes + YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or + if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an + incorrect destructor might then be invoked immediately. In the + case of YYERROR or YYBACKUP, subsequent parser actions might lead + to an incorrect destructor call or verbose syntax error message + before the lookahead is translated. */ YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); @@ -2207,6 +2240,10 @@ yyreduce: | yyerrlab -- here on detecting error | `------------------------------------*/ yyerrlab: + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); + /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { @@ -2214,37 +2251,36 @@ yyerrlab: #if ! YYERROR_VERBOSE yyerror (YY_("syntax error")); #else +# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ + yyssp, yytoken) { - YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); - if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) - { - YYSIZE_T yyalloc = 2 * yysize; - if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) - yyalloc = YYSTACK_ALLOC_MAXIMUM; - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yyalloc); - if (yymsg) - yymsg_alloc = yyalloc; - else - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - } - } - - if (0 < yysize && yysize <= yymsg_alloc) - { - (void) yysyntax_error (yymsg, yystate, yychar); - yyerror (yymsg); - } - else - { - yyerror (YY_("syntax error")); - if (yysize != 0) - goto yyexhaustedlab; - } + char const *yymsgp = YY_("syntax error"); + int yysyntax_error_status; + yysyntax_error_status = YYSYNTAX_ERROR; + if (yysyntax_error_status == 0) + yymsgp = yymsg; + else if (yysyntax_error_status == 1) + { + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); + if (!yymsg) + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + yysyntax_error_status = 2; + } + else + { + yysyntax_error_status = YYSYNTAX_ERROR; + yymsgp = yymsg; + } + } + yyerror (yymsgp); + if (yysyntax_error_status == 2) + goto yyexhaustedlab; } +# undef YYSYNTAX_ERROR #endif } @@ -2303,7 +2339,7 @@ yyerrlab1: for (;;) { yyn = yypact[yystate]; - if (yyn != YYPACT_NINF) + if (!yypact_value_is_default (yyn)) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) @@ -2362,8 +2398,13 @@ yyexhaustedlab: yyreturn: if (yychar != YYEMPTY) - yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval); + { + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = YYTRANSLATE (yychar); + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval); + } /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); @@ -2388,7 +2429,7 @@ yyreturn: -/* Line 1684 of yacc.c */ +/* Line 2067 of yacc.c */ #line 459 "ldscript.y" |