Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 6323 → Rev 6324

/contrib/toolchain/binutils/binutils/Makefile
15,7 → 15,7
 
LIBPATH:= -L$(LIB_DIR) -L/home/autobuild/tools/win32/mingw32/lib
 
LDFLAGS = -static -nostdlib --stack 12582912 -T$(SDK_DIR)/sources/newlib/app.lds --image-base 0
LDFLAGS = -static -nostdlib --stack 12582912 -T$(SDK_DIR)/sources/newlib/app.lds --image-base 0 --subsystem native
 
 
SRCS = \
/contrib/toolchain/binutils/binutils/ar.c
1,5 → 1,5
/* ar.c - Archive modify and extract.
Copyright 1991-2013 Free Software Foundation, Inc.
Copyright (C) 1991-2015 Free Software Foundation, Inc.
 
This file is part of GNU Binutils.
 
138,7 → 138,11
 
static int show_help = 0;
 
#if BFD_SUPPORTS_PLUGINS
static const char *plugin_target = "plugin";
#else
static const char *plugin_target = NULL;
#endif
 
static const char *target = NULL;
 
159,7 → 163,7
static void
mri_emul (void)
{
interactive = isatty (fileno (stdin));
interactive = 0;//isatty (fileno (stdin));
yyparse ();
}
 
571,7 → 575,6
break;
case OPTION_PLUGIN:
#if BFD_SUPPORTS_PLUGINS
plugin_target = "plugin";
bfd_plugin_set_plugin (optarg);
#else
fprintf (stderr, _("sorry - this program has been built without plugin support\n"));
632,7 → 635,6
/* PR binutils/13493: Support plugins. */
case OPTION_PLUGIN:
#if BFD_SUPPORTS_PLUGINS
plugin_target = "plugin";
bfd_plugin_set_plugin (optarg);
#else
fprintf (stderr, _("sorry - this program has been built without plugin support\n"));
689,6 → 691,7
 
program_name = argv[0];
xmalloc_set_program_name (program_name);
bfd_set_error_program_name (program_name);
#if BFD_SUPPORTS_PLUGINS
bfd_plugin_set_program_name (program_name);
#endif
737,6 → 740,7
 
if (mri_mode)
{
default_deterministic ();
mri_emul ();
}
else
1031,6 → 1035,16
bfd_size_type size;
struct stat buf;
 
/* PR binutils/17533: Do not allow directory traversal
outside of the current directory tree. */
if (! is_valid_archive_path (bfd_get_filename (abfd)))
{
non_fatal (_("illegal pathname found in archive member: %s"),
bfd_get_filename (abfd));
free (cbuf);
return;
}
 
if (bfd_stat_arch_elt (abfd, &buf) != 0)
/* xgettext:c-format */
fatal (_("internal stat error on %s"), bfd_get_filename (abfd));
/contrib/toolchain/binutils/binutils/arlex.c
560,8 → 560,7
#line 4 "arlex.l"
/* arlex.l - Strange script language lexer */
 
/* Copyright 1992, 1997, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2011
Free Software Foundation, Inc.
/* Copyright (C) 1992-2015 Free Software Foundation, Inc.
 
This file is part of GNU Binutils.
 
595,7 → 594,7
extern int yylex (void);
 
int linenumber;
#line 599 "arlex.c"
#line 598 "arlex.c"
 
#define INITIAL 0
 
775,10 → 774,10
register char *yy_cp, *yy_bp;
register int yy_act;
#line 46 "arlex.l"
#line 45 "arlex.l"
 
 
#line 782 "arlex.c"
#line 781 "arlex.c"
 
if ( !(yy_init) )
{
863,178 → 862,178
 
case 1:
YY_RULE_SETUP
#line 48 "arlex.l"
#line 47 "arlex.l"
{ return ADDLIB; }
YY_BREAK
case 2:
YY_RULE_SETUP
#line 49 "arlex.l"
#line 48 "arlex.l"
{ return ADDMOD; }
YY_BREAK
case 3:
YY_RULE_SETUP
#line 50 "arlex.l"
#line 49 "arlex.l"
{ return CLEAR; }
YY_BREAK
case 4:
YY_RULE_SETUP
#line 51 "arlex.l"
#line 50 "arlex.l"
{ return CREATE; }
YY_BREAK
case 5:
YY_RULE_SETUP
#line 52 "arlex.l"
#line 51 "arlex.l"
{ return DELETE; }
YY_BREAK
case 6:
YY_RULE_SETUP
#line 53 "arlex.l"
#line 52 "arlex.l"
{ return DIRECTORY; }
YY_BREAK
case 7:
YY_RULE_SETUP
#line 54 "arlex.l"
#line 53 "arlex.l"
{ return END; }
YY_BREAK
case 8:
YY_RULE_SETUP
#line 55 "arlex.l"
#line 54 "arlex.l"
{ return EXTRACT; }
YY_BREAK
case 9:
YY_RULE_SETUP
#line 56 "arlex.l"
#line 55 "arlex.l"
{ return FULLDIR; }
YY_BREAK
case 10:
YY_RULE_SETUP
#line 57 "arlex.l"
#line 56 "arlex.l"
{ return HELP; }
YY_BREAK
case 11:
YY_RULE_SETUP
#line 58 "arlex.l"
#line 57 "arlex.l"
{ return LIST; }
YY_BREAK
case 12:
YY_RULE_SETUP
#line 59 "arlex.l"
#line 58 "arlex.l"
{ return OPEN; }
YY_BREAK
case 13:
YY_RULE_SETUP
#line 60 "arlex.l"
#line 59 "arlex.l"
{ return REPLACE; }
YY_BREAK
case 14:
YY_RULE_SETUP
#line 61 "arlex.l"
#line 60 "arlex.l"
{ return VERBOSE; }
YY_BREAK
case 15:
YY_RULE_SETUP
#line 62 "arlex.l"
#line 61 "arlex.l"
{ return SAVE; }
YY_BREAK
case 16:
YY_RULE_SETUP
#line 63 "arlex.l"
#line 62 "arlex.l"
{ return ADDLIB; }
YY_BREAK
case 17:
YY_RULE_SETUP
#line 64 "arlex.l"
#line 63 "arlex.l"
{ return ADDMOD; }
YY_BREAK
case 18:
YY_RULE_SETUP
#line 65 "arlex.l"
#line 64 "arlex.l"
{ return CLEAR; }
YY_BREAK
case 19:
YY_RULE_SETUP
#line 66 "arlex.l"
#line 65 "arlex.l"
{ return CREATE; }
YY_BREAK
case 20:
YY_RULE_SETUP
#line 67 "arlex.l"
#line 66 "arlex.l"
{ return DELETE; }
YY_BREAK
case 21:
YY_RULE_SETUP
#line 68 "arlex.l"
#line 67 "arlex.l"
{ return DIRECTORY; }
YY_BREAK
case 22:
YY_RULE_SETUP
#line 69 "arlex.l"
#line 68 "arlex.l"
{ return END; }
YY_BREAK
case 23:
YY_RULE_SETUP
#line 70 "arlex.l"
#line 69 "arlex.l"
{ return EXTRACT; }
YY_BREAK
case 24:
YY_RULE_SETUP
#line 71 "arlex.l"
#line 70 "arlex.l"
{ return FULLDIR; }
YY_BREAK
case 25:
YY_RULE_SETUP
#line 72 "arlex.l"
#line 71 "arlex.l"
{ return HELP; }
YY_BREAK
case 26:
YY_RULE_SETUP
#line 73 "arlex.l"
#line 72 "arlex.l"
{ return LIST; }
YY_BREAK
case 27:
YY_RULE_SETUP
#line 74 "arlex.l"
#line 73 "arlex.l"
{ return OPEN; }
YY_BREAK
case 28:
YY_RULE_SETUP
#line 75 "arlex.l"
#line 74 "arlex.l"
{ return REPLACE; }
YY_BREAK
case 29:
YY_RULE_SETUP
#line 76 "arlex.l"
#line 75 "arlex.l"
{ return VERBOSE; }
YY_BREAK
case 30:
YY_RULE_SETUP
#line 77 "arlex.l"
#line 76 "arlex.l"
{ return SAVE; }
YY_BREAK
case 31:
/* rule 31 can match eol */
YY_RULE_SETUP
#line 78 "arlex.l"
#line 77 "arlex.l"
{ linenumber ++; }
YY_BREAK
case 32:
YY_RULE_SETUP
#line 79 "arlex.l"
#line 78 "arlex.l"
{ return '('; }
YY_BREAK
case 33:
YY_RULE_SETUP
#line 80 "arlex.l"
#line 79 "arlex.l"
{ return ')'; }
YY_BREAK
case 34:
YY_RULE_SETUP
#line 81 "arlex.l"
#line 80 "arlex.l"
{ return ','; }
YY_BREAK
case 35:
YY_RULE_SETUP
#line 82 "arlex.l"
#line 81 "arlex.l"
{
yylval.name = xstrdup (yytext);
return FILENAME;
1042,31 → 1041,31
YY_BREAK
case 36:
YY_RULE_SETUP
#line 86 "arlex.l"
#line 85 "arlex.l"
{ }
YY_BREAK
case 37:
YY_RULE_SETUP
#line 87 "arlex.l"
#line 86 "arlex.l"
{ }
YY_BREAK
case 38:
YY_RULE_SETUP
#line 88 "arlex.l"
#line 87 "arlex.l"
{ }
YY_BREAK
case 39:
/* rule 39 can match eol */
YY_RULE_SETUP
#line 89 "arlex.l"
#line 88 "arlex.l"
{ linenumber ++; return NEWLINE; }
YY_BREAK
case 40:
YY_RULE_SETUP
#line 91 "arlex.l"
#line 90 "arlex.l"
ECHO;
YY_BREAK
#line 1070 "arlex.c"
#line 1069 "arlex.c"
case YY_STATE_EOF(INITIAL):
yyterminate();
 
2026,7 → 2025,7
 
#define YYTABLES_NAME "yytables"
 
#line 91 "arlex.l"
#line 90 "arlex.l"
 
 
#ifndef yywrap
/contrib/toolchain/binutils/binutils/arparse.c
1,14 → 1,13
/* A Bison parser, made by GNU Bison 2.3. */
/* A Bison parser, made by GNU Bison 3.0. */
 
/* 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
Free Software Foundation, Inc.
Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
 
This program is free software; you can redistribute it and/or modify
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
the Free Software Foundation; either version 2, or (at your option)
any later version.
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
16,9 → 15,7
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
along with this program. If not, see <http://www.gnu.org/licenses/>. */
 
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
47,7 → 44,7
#define YYBISON 1
 
/* Bison version. */
#define YYBISON_VERSION "2.3"
#define YYBISON_VERSION "3.0"
 
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
55,67 → 52,21
/* Pure parsers. */
#define YYPURE 0
 
/* Using locations. */
#define YYLSP_NEEDED 0
/* Push parsers. */
#define YYPUSH 0
 
/* Pull parsers. */
#define YYPULL 1
 
 
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
NEWLINE = 258,
VERBOSE = 259,
FILENAME = 260,
ADDLIB = 261,
LIST = 262,
ADDMOD = 263,
CLEAR = 264,
CREATE = 265,
DELETE = 266,
DIRECTORY = 267,
END = 268,
EXTRACT = 269,
FULLDIR = 270,
HELP = 271,
QUIT = 272,
REPLACE = 273,
SAVE = 274,
OPEN = 275
};
#endif
/* Tokens. */
#define NEWLINE 258
#define VERBOSE 259
#define FILENAME 260
#define ADDLIB 261
#define LIST 262
#define ADDMOD 263
#define CLEAR 264
#define CREATE 265
#define DELETE 266
#define DIRECTORY 267
#define END 268
#define EXTRACT 269
#define FULLDIR 270
#define HELP 271
#define QUIT 272
#define REPLACE 273
#define SAVE 274
#define OPEN 275
 
 
 
 
/* Copy the first part of user declarations. */
#line 1 "arparse.y"
#line 1 "arparse.y" /* yacc.c:339 */
 
/* arparse.y - Stange script language parser */
 
/* Copyright 1992, 1993, 1995, 1997, 1999, 2002, 2003, 2005, 2007
Free Software Foundation, Inc.
/* Copyright (C) 1992-2015 Free Software Foundation, Inc.
 
This file is part of GNU Binutils.
 
147,11 → 98,15
extern int yylex (void);
static int yyerror (const char *);
 
#line 102 "arparse.c" /* yacc.c:339 */
 
/* Enabling traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
# ifndef YY_NULL
# if defined __cplusplus && 201103L <= __cplusplus
# define YY_NULL nullptr
# else
# define YY_NULL 0
#endif
# endif
 
/* Enabling verbose error messages. */
#ifdef YYERROR_VERBOSE
161,35 → 116,91
# define YYERROR_VERBOSE 0
#endif
 
/* Enabling the token table. */
#ifndef YYTOKEN_TABLE
# define YYTOKEN_TABLE 0
/* In a future release of Bison, this section will be replaced
by #include "y.tab.h". */
#ifndef YY_YY_ARPARSE_H_INCLUDED
# define YY_YY_ARPARSE_H_INCLUDED
/* Debug traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
#if YYDEBUG
extern int yydebug;
#endif
 
/* Token type. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
enum yytokentype
{
NEWLINE = 258,
VERBOSE = 259,
FILENAME = 260,
ADDLIB = 261,
LIST = 262,
ADDMOD = 263,
CLEAR = 264,
CREATE = 265,
DELETE = 266,
DIRECTORY = 267,
END = 268,
EXTRACT = 269,
FULLDIR = 270,
HELP = 271,
QUIT = 272,
REPLACE = 273,
SAVE = 274,
OPEN = 275
};
#endif
/* Tokens. */
#define NEWLINE 258
#define VERBOSE 259
#define FILENAME 260
#define ADDLIB 261
#define LIST 262
#define ADDMOD 263
#define CLEAR 264
#define CREATE 265
#define DELETE 266
#define DIRECTORY 267
#define END 268
#define EXTRACT 269
#define FULLDIR 270
#define HELP 271
#define QUIT 272
#define REPLACE 273
#define SAVE 274
#define OPEN 275
 
/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
#line 38 "arparse.y"
typedef union YYSTYPE YYSTYPE;
union YYSTYPE
{
#line 37 "arparse.y" /* yacc.c:355 */
 
char *name;
struct list *list ;
 
}
/* Line 193 of yacc.c. */
#line 179 "arparse.c"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
 
#line 188 "arparse.c" /* yacc.c:355 */
};
# define YYSTYPE_IS_TRIVIAL 1
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
#endif
 
 
extern YYSTYPE yylval;
 
int yyparse (void);
 
#endif /* !YY_YY_ARPARSE_H_INCLUDED */
 
/* Copy the second part of user declarations. */
 
#line 203 "arparse.c" /* yacc.c:358 */
 
/* Line 216 of yacc.c. */
#line 192 "arparse.c"
 
#ifdef short
# undef short
#endif
202,11 → 213,8
 
#ifdef YYTYPE_INT8
typedef YYTYPE_INT8 yytype_int8;
#elif (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
#else
typedef signed char yytype_int8;
#else
typedef short int yytype_int8;
#endif
 
#ifdef YYTYPE_UINT16
226,8 → 234,7
# define YYSIZE_T __SIZE_TYPE__
# elif defined size_t
# define YYSIZE_T size_t
# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
# elif ! defined YYSIZE_T
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
# define YYSIZE_T size_t
# else
241,39 → 248,49
# if defined YYENABLE_NLS && YYENABLE_NLS
# if ENABLE_NLS
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
# define YY_(msgid) dgettext ("bison-runtime", msgid)
# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
# endif
# endif
# ifndef YY_
# define YY_(msgid) msgid
# define YY_(Msgid) Msgid
# endif
#endif
 
#ifndef __attribute__
/* This feature is available in gcc versions 2.5 and later. */
# if (! defined __GNUC__ || __GNUC__ < 2 \
|| (__GNUC__ == 2 && __GNUC_MINOR__ < 5))
# define __attribute__(Spec) /* empty */
# endif
#endif
 
/* Suppress unused-variable warnings by "using" E. */
#if ! defined lint || defined __GNUC__
# define YYUSE(e) ((void) (e))
# define YYUSE(E) ((void) (E))
#else
# define YYUSE(e) /* empty */
# define YYUSE(E) /* empty */
#endif
 
/* Identity function, used to suppress warnings about constant conditions. */
#ifndef lint
# define YYID(n) (n)
#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
/* Suppress an incorrect diagnostic about yylval being uninitialized. */
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
_Pragma ("GCC diagnostic push") \
_Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
_Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
_Pragma ("GCC diagnostic pop")
#else
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static int
YYID (int i)
#else
static int
YYID (i)
int i;
# define YY_INITIAL_VALUE(Value) Value
#endif
{
return i;
}
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_END
#endif
#ifndef YY_INITIAL_VALUE
# define YY_INITIAL_VALUE(Value) /* Nothing. */
#endif
 
 
#if ! defined yyoverflow || YYERROR_VERBOSE
 
/* The parser invokes alloca or malloc; define the necessary symbols. */
291,11 → 308,11
# define alloca _alloca
# else
# define YYSTACK_ALLOC alloca
# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
# ifndef _STDLIB_H
# define _STDLIB_H 1
/* Use EXIT_SUCCESS as a witness for stdlib.h. */
# ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
# endif
# endif
# endif
303,8 → 320,8
# endif
 
# ifdef YYSTACK_ALLOC
/* Pacify GCC's `empty if-body' warning. */
# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
/* Pacify GCC's 'empty if-body' warning. */
# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
# ifndef YYSTACK_ALLOC_MAXIMUM
/* The OS might guarantee only one guard page at the bottom of the stack,
and a page size can be as small as 4096 bytes. So we cannot safely
318,25 → 335,23
# 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__ \
|| defined __cplusplus || defined _MSC_VER)
# if ! defined malloc && ! defined EXIT_SUCCESS
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__ \
|| defined __cplusplus || defined _MSC_VER)
# if ! defined free && ! defined EXIT_SUCCESS
void free (void *); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
351,8 → 366,8
/* A type that is properly aligned for any stack member. */
union yyalloc
{
yytype_int16 yyss;
YYSTYPE yyvs;
yytype_int16 yyss_alloc;
YYSTYPE yyvs_alloc;
};
 
/* The size of the maximum gap between one aligned stack and the next. */
364,23 → 379,7
((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
387,19 → 386,39
elements in the stack, and YYPTR gives the new location of the
stack. Advance YYPTR to a properly aligned location for the next
stack. */
# define YYSTACK_RELOCATE(Stack) \
# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
do \
{ \
YYSIZE_T yynewbytes; \
YYCOPY (&yyptr->Stack, Stack, yysize); \
Stack = &yyptr->Stack; \
YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
Stack = &yyptr->Stack_alloc; \
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
yyptr += yynewbytes / sizeof (*yyptr); \
} \
while (YYID (0))
while (0)
 
#endif
 
#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
/* Copy COUNT objects from SRC to DST. The source and destination do
not overlap. */
# ifndef YYCOPY
# if defined __GNUC__ && 1 < __GNUC__
# define YYCOPY(Dst, Src, Count) \
__builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
# else
# define YYCOPY(Dst, Src, Count) \
do \
{ \
YYSIZE_T yyi; \
for (yyi = 0; yyi < (Count); yyi++) \
(Dst)[yyi] = (Src)[yyi]; \
} \
while (0)
# endif
# endif
#endif /* !YYCOPY_NEEDED */
 
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 3
/* YYLAST -- Last index in YYTABLE. */
411,10 → 430,11
#define YYNNTS 22
/* YYNRULES -- Number of rules. */
#define YYNRULES 42
/* YYNRULES -- Number of states. */
/* YYNSTATES -- Number of states. */
#define YYNSTATES 53
 
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
by yylex, with out-of-bounds checking. */
#define YYUNDEFTOK 2
#define YYMAXUTOK 275
 
421,7 → 441,8
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
 
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
as returned by yylex, without out-of-bounds checking. */
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
455,44 → 476,18
};
 
#if YYDEBUG
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
YYRHS. */
static const yytype_uint8 yyprhs[] =
{
0, 0, 3, 4, 7, 10, 11, 14, 16, 18,
20, 22, 24, 26, 28, 30, 32, 34, 36, 38,
40, 42, 44, 45, 48, 51, 53, 56, 59, 61,
63, 66, 69, 73, 78, 80, 81, 85, 86, 90,
91, 93, 94
};
 
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
25, 0, -1, -1, 26, 27, -1, 27, 28, -1,
-1, 29, 3, -1, 37, -1, 38, -1, 45, -1,
40, -1, 39, -1, 32, -1, 34, -1, 36, -1,
30, -1, 31, -1, 33, -1, 35, -1, 13, -1,
1, -1, 5, -1, -1, 14, 43, -1, 18, 43,
-1, 9, -1, 11, 43, -1, 8, 43, -1, 7,
-1, 19, -1, 20, 5, -1, 10, 5, -1, 6,
5, 42, -1, 12, 5, 42, 41, -1, 5, -1,
-1, 21, 43, 22, -1, -1, 43, 44, 5, -1,
-1, 23, -1, -1, 4, -1
};
 
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const yytype_uint8 yyrline[] =
{
0, 69, 69, 69, 73, 74, 78, 82, 83, 84,
85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
95, 96, 97, 102, 107, 112, 117, 121, 126, 131,
138, 143, 149, 153, 160, 162, 166, 169, 173, 179,
184, 185, 190
0, 68, 68, 68, 72, 73, 77, 81, 82, 83,
84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
94, 95, 96, 101, 106, 111, 116, 120, 125, 130,
137, 142, 148, 152, 159, 161, 165, 168, 172, 178,
183, 184, 189
};
#endif
 
#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
#if YYDEBUG || YYERROR_VERBOSE || 0
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
500,18 → 495,18
"$end", "error", "$undefined", "NEWLINE", "VERBOSE", "FILENAME",
"ADDLIB", "LIST", "ADDMOD", "CLEAR", "CREATE", "DELETE", "DIRECTORY",
"END", "EXTRACT", "FULLDIR", "HELP", "QUIT", "REPLACE", "SAVE", "OPEN",
"'('", "')'", "','", "$accept", "start", "@1", "session", "command_line",
"command", "extract_command", "replace_command", "clear_command",
"delete_command", "addmod_command", "list_command", "save_command",
"open_command", "create_command", "addlib_command", "directory_command",
"optional_filename", "modulelist", "modulename", "optcomma",
"verbose_command", 0
"'('", "')'", "','", "$accept", "start", "$@1", "session",
"command_line", "command", "extract_command", "replace_command",
"clear_command", "delete_command", "addmod_command", "list_command",
"save_command", "open_command", "create_command", "addlib_command",
"directory_command", "optional_filename", "modulelist", "modulename",
"optcomma", "verbose_command", YY_NULL
};
#endif
 
# ifdef YYPRINT
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
token YYLEX-NUM. */
/* YYTOKNUM[NUM] -- (External) token number corresponding to the
(internal) symbol number NUM (which must be that of a token). */
static const yytype_uint16 yytoknum[] =
{
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
520,50 → 515,18
};
# endif
 
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
0, 24, 26, 25, 27, 27, 28, 29, 29, 29,
29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
29, 29, 29, 30, 31, 32, 33, 34, 35, 36,
37, 38, 39, 40, 41, 41, 42, 42, 43, 43,
44, 44, 45
};
#define YYPACT_NINF -14
 
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const yytype_uint8 yyr2[] =
{
0, 2, 0, 2, 2, 0, 2, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 0, 2, 2, 1, 2, 2, 1, 1,
2, 2, 3, 4, 1, 0, 3, 0, 3, 0,
1, 0, 1
};
#define yypact_value_is_default(Yystate) \
(!!((Yystate) == (-14)))
 
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
STATE-NUM when YYTABLE doesn't specify something else to do. Zero
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
2, 0, 5, 1, 0, 20, 42, 21, 0, 28,
39, 25, 0, 39, 0, 19, 39, 39, 29, 0,
4, 0, 15, 16, 12, 17, 13, 18, 14, 7,
8, 11, 10, 9, 37, 27, 31, 26, 37, 23,
24, 30, 6, 39, 32, 40, 0, 35, 41, 38,
34, 33, 36
};
#define YYTABLE_NINF -42
 
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] =
{
-1, 1, 2, 4, 20, 21, 22, 23, 24, 25,
26, 27, 28, 29, 30, 31, 32, 51, 44, 35,
46, 33
};
#define yytable_value_is_error(Yytable_value) \
0
 
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
#define YYPACT_NINF -14
static const yytype_int8 yypact[] =
{
-14, 1, -14, -14, 5, -14, -14, -14, 2, -14,
574,6 → 537,19
-14, -14, -14
};
 
/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
Performed when YYTABLE does not specify something else to do. Zero
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
2, 0, 5, 1, 0, 20, 42, 21, 0, 28,
39, 25, 0, 39, 0, 19, 39, 39, 29, 0,
4, 0, 15, 16, 12, 17, 13, 18, 14, 7,
8, 11, 10, 9, 37, 27, 31, 26, 37, 23,
24, 30, 6, 39, 32, 40, 0, 35, 41, 38,
34, 33, 36
};
 
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
582,11 → 558,17
-14, -14
};
 
/* 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. */
#define YYTABLE_NINF -42
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] =
{
-1, 1, 2, 4, 20, 21, 22, 23, 24, 25,
26, 27, 28, 29, 30, 31, 32, 51, 44, 35,
46, 33
};
 
/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
positive, shift that token. If negative, reduce the rule whose
number is the opposite. If YYTABLE_NINF, syntax error. */
static const yytype_int8 yytable[] =
{
37, 3, -41, 39, 40, -3, 5, 34, -22, 6,
615,6 → 597,27
5, 41, 22
};
 
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
0, 24, 26, 25, 27, 27, 28, 29, 29, 29,
29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
29, 29, 29, 30, 31, 32, 33, 34, 35, 36,
37, 38, 39, 40, 41, 41, 42, 42, 43, 43,
44, 44, 45
};
 
/* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
static const yytype_uint8 yyr2[] =
{
0, 2, 0, 2, 2, 0, 2, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 0, 2, 2, 1, 2, 2, 1, 1,
2, 2, 3, 4, 1, 0, 3, 0, 3, 0,
1, 0, 1
};
 
 
#define yyerrok (yyerrstatus = 0)
#define yyclearin (yychar = YYEMPTY)
#define YYEMPTY (-2)
625,22 → 628,16
#define YYERROR goto yyerrorlab
 
 
/* Like YYERROR except do call yyerror. This remains here temporarily
to ease the transition to the new meaning of YYERROR, for GCC.
Once GCC version 2 has supplanted version 1, this can go. */
 
#define YYFAIL goto yyerrlab
 
#define YYRECOVERING() (!!yyerrstatus)
 
#define YYBACKUP(Token, Value) \
do \
if (yychar == YYEMPTY && yylen == 1) \
if (yychar == YYEMPTY) \
{ \
yychar = (Token); \
yylval = (Value); \
yytoken = YYTRANSLATE (yychar); \
YYPOPSTACK (1); \
YYPOPSTACK (yylen); \
yystate = *yyssp; \
goto yybackup; \
} \
else \
648,63 → 645,14
yyerror (YY_("syntax error: cannot back up")); \
YYERROR; \
} \
while (YYID (0))
while (0)
 
 
/* Error token number */
#define YYTERROR 1
#define YYERRCODE 256
 
 
/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
If N is 0, then set CURRENT to the empty location which ends
the previous symbol: RHS[0] (always defined). */
 
#define YYRHSLOC(Rhs, K) ((Rhs)[K])
#ifndef YYLLOC_DEFAULT
# define YYLLOC_DEFAULT(Current, Rhs, N) \
do \
if (YYID (N)) \
{ \
(Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
(Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
(Current).last_line = YYRHSLOC (Rhs, N).last_line; \
(Current).last_column = YYRHSLOC (Rhs, N).last_column; \
} \
else \
{ \
(Current).first_line = (Current).last_line = \
YYRHSLOC (Rhs, 0).last_line; \
(Current).first_column = (Current).last_column = \
YYRHSLOC (Rhs, 0).last_column; \
} \
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. */
 
#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
#endif
 
 
/* YYLEX -- calling `yylex' with the right arguments. */
 
#ifdef YYLEX_PARAM
# define YYLEX yylex (YYLEX_PARAM)
#else
# define YYLEX yylex ()
#endif
 
/* Enable debugging if requested. */
#if YYDEBUG
 
717,8 → 665,14
do { \
if (yydebug) \
YYFPRINTF Args; \
} while (YYID (0))
} while (0)
 
/* This macro is provided for backward compatibility. */
#ifndef YY_LOCATION_PRINT
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
#endif
 
 
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
do { \
if (yydebug) \
728,40 → 682,26
Type, Value); \
YYFPRINTF (stderr, "\n"); \
} \
} while (YYID (0))
} while (0)
 
 
/*--------------------------------.
| Print this symbol on YYOUTPUT. |
`--------------------------------*/
/*----------------------------------------.
| Print this symbol's value on YYOUTPUT. |
`----------------------------------------*/
 
/*ARGSUSED*/
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static void
yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
#else
static void
yy_symbol_value_print (yyoutput, yytype, yyvaluep)
FILE *yyoutput;
int yytype;
YYSTYPE const * const yyvaluep;
#endif
{
FILE *yyo = yyoutput;
YYUSE (yyo);
if (!yyvaluep)
return;
# ifdef YYPRINT
if (yytype < YYNTOKENS)
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
# else
YYUSE (yyoutput);
# endif
switch (yytype)
{
default:
break;
YYUSE (yytype);
}
}
 
 
/*--------------------------------.
768,22 → 708,11
| Print this symbol on YYOUTPUT. |
`--------------------------------*/
 
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static void
yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
#else
static void
yy_symbol_print (yyoutput, yytype, yyvaluep)
FILE *yyoutput;
int yytype;
YYSTYPE const * const yyvaluep;
#endif
{
if (yytype < YYNTOKENS)
YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
else
YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
YYFPRINTF (yyoutput, "%s %s (",
yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
 
yy_symbol_value_print (yyoutput, yytype, yyvaluep);
YYFPRINTF (yyoutput, ")");
794,20 → 723,15
| TOP (included). |
`------------------------------------------------------------------*/
 
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static void
yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
#else
static void
yy_stack_print (bottom, top)
yytype_int16 *bottom;
yytype_int16 *top;
#endif
yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
{
YYFPRINTF (stderr, "Stack now");
for (; bottom <= top; ++bottom)
YYFPRINTF (stderr, " %d", *bottom);
for (; yybottom <= yytop; yybottom++)
{
int yybot = *yybottom;
YYFPRINTF (stderr, " %d", yybot);
}
YYFPRINTF (stderr, "\n");
}
 
815,7 → 739,7
do { \
if (yydebug) \
yy_stack_print ((Bottom), (Top)); \
} while (YYID (0))
} while (0)
 
 
/*------------------------------------------------.
822,30 → 746,23
| Report that the YYRULE is going to be reduced. |
`------------------------------------------------*/
 
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static void
yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
#else
static void
yy_reduce_print (yyvsp, yyrule)
YYSTYPE *yyvsp;
int yyrule;
#endif
yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
{
unsigned long int yylno = yyrline[yyrule];
int yynrhs = yyr2[yyrule];
int yyi;
unsigned long int yylno = yyrline[yyrule];
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
yyrule - 1, yylno);
/* The symbols being reduced. */
for (yyi = 0; yyi < yynrhs; yyi++)
{
fprintf (stderr, " $%d = ", yyi + 1);
yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
YYFPRINTF (stderr, " $%d = ", yyi + 1);
yy_symbol_print (stderr,
yystos[yyssp[yyi + 1 - yynrhs]],
&(yyvsp[(yyi + 1) - (yynrhs)])
);
fprintf (stderr, "\n");
YYFPRINTF (stderr, "\n");
}
}
 
852,8 → 769,8
# define YY_REDUCE_PRINT(Rule) \
do { \
if (yydebug) \
yy_reduce_print (yyvsp, Rule); \
} while (YYID (0))
yy_reduce_print (yyssp, yyvsp, Rule); \
} while (0)
 
/* Nonzero means print parse trace. It is left uninitialized so that
multiple parsers can coexist. */
883,7 → 800,6
#endif
 
 
#if YYERROR_VERBOSE
 
# ifndef yystrlen
891,15 → 807,8
# define yystrlen strlen
# else
/* Return the length of YYSTR. */
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static YYSIZE_T
yystrlen (const char *yystr)
#else
static YYSIZE_T
yystrlen (yystr)
const char *yystr;
#endif
{
YYSIZE_T yylen;
for (yylen = 0; yystr[yylen]; yylen++)
915,16 → 824,8
# else
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
YYDEST. */
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static char *
yystpcpy (char *yydest, const char *yysrc)
#else
static char *
yystpcpy (yydest, yysrc)
char *yydest;
const char *yysrc;
#endif
{
char *yyd = yydest;
const char *yys = yysrc;
985,251 → 886,226
}
# 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)
{
int yytype = YYTRANSLATE (yychar);
YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
YYSIZE_T yysize = yysize0;
YYSIZE_T yysize1;
int yysize_overflow = 0;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
/* Internationalized format string. */
const char *yyformat = YY_NULL;
/* Arguments of yyformat. */
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
int yyx;
/* Number of reported tokens (one for the "unexpected", one per
"expected"). */
int yycount = 0;
 
# 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;
 
/* There are many possibilities here to consider:
- 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 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. */
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 yycount = 1;
int yyx;
 
yyarg[0] = yytname[yytype];
yyfmt = yystpcpy (yyformat, yyunexpected);
 
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
&& !yytable_value_is_error (yytable[yyx + yyn]))
{
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_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
if (! (yysize <= yysize1
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2;
yysize = yysize1;
yyfmt = yystpcpy (yyfmt, yyprefix);
yyprefix = yyor;
}
}
}
}
 
yyf = YY_(yyformat);
yysize1 = yysize + yystrlen (yyf);
yysize_overflow |= (yysize1 < yysize);
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_
}
 
{
YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2;
yysize = yysize1;
}
 
if (yysize_overflow)
return YYSIZE_MAXIMUM;
if (*yymsg_alloc < yysize)
{
*yymsg_alloc = 2 * yysize;
if (! (yysize <= *yymsg_alloc
&& *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
*yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
return 1;
}
 
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;
{
char *yyp = *yymsg;
int yyi = 0;
while ((*yyp = *yyf) != '\0')
while ((*yyp = *yyformat) != '\0')
if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
{
if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
{
yyp += yytnamerr (yyp, yyarg[yyi++]);
yyf += 2;
yyformat += 2;
}
else
{
yyp++;
yyf++;
yyformat++;
}
}
return 0;
}
return yysize;
}
}
#endif /* YYERROR_VERBOSE */
 
/*-----------------------------------------------.
| Release the memory associated to this symbol. |
`-----------------------------------------------*/
 
/*ARGSUSED*/
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static void
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
#else
static void
yydestruct (yymsg, yytype, yyvaluep)
const char *yymsg;
int yytype;
YYSTYPE *yyvaluep;
#endif
{
YYUSE (yyvaluep);
 
if (!yymsg)
yymsg = "Deleting";
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
 
switch (yytype)
{
 
default:
break;
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
YYUSE (yytype);
YY_IGNORE_MAYBE_UNINITIALIZED_END
}
}
 
/* Prevent warnings from -Wmissing-prototypes. */
 
#ifdef YYPARSE_PARAM
#if defined __STDC__ || defined __cplusplus
int yyparse (void *YYPARSE_PARAM);
#else
int yyparse ();
#endif
#else /* ! YYPARSE_PARAM */
#if defined __STDC__ || defined __cplusplus
int yyparse (void);
#else
int yyparse ();
#endif
#endif /* ! YYPARSE_PARAM */
 
 
 
/* The look-ahead symbol. */
/* The lookahead symbol. */
int yychar;
 
/* The semantic value of the look-ahead symbol. */
/* The semantic value of the lookahead symbol. */
YYSTYPE yylval;
 
/* Number of syntax errors so far. */
int yynerrs;
 
 
 
/*----------.
| yyparse. |
`----------*/
 
#ifdef YYPARSE_PARAM
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
int
yyparse (void *YYPARSE_PARAM)
#else
int
yyparse (YYPARSE_PARAM)
void *YYPARSE_PARAM;
#endif
#else /* ! YYPARSE_PARAM */
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
int
yyparse (void)
#else
int
yyparse ()
 
#endif
#endif
{
int yystate;
int yyn;
int yyresult;
/* Number of tokens to shift before error messages enabled. */
int yyerrstatus;
/* Look-ahead token as an internal (translated) token number. */
int yytoken = 0;
#if YYERROR_VERBOSE
/* Buffer for error messages, and its allocated size. */
char yymsgbuf[128];
char *yymsg = yymsgbuf;
YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
#endif
 
/* Three stacks and their tools:
`yyss': related to states,
`yyvs': related to semantic values,
`yyls': related to locations.
/* The stacks and their tools:
'yyss': related to states.
'yyvs': related to semantic values.
 
Refer to the stacks thru separate pointers, to allow yyoverflow
Refer to the stacks through separate pointers, to allow yyoverflow
to reallocate them elsewhere. */
 
/* The state stack. */
yytype_int16 yyssa[YYINITDEPTH];
yytype_int16 *yyss = yyssa;
yytype_int16 *yyss;
yytype_int16 *yyssp;
 
/* The semantic value stack. */
YYSTYPE yyvsa[YYINITDEPTH];
YYSTYPE *yyvs = yyvsa;
YYSTYPE *yyvs;
YYSTYPE *yyvsp;
 
YYSIZE_T yystacksize;
 
 
#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
 
YYSIZE_T yystacksize = YYINITDEPTH;
 
int yyn;
int yyresult;
/* Lookahead token as an internal (translated) token number. */
int yytoken = 0;
/* The variables used to return semantic value and location from the
action routines. */
YYSTYPE yyval;
 
#if YYERROR_VERBOSE
/* Buffer for error messages, and its allocated size. */
char yymsgbuf[128];
char *yymsg = yymsgbuf;
YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
#endif
 
#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
 
/* The number of symbols on the RHS of the reduced rule.
Keep to zero when no symbol should be popped. */
int yylen = 0;
 
yyssp = yyss = yyssa;
yyvsp = yyvs = yyvsa;
yystacksize = YYINITDEPTH;
 
YYDPRINTF ((stderr, "Starting parse\n"));
 
yystate = 0;
1236,15 → 1112,6
yyerrstatus = 0;
yynerrs = 0;
yychar = YYEMPTY; /* Cause a token to be read. */
 
/* Initialize stack pointers.
Waste one element of value and location stack
so that they stay on the same level as the state stack.
The wasted elements are never initialized. */
 
yyssp = yyss;
yyvsp = yyvs;
 
goto yysetstate;
 
/*------------------------------------------------------------.
1271,7 → 1138,6
YYSTYPE *yyvs1 = yyvs;
yytype_int16 *yyss1 = yyss;
 
 
/* Each stack pointer address is followed by the size of the
data in use in that stack, in bytes. This used to be a
conditional around just the two extra args, but that might
1279,7 → 1145,6
yyoverflow (YY_("memory exhausted"),
&yyss1, yysize * sizeof (*yyssp),
&yyvs1, yysize * sizeof (*yyvsp),
 
&yystacksize);
 
yyss = yyss1;
1302,9 → 1167,8
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
if (! yyptr)
goto yyexhaustedlab;
YYSTACK_RELOCATE (yyss);
YYSTACK_RELOCATE (yyvs);
 
YYSTACK_RELOCATE (yyss_alloc, yyss);
YYSTACK_RELOCATE (yyvs_alloc, yyvs);
# undef YYSTACK_RELOCATE
if (yyss1 != yyssa)
YYSTACK_FREE (yyss1);
1315,7 → 1179,6
yyssp = yyss + yysize - 1;
yyvsp = yyvs + yysize - 1;
 
 
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
(unsigned long int) yystacksize));
 
1325,6 → 1188,9
 
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
 
if (yystate == YYFINAL)
YYACCEPT;
 
goto yybackup;
 
/*-----------.
1333,20 → 1199,20
yybackup:
 
/* Do appropriate processing given the current state. Read a
look-ahead token if we need one and don't already have one. */
lookahead token if we need one and don't already have one. */
 
/* First try to decide what to do without reference to look-ahead token. */
/* 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 look-ahead token if don't already have one. */
/* Not known => get a lookahead token if don't already have one. */
 
/* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
/* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
if (yychar == YYEMPTY)
{
YYDPRINTF ((stderr, "Reading a token: "));
yychar = YYLEX;
yychar = yylex ();
}
 
if (yychar <= YYEOF)
1368,29 → 1234,27
yyn = yytable[yyn];
if (yyn <= 0)
{
if (yyn == 0 || yyn == YYTABLE_NINF)
if (yytable_value_is_error (yyn))
goto yyerrlab;
yyn = -yyn;
goto yyreduce;
}
 
if (yyn == YYFINAL)
YYACCEPT;
 
/* Count tokens shifted since error; after three, turn off error
status. */
if (yyerrstatus)
yyerrstatus--;
 
/* Shift the look-ahead token. */
/* Shift the lookahead token. */
YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
 
/* Discard the shifted token unless it is eof. */
if (yychar != YYEOF)
/* Discard the shifted token. */
yychar = YYEMPTY;
 
yystate = yyn;
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
*++yyvsp = yylval;
YY_IGNORE_MAYBE_UNINITIALIZED_END
 
goto yynewstate;
 
1413,7 → 1277,7
yylen = yyr2[yyn];
 
/* If YYLEN is nonzero, implement the default value of the action:
`$$ = $1'.
'$$ = $1'.
 
Otherwise, the following line sets YYVAL to garbage.
This behavior is undocumented and Bison
1427,124 → 1291,156
switch (yyn)
{
case 2:
#line 69 "arparse.y"
#line 68 "arparse.y" /* yacc.c:1661 */
{ prompt(); }
#line 1297 "arparse.c" /* yacc.c:1661 */
break;
 
case 6:
#line 78 "arparse.y"
#line 77 "arparse.y" /* yacc.c:1661 */
{ prompt(); }
#line 1303 "arparse.c" /* yacc.c:1661 */
break;
 
case 19:
#line 94 "arparse.y"
#line 93 "arparse.y" /* yacc.c:1661 */
{ ar_end(); return 0; }
#line 1309 "arparse.c" /* yacc.c:1661 */
break;
 
case 21:
#line 96 "arparse.y"
#line 95 "arparse.y" /* yacc.c:1661 */
{ yyerror("foo"); }
#line 1315 "arparse.c" /* yacc.c:1661 */
break;
 
case 23:
#line 103 "arparse.y"
{ ar_extract((yyvsp[(2) - (2)].list)); }
#line 102 "arparse.y" /* yacc.c:1661 */
{ ar_extract((yyvsp[0].list)); }
#line 1321 "arparse.c" /* yacc.c:1661 */
break;
 
case 24:
#line 108 "arparse.y"
{ ar_replace((yyvsp[(2) - (2)].list)); }
#line 107 "arparse.y" /* yacc.c:1661 */
{ ar_replace((yyvsp[0].list)); }
#line 1327 "arparse.c" /* yacc.c:1661 */
break;
 
case 25:
#line 113 "arparse.y"
#line 112 "arparse.y" /* yacc.c:1661 */
{ ar_clear(); }
#line 1333 "arparse.c" /* yacc.c:1661 */
break;
 
case 26:
#line 118 "arparse.y"
{ ar_delete((yyvsp[(2) - (2)].list)); }
#line 117 "arparse.y" /* yacc.c:1661 */
{ ar_delete((yyvsp[0].list)); }
#line 1339 "arparse.c" /* yacc.c:1661 */
break;
 
case 27:
#line 122 "arparse.y"
{ ar_addmod((yyvsp[(2) - (2)].list)); }
#line 121 "arparse.y" /* yacc.c:1661 */
{ ar_addmod((yyvsp[0].list)); }
#line 1345 "arparse.c" /* yacc.c:1661 */
break;
 
case 28:
#line 127 "arparse.y"
#line 126 "arparse.y" /* yacc.c:1661 */
{ ar_list(); }
#line 1351 "arparse.c" /* yacc.c:1661 */
break;
 
case 29:
#line 132 "arparse.y"
#line 131 "arparse.y" /* yacc.c:1661 */
{ ar_save(); }
#line 1357 "arparse.c" /* yacc.c:1661 */
break;
 
case 30:
#line 139 "arparse.y"
{ ar_open((yyvsp[(2) - (2)].name),0); }
#line 138 "arparse.y" /* yacc.c:1661 */
{ ar_open((yyvsp[0].name),0); }
#line 1363 "arparse.c" /* yacc.c:1661 */
break;
 
case 31:
#line 144 "arparse.y"
{ ar_open((yyvsp[(2) - (2)].name),1); }
#line 143 "arparse.y" /* yacc.c:1661 */
{ ar_open((yyvsp[0].name),1); }
#line 1369 "arparse.c" /* yacc.c:1661 */
break;
 
case 32:
#line 150 "arparse.y"
{ ar_addlib((yyvsp[(2) - (3)].name),(yyvsp[(3) - (3)].list)); }
#line 149 "arparse.y" /* yacc.c:1661 */
{ ar_addlib((yyvsp[-1].name),(yyvsp[0].list)); }
#line 1375 "arparse.c" /* yacc.c:1661 */
break;
 
case 33:
#line 154 "arparse.y"
{ ar_directory((yyvsp[(2) - (4)].name), (yyvsp[(3) - (4)].list), (yyvsp[(4) - (4)].name)); }
#line 153 "arparse.y" /* yacc.c:1661 */
{ ar_directory((yyvsp[-2].name), (yyvsp[-1].list), (yyvsp[0].name)); }
#line 1381 "arparse.c" /* yacc.c:1661 */
break;
 
case 34:
#line 161 "arparse.y"
{ (yyval.name) = (yyvsp[(1) - (1)].name); }
#line 160 "arparse.y" /* yacc.c:1661 */
{ (yyval.name) = (yyvsp[0].name); }
#line 1387 "arparse.c" /* yacc.c:1661 */
break;
 
case 35:
#line 162 "arparse.y"
#line 161 "arparse.y" /* yacc.c:1661 */
{ (yyval.name) = 0; }
#line 1393 "arparse.c" /* yacc.c:1661 */
break;
 
case 36:
#line 167 "arparse.y"
{ (yyval.list) = (yyvsp[(2) - (3)].list); }
#line 166 "arparse.y" /* yacc.c:1661 */
{ (yyval.list) = (yyvsp[-1].list); }
#line 1399 "arparse.c" /* yacc.c:1661 */
break;
 
case 37:
#line 169 "arparse.y"
#line 168 "arparse.y" /* yacc.c:1661 */
{ (yyval.list) = 0; }
#line 1405 "arparse.c" /* yacc.c:1661 */
break;
 
case 38:
#line 174 "arparse.y"
#line 173 "arparse.y" /* yacc.c:1661 */
{ struct list *n = (struct list *) malloc(sizeof(struct list));
n->next = (yyvsp[(1) - (3)].list);
n->name = (yyvsp[(3) - (3)].name);
n->next = (yyvsp[-2].list);
n->name = (yyvsp[0].name);
(yyval.list) = n;
}
#line 1415 "arparse.c" /* yacc.c:1661 */
break;
 
case 39:
#line 179 "arparse.y"
#line 178 "arparse.y" /* yacc.c:1661 */
{ (yyval.list) = 0; }
#line 1421 "arparse.c" /* yacc.c:1661 */
break;
 
case 42:
#line 191 "arparse.y"
#line 190 "arparse.y" /* yacc.c:1661 */
{ verbose = !verbose; }
#line 1427 "arparse.c" /* yacc.c:1661 */
break;
 
 
/* Line 1267 of yacc.c. */
#line 1546 "arparse.c"
#line 1431 "arparse.c" /* yacc.c:1661 */
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);
1553,8 → 1449,7
 
*++yyvsp = yyval;
 
 
/* Now `shift' the result of the reduction. Determine what state
/* Now 'shift' the result of the reduction. Determine what state
that goes to, based on the state we popped back to and the rule
number reduced by. */
 
1569,10 → 1464,14
goto yynewstate;
 
 
/*------------------------------------.
| yyerrlab -- here on detecting error |
`------------------------------------*/
/*--------------------------------------.
| 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)
{
1580,37 → 1479,36
#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)
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)
{
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 = (char *) YYSTACK_ALLOC (yymsg_alloc);
if (!yymsg)
{
yymsg = yymsgbuf;
yymsg_alloc = sizeof yymsgbuf;
yysyntax_error_status = 2;
}
}
 
if (0 < yysize && yysize <= yymsg_alloc)
else
{
(void) yysyntax_error (yymsg, yystate, yychar);
yyerror (yymsg);
yysyntax_error_status = YYSYNTAX_ERROR;
yymsgp = yymsg;
}
else
{
yyerror (YY_("syntax error"));
if (yysize != 0)
}
yyerror (yymsgp);
if (yysyntax_error_status == 2)
goto yyexhaustedlab;
}
}
# undef YYSYNTAX_ERROR
#endif
}
 
1618,7 → 1516,7
 
if (yyerrstatus == 3)
{
/* If just tried and failed to reuse look-ahead token after an
/* If just tried and failed to reuse lookahead token after an
error, discard it. */
 
if (yychar <= YYEOF)
1635,7 → 1533,7
}
}
 
/* Else will try to reuse look-ahead token after shifting the error
/* Else will try to reuse lookahead token after shifting the error
token. */
goto yyerrlab1;
 
1651,7 → 1549,7
if (/*CONSTCOND*/ 0)
goto yyerrorlab;
 
/* Do not reclaim the symbols of the rule which action triggered
/* Do not reclaim the symbols of the rule whose action triggered
this YYERROR. */
YYPOPSTACK (yylen);
yylen = 0;
1669,7 → 1567,7
for (;;)
{
yyn = yypact[yystate];
if (yyn != YYPACT_NINF)
if (!yypact_value_is_default (yyn))
{
yyn += YYTERROR;
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1692,10 → 1590,9
YY_STACK_PRINT (yyss, yyssp);
}
 
if (yyn == YYFINAL)
YYACCEPT;
 
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
*++yyvsp = yylval;
YY_IGNORE_MAYBE_UNINITIALIZED_END
 
 
/* Shift the error token. */
1719,7 → 1616,7
yyresult = 1;
goto yyreturn;
 
#ifndef yyoverflow
#if !defined yyoverflow || YYERROR_VERBOSE
/*-------------------------------------------------.
| yyexhaustedlab -- memory exhaustion comes here. |
`-------------------------------------------------*/
1730,10 → 1627,15
#endif
 
yyreturn:
if (yychar != YYEOF && yychar != YYEMPTY)
if (yychar != YYEMPTY)
{
/* 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
}
/* Do not reclaim the symbols of the rule whose action triggered
this YYABORT or YYACCEPT. */
YYPOPSTACK (yylen);
YY_STACK_PRINT (yyss, yyssp);
1751,14 → 1653,11
if (yymsg != yymsgbuf)
YYSTACK_FREE (yymsg);
#endif
/* Make sure YYID is used. */
return YYID (yyresult);
return yyresult;
}
#line 194 "arparse.y" /* yacc.c:1906 */
 
 
#line 195 "arparse.y"
 
 
static int
yyerror (const char *x ATTRIBUTE_UNUSED)
{
1767,4 → 1666,3
printf (_("Syntax error in archive script, line %d\n"), linenumber + 1);
return 0;
}
 
/contrib/toolchain/binutils/binutils/arparse.h
1,14 → 1,13
/* A Bison parser, made by GNU Bison 2.3. */
/* A Bison parser, made by GNU Bison 3.0. */
 
/* Skeleton interface for Bison's Yacc-like parsers in C
/* Bison interface for Yacc-like parsers in C
 
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
 
This program is free software; you can redistribute it and/or modify
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
the Free Software Foundation; either version 2, or (at your option)
any later version.
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
16,9 → 15,7
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
along with this program. If not, see <http://www.gnu.org/licenses/>. */
 
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
33,12 → 30,21
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
 
/* Tokens. */
#ifndef YY_YY_ARPARSE_H_INCLUDED
# define YY_YY_ARPARSE_H_INCLUDED
/* Debug traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
#if YYDEBUG
extern int yydebug;
#endif
 
/* Token type. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
enum yytokentype
{
NEWLINE = 258,
VERBOSE = 259,
FILENAME = 260,
79,24 → 85,26
#define SAVE 274
#define OPEN 275
 
 
 
 
/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
#line 38 "arparse.y"
typedef union YYSTYPE YYSTYPE;
union YYSTYPE
{
#line 37 "arparse.y" /* yacc.c:1915 */
 
char *name;
struct list *list ;
 
}
/* Line 1529 of yacc.c. */
#line 95 "arparse.h"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
 
#line 100 "arparse.h" /* yacc.c:1915 */
};
# define YYSTYPE_IS_TRIVIAL 1
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
#endif
 
 
extern YYSTYPE yylval;
 
int yyparse (void);
 
#endif /* !YY_YY_ARPARSE_H_INCLUDED */
/contrib/toolchain/binutils/binutils/arsup.c
1,6 → 1,5
/* arsup.c - Archive support for MRI compatibility
Copyright 1992, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003,
2004, 2005, 2007, 2008 Free Software Foundation, Inc.
Copyright (C) 1992-2015 Free Software Foundation, Inc.
 
This file is part of GNU Binutils.
 
39,6 → 38,7
static void ar_addlib_doer (bfd *, bfd *);
 
extern int verbose;
extern int deterministic;
 
static bfd *obfd;
static char *real_name;
334,6 → 334,9
{
char *ofilename = xstrdup (bfd_get_filename (obfd));
 
if (deterministic > 0)
obfd->flags |= BFD_DETERMINISTIC_OUTPUT;
 
bfd_close (obfd);
 
smart_rename (ofilename, real_name, 0);
/contrib/toolchain/binutils/binutils/arsup.h
1,6 → 1,5
/* arsup.h - archive support header file
Copyright 1992, 1993, 1994, 1996, 2001, 2002, 2003, 2005, 2007
Free Software Foundation, Inc.
Copyright (C) 1992-2015 Free Software Foundation, Inc.
 
This file is part of GNU Binutils.
 
/contrib/toolchain/binutils/binutils/binemul.c
1,6 → 1,5
/* Binutils emulation layer.
Copyright 2002, 2003, 2005, 2007, 2008, 2010
Free Software Foundation, Inc.
Copyright (C) 2002-2015 Free Software Foundation, Inc.
Written by Tom Rix, Red Hat Inc.
 
This file is part of GNU Binutils.
/contrib/toolchain/binutils/binutils/binemul.h
1,5 → 1,5
/* Binutils emulation layer.
Copyright 2002, 2003, 2005, 2007, 2008 Free Software Foundation, Inc.
Copyright (C) 2002-2015 Free Software Foundation, Inc.
Written by Tom Rix, Red Hat Inc.
 
This file is part of GNU Binutils.
/contrib/toolchain/binutils/binutils/bucomm.c
1,7 → 1,5
/* bucomm.c -- Bin Utils COMmon code.
Copyright 1991, 1992, 1993, 1994, 1995, 1997, 1998, 2000, 2001, 2002,
2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
Free Software Foundation, Inc.
Copyright (C) 1991-2015 Free Software Foundation, Inc.
 
This file is part of GNU Binutils.
 
127,24 → 125,26
}
 
void
fatal VPARAMS ((const char *format, ...))
fatal (const char *format, ...)
{
VA_OPEN (args, format);
VA_FIXEDARG (args, const char *, format);
va_list args;
 
va_start (args, format);
 
report (format, args);
VA_CLOSE (args);
va_end (args);
xexit (1);
}
 
void
non_fatal VPARAMS ((const char *format, ...))
non_fatal (const char *format, ...)
{
VA_OPEN (args, format);
VA_FIXEDARG (args, const char *, format);
va_list args;
 
va_start (args, format);
 
report (format, args);
VA_CLOSE (args);
va_end (args);
}
 
/* Set the default BFD target based on the configured target. Doing
429,6 → 429,10
const char *ctime_result = (const char *) ctime (&when);
bfd_size_type size;
 
/* PR binutils/17605: Check for corrupt time values. */
if (ctime_result == NULL)
sprintf (timebuf, _("<time data corrupt>"));
else
/* POSIX format: skip weekday and seconds from ctime output. */
sprintf (timebuf, "%.12s %.4s", ctime_result + 4, ctime_result + 20);
 
627,3 → 631,29
bfd_get_filename (abfd));
return buf;
}
 
/* Returns TRUE iff PATHNAME, a filename of an archive member,
is valid for writing. For security reasons absolute paths
and paths containing /../ are not allowed. See PR 17533. */
 
bfd_boolean
is_valid_archive_path (char const * pathname)
{
const char * n = pathname;
 
if (IS_ABSOLUTE_PATH (n))
return FALSE;
 
while (*n)
{
if (*n == '.' && *++n == '.' && ( ! *++n || IS_DIR_SEPARATOR (*n)))
return FALSE;
 
while (*n && ! IS_DIR_SEPARATOR (*n))
n++;
while (IS_DIR_SEPARATOR (*n))
n++;
}
 
return TRUE;
}
/contrib/toolchain/binutils/binutils/bucomm.h
1,7 → 1,5
/* bucomm.h -- binutils common include file.
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
Free Software Foundation, Inc.
Copyright (C) 1991-2015 Free Software Foundation, Inc.
 
This file is part of GNU Binutils.
 
23,6 → 21,8
#ifndef _BUCOMM_H
#define _BUCOMM_H
 
/* In bucomm.c. */
 
/* Return the filename in a static buffer. */
const char *bfd_get_archive_filename (const bfd *);
 
58,20 → 58,22
 
off_t get_file_size (const char *);
 
bfd_boolean is_valid_archive_path (char const *);
 
extern char *program_name;
 
/* filemode.c */
/* In filemode.c. */
void mode_string (unsigned long, char *);
 
/* version.c */
/* In version.c. */
extern void print_version (const char *);
 
/* rename.c */
/* In rename.c. */
extern void set_times (const char *, const struct stat *);
 
extern int smart_rename (const char *, const char *, int);
 
/* libiberty. */
/* In libiberty. */
void *xmalloc (size_t);
 
void *xrealloc (void *, size_t);
/contrib/toolchain/binutils/binutils/budbg.h
1,6 → 1,5
/* budbg.c -- Interfaces to the generic debugging information routines.
Copyright 1995, 1996, 2002, 2003, 2005, 2007, 2008, 2012
Free Software Foundation, Inc.
Copyright (C) 1995-2015 Free Software Foundation, Inc.
Written by Ian Lance Taylor <ian@cygnus.com>.
 
This file is part of GNU Binutils.
30,7 → 29,8
/* Routine used to print generic debugging information. */
 
extern bfd_boolean print_debugging_info
(FILE *, void *, bfd *, asymbol **, void *, bfd_boolean);
(FILE *, void *, bfd *, asymbol **,
char * (*) (struct bfd *, const char *, int), bfd_boolean);
 
/* Routines used to read and write stabs information. */
 
/contrib/toolchain/binutils/binutils/config.h
1,5 → 1,5
/* config.h. Generated from config.in by configure. */
/* config.in. Generated from configure.in by autoheader. */
/* config.in. Generated from configure.ac by autoheader. */
 
/* Check that config.h is #included before system headers
(this works only for glibc, but that should be enough). */
6,7 → 6,6
#if defined(__GLIBC__) && !defined(__FreeBSD_kernel__) && !defined(__CONFIG_H__)
# error config.h must be #included before system headers
#endif
 
#define __CONFIG_H__ 1
 
/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
20,6 → 19,9
/* Should ar and ranlib use -D behavior by default? */
#define DEFAULT_AR_DETERMINISTIC 0
 
/* Should strings use -a behavior by default? */
#define DEFAULT_STRINGS_ALL 1
 
/* Define to 1 if translation of program messages to the user's native
language is requested. */
/* #undef ENABLE_NLS */
32,8 → 34,13
 
/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
*/
/* #undef HAVE_ALLOCA_H */
#define HAVE_ALLOCA_H 1
 
/* Define to 1 if you have the `basename' function. */
#define HAVE_BASENAME 1
 
#define HAVE_DECL_BASENAME 1
 
/* Define to 1 if you have the declaration of `environ', and to 0 if you
don't. */
#define HAVE_DECL_ENVIRON 1
67,7 → 74,7
 
/* Define to 1 if you have the declaration of `strnlen', and to 0 if you
don't. */
#define HAVE_DECL_STRNLEN 0
#define HAVE_DECL_STRNLEN 1
 
/* Define to 1 if you have the declaration of `strstr', and to 0 if you don't.
*/
107,6 → 114,9
/* Define to 1 if you have the <locale.h> header file. */
#define HAVE_LOCALE_H 1
 
/* Define to 1 if the system has the type `long long'. */
#define HAVE_LONG_LONG 1
 
/* Define if mbstate_t exists in wchar.h. */
#define HAVE_MBSTATE_T 1
 
190,20 → 200,26
#define PACKAGE_BUGREPORT ""
 
/* Define to the full name of this package. */
#define PACKAGE_NAME ""
#define PACKAGE_NAME "binutils"
 
/* Define to the full name and version of this package. */
#define PACKAGE_STRING ""
#define PACKAGE_STRING "binutils 2.26"
 
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME ""
#define PACKAGE_TARNAME "binutils"
 
/* Define to the home page for this package. */
#define PACKAGE_URL ""
 
/* Define to the version of this package. */
#define PACKAGE_VERSION ""
#define PACKAGE_VERSION "2.26"
 
/* The size of `long', as computed by sizeof. */
#define SIZEOF_LONG 4
 
/* The size of `long long', as computed by sizeof. */
#define SIZEOF_LONG_LONG 8
 
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
automatically deduced at runtime.
250,7 → 266,7
 
 
/* Version number of package */
#define VERSION "2.24"
#define VERSION "2.26"
 
/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
`char[]'. */
/contrib/toolchain/binutils/binutils/debug.c
1,6 → 1,5
/* debug.c -- Handle generic debugging information.
Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2005, 2007,
2009 Free Software Foundation, Inc.
Copyright (C) 1995-2015 Free Software Foundation, Inc.
Written by Ian Lance Taylor <ian@cygnus.com>.
 
This file is part of GNU Binutils.
3156,6 → 3155,7
&& t1->u.krange->upper == t2->u.krange->upper
&& debug_type_samep (info, t1->u.krange->type,
t2->u.krange->type));
break;
 
case DEBUG_KIND_ARRAY:
ret = (t1->u.karray->lower == t2->u.karray->lower
/contrib/toolchain/binutils/binutils/debug.h
1,6 → 1,5
/* debug.h -- Describe generic debugging information.
Copyright 1995, 1996, 2002, 2003, 2005, 2007, 2009
Free Software Foundation, Inc.
Copyright (C) 1995-2015 Free Software Foundation, Inc.
Written by Ian Lance Taylor <ian@cygnus.com>.
 
This file is part of GNU Binutils.
/contrib/toolchain/binutils/binutils/emul_vanilla.c
1,5 → 1,5
/* Binutils emulation layer.
Copyright (C) 2002, 2005, 2007 Free Software Foundation, Inc.
Copyright (C) 2002-2015 Free Software Foundation, Inc.
Written by Tom Rix, Red Hat Inc.
 
This file is part of GNU Binutils.
/contrib/toolchain/binutils/binutils/filemode.c
1,6 → 1,5
/* filemode.c -- make a string describing file modes
Copyright 1985, 1990, 1991, 1994, 1995, 1997, 1999, 2002, 2003, 2005,
2007 Free Software Foundation, Inc.
Copyright (C) 1985-2015 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
/contrib/toolchain/binutils/binutils/ieee.c
1,6 → 1,5
/* ieee.c -- Read and write IEEE-695 debugging information.
Copyright 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007,
2008, 2009, 2010, 2011 Free Software Foundation, Inc.
Copyright (C) 1996-2015 Free Software Foundation, Inc.
Written by Ian Lance Taylor <ian@cygnus.com>.
 
This file is part of GNU Binutils.
2955,7 → 2954,7
{
debug_type return_type;
const debug_type *arg_types;
bfd_boolean varargs;
bfd_boolean varargs = FALSE;
 
if (debug_get_type_kind (dhandle, pv->type)
!= DEBUG_KIND_FUNCTION)
/contrib/toolchain/binutils/binutils/is-strip.c
1,4 → 1,4
/* Copyright 2007 Free Software Foundation, Inc.
/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
 
This file is part of GNU Binutils.
 
/contrib/toolchain/binutils/binutils/not-ranlib.c
1,4 → 1,4
/* Copyright 2007 Free Software Foundation, Inc.
/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
 
This file is part of GNU Binutils.
 
/contrib/toolchain/binutils/binutils/not-strip.c
1,4 → 1,4
/* Copyright 2007 Free Software Foundation, Inc.
/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
 
This file is part of GNU Binutils.
 
/contrib/toolchain/binutils/binutils/objcopy.c
1,5 → 1,5
/* objcopy.c -- copy object file from input to output, optionally massaging it.
Copyright 1991-2013 Free Software Foundation, Inc.
Copyright (C) 1991-2015 Free Software Foundation, Inc.
 
This file is part of GNU Binutils.
 
62,6 → 62,16
struct redefine_node *next;
};
 
struct addsym_node
{
struct addsym_node *next;
char * symdef;
long symval;
flagword flags;
char * section;
char * othersym;
};
 
typedef struct section_rename
{
const char * old_name;
186,6 → 196,12
/* List of sections to add to the output BFD. */
static struct section_add *add_sections;
 
/* List of sections to update in the output BFD. */
static struct section_add *update_sections;
 
/* List of sections to dump from the output BFD. */
static struct section_add *dump_sections;
 
/* If non-NULL the argument to --add-gnu-debuglink.
This should be the filename to store in the .gnu_debuglink section. */
static const char * gnu_debuglink_filename = NULL;
196,9 → 212,12
/* Whether to compress/decompress DWARF debug sections. */
static enum
{
nothing,
compress,
decompress
nothing = 0,
compress = 1 << 0,
compress_zlib = compress | 1 << 1,
compress_gnu_zlib = compress | 1 << 2,
compress_gabi_zlib = compress | 1 << 3,
decompress = 1 << 4
} do_debug_sections = nothing;
 
/* Whether to change the leading character in symbol names. */
223,6 → 242,8
static htab_t keepglobal_specific_htab = NULL;
static htab_t weaken_specific_htab = NULL;
static struct redefine_node *redefine_sym_list = NULL;
static struct addsym_node *add_sym_list = NULL, **add_sym_tail = &add_sym_list;
static int add_symbols = 0;
 
/* If this is TRUE, we weaken global symbols (set BSF_WEAK). */
static bfd_boolean weaken = FALSE;
259,63 → 280,66
enum command_line_switch
{
OPTION_ADD_SECTION=150,
OPTION_ADD_GNU_DEBUGLINK,
OPTION_ADD_SYMBOL,
OPTION_ALT_MACH_CODE,
OPTION_CHANGE_ADDRESSES,
OPTION_CHANGE_LEADING_CHAR,
OPTION_CHANGE_START,
OPTION_CHANGE_SECTION_ADDRESS,
OPTION_CHANGE_SECTION_LMA,
OPTION_CHANGE_SECTION_VMA,
OPTION_CHANGE_START,
OPTION_CHANGE_WARNINGS,
OPTION_COMPRESS_DEBUG_SECTIONS,
OPTION_DEBUGGING,
OPTION_DECOMPRESS_DEBUG_SECTIONS,
OPTION_DUMP_SECTION,
OPTION_EXTRACT_DWO,
OPTION_EXTRACT_SYMBOL,
OPTION_FILE_ALIGNMENT,
OPTION_FORMATS_INFO,
OPTION_GAP_FILL,
OPTION_GLOBALIZE_SYMBOL,
OPTION_GLOBALIZE_SYMBOLS,
OPTION_HEAP,
OPTION_IMAGE_BASE,
OPTION_IMPURE,
OPTION_INTERLEAVE_WIDTH,
OPTION_KEEPGLOBAL_SYMBOLS,
OPTION_KEEP_FILE_SYMBOLS,
OPTION_KEEP_SYMBOLS,
OPTION_LOCALIZE_HIDDEN,
OPTION_LOCALIZE_SYMBOLS,
OPTION_LONG_SECTION_NAMES,
OPTION_NO_CHANGE_WARNINGS,
OPTION_ONLY_KEEP_DEBUG,
OPTION_PAD_TO,
OPTION_PREFIX_ALLOC_SECTIONS,
OPTION_PREFIX_SECTIONS,
OPTION_PREFIX_SYMBOLS,
OPTION_PURE,
OPTION_READONLY_TEXT,
OPTION_REDEFINE_SYM,
OPTION_REDEFINE_SYMS,
OPTION_REMOVE_LEADING_CHAR,
OPTION_RENAME_SECTION,
OPTION_REVERSE_BYTES,
OPTION_SECTION_ALIGNMENT,
OPTION_SET_SECTION_FLAGS,
OPTION_SET_START,
OPTION_STRIP_UNNEEDED,
OPTION_WEAKEN,
OPTION_REDEFINE_SYM,
OPTION_REDEFINE_SYMS,
OPTION_SREC_FORCES3,
OPTION_SREC_LEN,
OPTION_SREC_FORCES3,
OPTION_STACK,
OPTION_STRIP_DWO,
OPTION_STRIP_SYMBOLS,
OPTION_STRIP_UNNEEDED,
OPTION_STRIP_UNNEEDED_SYMBOL,
OPTION_STRIP_UNNEEDED_SYMBOLS,
OPTION_KEEP_SYMBOLS,
OPTION_LOCALIZE_HIDDEN,
OPTION_LOCALIZE_SYMBOLS,
OPTION_LONG_SECTION_NAMES,
OPTION_GLOBALIZE_SYMBOL,
OPTION_GLOBALIZE_SYMBOLS,
OPTION_KEEPGLOBAL_SYMBOLS,
OPTION_SUBSYSTEM,
OPTION_UPDATE_SECTION,
OPTION_WEAKEN,
OPTION_WEAKEN_SYMBOLS,
OPTION_RENAME_SECTION,
OPTION_ALT_MACH_CODE,
OPTION_PREFIX_SYMBOLS,
OPTION_PREFIX_SECTIONS,
OPTION_PREFIX_ALLOC_SECTIONS,
OPTION_FORMATS_INFO,
OPTION_ADD_GNU_DEBUGLINK,
OPTION_ONLY_KEEP_DEBUG,
OPTION_KEEP_FILE_SYMBOLS,
OPTION_READONLY_TEXT,
OPTION_WRITABLE_TEXT,
OPTION_PURE,
OPTION_IMPURE,
OPTION_EXTRACT_SYMBOL,
OPTION_REVERSE_BYTES,
OPTION_FILE_ALIGNMENT,
OPTION_HEAP,
OPTION_IMAGE_BASE,
OPTION_SECTION_ALIGNMENT,
OPTION_STACK,
OPTION_INTERLEAVE_WIDTH,
OPTION_SUBSYSTEM,
OPTION_EXTRACT_DWO,
OPTION_STRIP_DWO
OPTION_WRITABLE_TEXT
};
 
/* Options to handle if running as "strip". */
334,16 → 358,16
{"keep-file-symbols", no_argument, 0, OPTION_KEEP_FILE_SYMBOLS},
{"keep-symbol", required_argument, 0, 'K'},
{"only-keep-debug", no_argument, 0, OPTION_ONLY_KEEP_DEBUG},
{"output-file", required_argument, 0, 'o'},
{"output-format", required_argument, 0, 'O'}, /* Obsolete */
{"output-target", required_argument, 0, 'O'},
{"output-file", required_argument, 0, 'o'},
{"preserve-dates", no_argument, 0, 'p'},
{"remove-section", required_argument, 0, 'R'},
{"strip-all", no_argument, 0, 's'},
{"strip-debug", no_argument, 0, 'S'},
{"strip-dwo", no_argument, 0, OPTION_STRIP_DWO},
{"strip-symbol", required_argument, 0, 'N'},
{"strip-unneeded", no_argument, 0, OPTION_STRIP_UNNEEDED},
{"strip-symbol", required_argument, 0, 'N'},
{"target", required_argument, 0, 'F'},
{"verbose", no_argument, 0, 'v'},
{"version", no_argument, 0, 'V'},
357,9 → 381,10
{
{"add-gnu-debuglink", required_argument, 0, OPTION_ADD_GNU_DEBUGLINK},
{"add-section", required_argument, 0, OPTION_ADD_SECTION},
{"add-symbol", required_argument, 0, OPTION_ADD_SYMBOL},
{"adjust-section-vma", required_argument, 0, OPTION_CHANGE_SECTION_ADDRESS},
{"adjust-start", required_argument, 0, OPTION_CHANGE_START},
{"adjust-vma", required_argument, 0, OPTION_CHANGE_ADDRESSES},
{"adjust-section-vma", required_argument, 0, OPTION_CHANGE_SECTION_ADDRESS},
{"adjust-warnings", no_argument, 0, OPTION_CHANGE_WARNINGS},
{"alt-machine-code", required_argument, 0, OPTION_ALT_MACH_CODE},
{"binary-architecture", required_argument, 0, 'B'},
371,20 → 396,24
{"change-section-vma", required_argument, 0, OPTION_CHANGE_SECTION_VMA},
{"change-start", required_argument, 0, OPTION_CHANGE_START},
{"change-warnings", no_argument, 0, OPTION_CHANGE_WARNINGS},
{"compress-debug-sections", no_argument, 0, OPTION_COMPRESS_DEBUG_SECTIONS},
{"compress-debug-sections", optional_argument, 0, OPTION_COMPRESS_DEBUG_SECTIONS},
{"debugging", no_argument, 0, OPTION_DEBUGGING},
{"decompress-debug-sections", no_argument, 0, OPTION_DECOMPRESS_DEBUG_SECTIONS},
{"disable-deterministic-archives", no_argument, 0, 'U'},
{"discard-all", no_argument, 0, 'x'},
{"discard-locals", no_argument, 0, 'X'},
{"dump-section", required_argument, 0, OPTION_DUMP_SECTION},
{"enable-deterministic-archives", no_argument, 0, 'D'},
{"extract-dwo", no_argument, 0, OPTION_EXTRACT_DWO},
{"extract-symbol", no_argument, 0, OPTION_EXTRACT_SYMBOL},
{"file-alignment", required_argument, 0, OPTION_FILE_ALIGNMENT},
{"format", required_argument, 0, 'F'}, /* Obsolete */
{"gap-fill", required_argument, 0, OPTION_GAP_FILL},
{"globalize-symbol", required_argument, 0, OPTION_GLOBALIZE_SYMBOL},
{"globalize-symbols", required_argument, 0, OPTION_GLOBALIZE_SYMBOLS},
{"heap", required_argument, 0, OPTION_HEAP},
{"help", no_argument, 0, 'h'},
{"image-base", required_argument, 0 , OPTION_IMAGE_BASE},
{"impure", no_argument, 0, OPTION_IMPURE},
{"info", no_argument, 0, OPTION_FORMATS_INFO},
{"input-format", required_argument, 0, 'I'}, /* Obsolete */
407,9 → 436,9
{"output-format", required_argument, 0, 'O'}, /* Obsolete */
{"output-target", required_argument, 0, 'O'},
{"pad-to", required_argument, 0, OPTION_PAD_TO},
{"prefix-alloc-sections", required_argument, 0, OPTION_PREFIX_ALLOC_SECTIONS},
{"prefix-sections", required_argument, 0, OPTION_PREFIX_SECTIONS},
{"prefix-symbols", required_argument, 0, OPTION_PREFIX_SYMBOLS},
{"prefix-sections", required_argument, 0, OPTION_PREFIX_SECTIONS},
{"prefix-alloc-sections", required_argument, 0, OPTION_PREFIX_ALLOC_SECTIONS},
{"preserve-dates", no_argument, 0, 'p'},
{"pure", no_argument, 0, OPTION_PURE},
{"readonly-text", no_argument, 0, OPTION_READONLY_TEXT},
419,19 → 448,23
{"remove-section", required_argument, 0, 'R'},
{"rename-section", required_argument, 0, OPTION_RENAME_SECTION},
{"reverse-bytes", required_argument, 0, OPTION_REVERSE_BYTES},
{"section-alignment", required_argument, 0, OPTION_SECTION_ALIGNMENT},
{"set-section-flags", required_argument, 0, OPTION_SET_SECTION_FLAGS},
{"set-start", required_argument, 0, OPTION_SET_START},
{"srec-forceS3", no_argument, 0, OPTION_SREC_FORCES3},
{"srec-len", required_argument, 0, OPTION_SREC_LEN},
{"srec-forceS3", no_argument, 0, OPTION_SREC_FORCES3},
{"stack", required_argument, 0, OPTION_STACK},
{"strip-all", no_argument, 0, 'S'},
{"strip-debug", no_argument, 0, 'g'},
{"strip-dwo", no_argument, 0, OPTION_STRIP_DWO},
{"strip-symbol", required_argument, 0, 'N'},
{"strip-symbols", required_argument, 0, OPTION_STRIP_SYMBOLS},
{"strip-unneeded", no_argument, 0, OPTION_STRIP_UNNEEDED},
{"strip-unneeded-symbol", required_argument, 0, OPTION_STRIP_UNNEEDED_SYMBOL},
{"strip-unneeded-symbols", required_argument, 0, OPTION_STRIP_UNNEEDED_SYMBOLS},
{"strip-symbol", required_argument, 0, 'N'},
{"strip-symbols", required_argument, 0, OPTION_STRIP_SYMBOLS},
{"subsystem", required_argument, 0, OPTION_SUBSYSTEM},
{"target", required_argument, 0, 'F'},
{"update-section", required_argument, 0, OPTION_UPDATE_SECTION},
{"verbose", no_argument, 0, 'v'},
{"version", no_argument, 0, 'V'},
{"weaken", no_argument, 0, OPTION_WEAKEN},
439,12 → 472,6
{"weaken-symbols", required_argument, 0, OPTION_WEAKEN_SYMBOLS},
{"wildcard", no_argument, 0, 'w'},
{"writable-text", no_argument, 0, OPTION_WRITABLE_TEXT},
{"file-alignment", required_argument, 0, OPTION_FILE_ALIGNMENT},
{"heap", required_argument, 0, OPTION_HEAP},
{"image-base", required_argument, 0 , OPTION_IMAGE_BASE},
{"section-alignment", required_argument, 0, OPTION_SECTION_ALIGNMENT},
{"stack", required_argument, 0, OPTION_STACK},
{"subsystem", required_argument, 0, OPTION_SUBSYSTEM},
{0, no_argument, 0, 0}
};
 
527,7 → 554,7
-w --wildcard Permit wildcard in symbol comparison\n\
-x --discard-all Remove all non-global symbols\n\
-X --discard-locals Remove any compiler-generated symbols\n\
-i --interleave [<number>] Only copy N out of every <number> bytes\n\
-i --interleave[=<number>] Only copy N out of every <number> bytes\n\
--interleave-width <number> Set N for --interleave\n\
-b --byte <num> Select byte <num> in every interleaved block\n\
--gap-fill <val> Fill gaps between sections with <val>\n\
548,6 → 575,10
--set-section-flags <name>=<flags>\n\
Set section <name>'s properties to <flags>\n\
--add-section <name>=<file> Add section <name> found in <file> to output\n\
--update-section <name>=<file>\n\
Update contents of section <name> with\n\
contents found in <file>\n\
--dump-section <name>=<file> Dump the contents of section <name> into <file>\n\
--rename-section <old>=<new>[,<flags>] Rename section <old> to <new>\n\
--long-section-names {enable|disable|keep}\n\
Handle long section names in Coff objects.\n\
568,6 → 599,7
--globalize-symbols <file> --globalize-symbol for all in <file>\n\
--keep-global-symbols <file> -G for all symbols listed in <file>\n\
--weaken-symbols <file> -W for all symbols listed in <file>\n\
--add-symbol <name>=[<section>:]<value>[,<flags>] Add a symbol\n\
--alt-machine-code <index> Use the target's <index>'th alternative machine\n\
--writable-text Mark the output text as writable\n\
--readonly-text Make the output text write protected\n\
587,7 → 619,8
<commit>\n\
--subsystem <name>[:<version>]\n\
Set PE subsystem to <name> [& <version>]\n\
--compress-debug-sections Compress DWARF debug sections using zlib\n\
--compress-debug-sections[={none|zlib|zlib-gnu|zlib-gabi}]\n\
Compress DWARF debug sections using zlib\n\
--decompress-debug-sections Decompress DWARF debug sections using zlib\n\
-v --verbose List all object files modified\n\
@<file> Read options from <file>\n\
626,7 → 659,7
-U --disable-deterministic-archives\n\
Disable -D behavior (default)\n"));
fprintf (stream, _("\
-R --remove-section=<name> Remove section <name> from the output\n\
-R --remove-section=<name> Also remove section <name> from the output\n\
-s --strip-all Remove all symbol and relocation information\n\
-g -S -d --strip-debug Remove all debugging symbols & sections\n\
--strip-dwo Remove all DWO sections\n\
709,6 → 742,78
return ret;
}
 
/* Parse symbol flags into a flagword, with a fatal error if the
string can't be parsed. */
 
static flagword
parse_symflags (const char *s, char **other)
{
flagword ret;
const char *snext;
int len;
 
ret = BSF_NO_FLAGS;
 
do
{
snext = strchr (s, ',');
if (snext == NULL)
len = strlen (s);
else
{
len = snext - s;
++snext;
}
 
#define PARSE_FLAG(fname,fval) \
else if (len == (int) sizeof fname - 1 && strncasecmp (fname, s, len) == 0) \
ret |= fval
 
#define PARSE_OTHER(fname,fval) \
else if (len >= (int) sizeof fname && strncasecmp (fname, s, sizeof fname - 1) == 0) \
fval = xstrndup (s + sizeof fname - 1, len - sizeof fname + 1)
 
if (0) ;
PARSE_FLAG ("local", BSF_LOCAL);
PARSE_FLAG ("global", BSF_GLOBAL);
PARSE_FLAG ("export", BSF_EXPORT);
PARSE_FLAG ("debug", BSF_DEBUGGING);
PARSE_FLAG ("function", BSF_FUNCTION);
PARSE_FLAG ("weak", BSF_WEAK);
PARSE_FLAG ("section", BSF_SECTION_SYM);
PARSE_FLAG ("constructor", BSF_CONSTRUCTOR);
PARSE_FLAG ("warning", BSF_WARNING);
PARSE_FLAG ("indirect", BSF_INDIRECT);
PARSE_FLAG ("file", BSF_FILE);
PARSE_FLAG ("object", BSF_OBJECT);
PARSE_FLAG ("synthetic", BSF_SYNTHETIC);
PARSE_FLAG ("indirect-function", BSF_GNU_INDIRECT_FUNCTION | BSF_FUNCTION);
PARSE_FLAG ("unique-object", BSF_GNU_UNIQUE | BSF_OBJECT);
PARSE_OTHER ("before=", *other);
 
#undef PARSE_FLAG
#undef PARSE_OTHER
else
{
char *copy;
 
copy = (char *) xmalloc (len + 1);
strncpy (copy, s, len);
copy[len] = '\0';
non_fatal (_("unrecognized symbol flag `%s'"), copy);
fatal (_("supported flags: %s"),
"local, global, export, debug, function, weak, section, "
"constructor, warning, indirect, file, object, synthetic, "
"indirect-function, unique-object, before=<othersym>");
}
 
s = snext;
}
while (s != NULL);
 
return ret;
}
 
/* Find and optionally add an entry in the change_sections list.
 
We need to be careful in how we match section names because of the support
967,15 → 1072,15
if (! fnmatch (slot_name, d->name, 0))
{
d->found = TRUE;
/* Stop traversal. */
return 0;
/* Continue traversal, there might be a non-match rule. */
return 1;
}
}
else
{
if (fnmatch (slot_name + 1, d->name, 0))
if (! fnmatch (slot_name + 1, d->name, 0))
{
d->found = TRUE;
d->found = FALSE;
/* Stop traversal. */
return 0;
}
1038,6 → 1143,27
return strncmp (name + len - 4, ".dwo", 4) == 0;
}
 
/* Return TRUE if section SEC is in the update list. */
 
static bfd_boolean
is_update_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sec)
{
if (update_sections != NULL)
{
struct section_add *pupdate;
 
for (pupdate = update_sections;
pupdate != NULL;
pupdate = pupdate->next)
{
if (strcmp (sec->name, pupdate->name) == 0)
return TRUE;
}
}
 
return FALSE;
}
 
/* See if a non-group section is being removed. */
 
static bfd_boolean
1056,6 → 1182,9
if (p && q)
fatal (_("error: section %s matches both remove and copy options"),
bfd_get_section_name (abfd, sec));
if (p && is_update_section (abfd, sec))
fatal (_("error: section %s matches both update and remove options"),
bfd_get_section_name (abfd, sec));
 
if (p != NULL)
return TRUE;
1135,6 → 1264,24
return FALSE;
}
 
static bfd_boolean
is_nondebug_keep_contents_section (bfd *ibfd, asection *isection)
{
/* Always keep ELF note sections. */
if (ibfd->xvec->flavour == bfd_target_elf_flavour)
return (elf_section_type (isection) == SHT_NOTE);
 
/* Always keep the .buildid section for PE/COFF.
 
Strictly, this should be written "always keep the section storing the debug
directory", but that may be the .text section for objects produced by some
tools, which it is not sensible to keep. */
if (ibfd->xvec->flavour == bfd_target_coff_flavour)
return (strcmp (bfd_get_section_name (ibfd, isection), ".buildid") == 0);
 
return FALSE;
}
 
/* Return true if SYM is a hidden symbol. */
 
static bfd_boolean
1153,6 → 1300,49
return FALSE;
}
 
static bfd_boolean
need_sym_before (struct addsym_node **node, const char *sym)
{
int count;
struct addsym_node *ptr = add_sym_list;
 
/* 'othersym' symbols are at the front of the list. */
for (count = 0; count < add_symbols; count++)
{
if (!ptr->othersym)
break;
else if (strcmp (ptr->othersym, sym) == 0)
{
free (ptr->othersym);
ptr->othersym = ""; /* Empty name is hopefully never a valid symbol name. */
*node = ptr;
return TRUE;
}
ptr = ptr->next;
}
return FALSE;
}
 
static asymbol *
create_new_symbol (struct addsym_node *ptr, bfd *obfd)
{
asymbol *sym = bfd_make_empty_symbol(obfd);
 
bfd_asymbol_name(sym) = ptr->symdef;
sym->value = ptr->symval;
sym->flags = ptr->flags;
if (ptr->section)
{
asection *sec = bfd_get_section_by_name (obfd, ptr->section);
if (!sec)
fatal (_("Section %s not found"), ptr->section);
sym->section = sec;
}
else
sym->section = bfd_abs_section_ptr;
return sym;
}
 
/* Choose which symbol entries to copy; put the result in OSYMS.
We don't copy in place, because that confuses the relocs.
Return the number of symbols to print. */
1178,6 → 1368,14
 
undefined = bfd_is_und_section (bfd_get_section (sym));
 
if (add_sym_list)
{
struct addsym_node *ptr;
 
if (need_sym_before (&ptr, name))
to[dst_count++] = create_new_symbol (ptr, obfd);
}
 
if (redefine_sym_list)
{
char *old_name, *new_name;
1334,7 → 1532,24
to[dst_count++] = sym;
}
}
if (add_sym_list)
{
struct addsym_node *ptr = add_sym_list;
 
for (src_count = 0; src_count < add_symbols; src_count++)
{
if (ptr->othersym)
{
if (strcmp (ptr->othersym, ""))
fatal (_("'before=%s' not found"), ptr->othersym);
}
else
to[dst_count++] = create_new_symbol (ptr, obfd);
 
ptr = ptr->next;
}
}
 
to[dst_count] = NULL;
 
return dst_count;
1580,11 → 1795,17
void *dhandle;
enum bfd_architecture iarch;
unsigned int imach;
unsigned int c, i;
 
if (ibfd->xvec->byteorder != obfd->xvec->byteorder
&& ibfd->xvec->byteorder != BFD_ENDIAN_UNKNOWN
&& obfd->xvec->byteorder != BFD_ENDIAN_UNKNOWN)
fatal (_("Unable to change endianness of input file(s)"));
{
/* PR 17636: Call non-fatal so that we return to our parent who
may need to tidy temporary files. */
non_fatal (_("Unable to change endianness of input file(s)"));
return FALSE;
}
 
if (!bfd_set_format (obfd, bfd_get_format (ibfd)))
{
1592,6 → 1813,22
return FALSE;
}
 
if (ibfd->sections == NULL)
{
non_fatal (_("error: the input file '%s' has no sections"),
bfd_get_archive_filename (ibfd));
return FALSE;
}
 
if ((do_debug_sections & compress) != 0
&& do_debug_sections != compress
&& ibfd->xvec->flavour != bfd_target_elf_flavour)
{
non_fatal (_("--compress-debug-sections=[zlib|zlib-gnu|zlib-gabi] is unsupported on `%s'"),
bfd_get_archive_filename (ibfd));
return FALSE;
}
 
if (verbose)
printf (_("copy from `%s' [%s] to `%s' [%s]\n"),
bfd_get_archive_filename (ibfd), bfd_get_target (ibfd),
1745,6 → 1982,14
bfd_nonfatal_message (NULL, ibfd, NULL, NULL);
return FALSE;
}
/* PR 17512: file: d6323821
If the symbol table could not be loaded do not pretend that we have
any symbols. This trips us up later on when we load the relocs. */
if (symcount == 0)
{
free (isympp);
osympp = isympp = NULL;
}
 
/* BFD mandates that all output sections be created and sizes set before
any output is done. Thus, we traverse all sections multiple times. */
1826,6 → 2071,93
}
}
 
if (update_sections != NULL)
{
struct section_add *pupdate;
 
for (pupdate = update_sections;
pupdate != NULL;
pupdate = pupdate->next)
{
asection *osec;
 
pupdate->section = bfd_get_section_by_name (ibfd, pupdate->name);
if (pupdate->section == NULL)
{
non_fatal (_("error: %s not found, can't be updated"), pupdate->name);
return FALSE;
}
 
osec = pupdate->section->output_section;
if (! bfd_set_section_size (obfd, osec, pupdate->size))
{
bfd_nonfatal_message (NULL, obfd, osec, NULL);
return FALSE;
}
}
}
 
if (dump_sections != NULL)
{
struct section_add * pdump;
 
for (pdump = dump_sections; pdump != NULL; pdump = pdump->next)
{
asection * sec;
 
sec = bfd_get_section_by_name (ibfd, pdump->name);
if (sec == NULL)
{
bfd_nonfatal_message (NULL, ibfd, NULL,
_("can't dump section '%s' - it does not exist"),
pdump->name);
continue;
}
 
if ((bfd_get_section_flags (ibfd, sec) & SEC_HAS_CONTENTS) == 0)
{
bfd_nonfatal_message (NULL, ibfd, sec,
_("can't dump section - it has no contents"));
continue;
}
 
bfd_size_type size = bfd_get_section_size (sec);
if (size == 0)
{
bfd_nonfatal_message (NULL, ibfd, sec,
_("can't dump section - it is empty"));
continue;
}
 
FILE * f;
f = fopen (pdump->filename, FOPEN_WB);
if (f == NULL)
{
bfd_nonfatal_message (pdump->filename, NULL, NULL,
_("could not open section dump file"));
continue;
}
 
bfd_byte * contents = xmalloc (size);
if (bfd_get_section_contents (ibfd, sec, contents, 0, size))
{
if (fwrite (contents, 1, size, f) != size)
{
non_fatal (_("error writing section contents to %s (error: %s)"),
pdump->filename,
strerror (errno));
return FALSE;
}
}
else
bfd_nonfatal_message (NULL, ibfd, sec,
_("could not retrieve section contents"));
 
fclose (f);
free (contents);
}
}
 
if (gnu_debuglink_filename != NULL)
{
/* PR 15125: Give a helpful warning message if
1895,11 → 2227,11
}
}
 
if (bfd_count_sections (obfd) != 0
c = bfd_count_sections (obfd);
if (c != 0
&& (gap_fill_set || pad_to_set))
{
asection **set;
unsigned int c, i;
 
/* We must fill in gaps between the sections and/or we must pad
the last section to a specified address. We do this by
1907,7 → 2239,6
increasing the section sizes as required to fill the gaps.
We write out the gap contents below. */
 
c = bfd_count_sections (obfd);
osections = (asection **) xmalloc (c * sizeof (asection *));
set = osections;
bfd_map_over_sections (obfd, get_sections, &set);
2003,7 → 2334,8
|| change_leading_char
|| remove_leading_char
|| redefine_sym_list
|| weaken)
|| weaken
|| add_symbols)
{
/* Mark symbols used in output relocations so that they
are kept, even if they are local labels or static symbols.
2017,7 → 2349,7
bfd_map_over_sections (ibfd,
mark_symbols_used_in_relocations,
isympp);
osympp = (asymbol **) xmalloc ((symcount + 1) * sizeof (asymbol *));
osympp = (asymbol **) xmalloc ((symcount + add_symbols + 1) * sizeof (asymbol *));
symcount = filter_symbols (ibfd, obfd, osympp, isympp, symcount);
}
 
2053,6 → 2385,26
}
}
 
if (update_sections != NULL)
{
struct section_add *pupdate;
 
for (pupdate = update_sections;
pupdate != NULL;
pupdate = pupdate->next)
{
asection *osec;
 
osec = pupdate->section->output_section;
if (! bfd_set_section_contents (obfd, osec, pupdate->contents,
0, pupdate->size))
{
bfd_nonfatal_message (NULL, obfd, osec, NULL);
return FALSE;
}
}
}
 
if (gnu_debuglink_filename != NULL)
{
if (! bfd_fill_in_gnu_debuglink_section
2068,7 → 2420,6
if (gap_fill_set || pad_to_set)
{
bfd_byte *buf;
int c, i;
 
/* Fill in the gaps. */
if (max_gap > 8192)
2110,11 → 2461,6
}
}
 
/* Do not copy backend data if --extract-symbol is passed; anything
that needs to look at the section contents will fail. */
if (extract_symbol)
return TRUE;
 
/* Allow the BFD backend to copy any private data it understands
from the input BFD to the output BFD. This is done last to
permit the routine to look at the filtered symbol table, which is
2193,7 → 2539,7
{
status = 1;
bfd_nonfatal_message (NULL, obfd, NULL, NULL);
return;
goto cleanup_and_exit;
}
 
while (!status && this_element != NULL)
2206,6 → 2552,16
bfd_boolean del = TRUE;
bfd_boolean ok_object;
 
/* PR binutils/17533: Do not allow directory traversal
outside of the current directory tree by archive members. */
if (! is_valid_archive_path (bfd_get_filename (this_element)))
{
non_fatal (_("illegal pathname found in archive member: %s"),
bfd_get_filename (this_element));
status = 1;
goto cleanup_and_exit;
}
 
/* Create an output file for this member. */
output_name = concat (dir, "/",
bfd_get_filename (this_element), (char *) 0);
2215,8 → 2571,12
{
output_name = make_tempdir (output_name);
if (output_name == NULL)
fatal (_("cannot create tempdir for archive copying (error: %s)"),
{
non_fatal (_("cannot create tempdir for archive copying (error: %s)"),
strerror (errno));
status = 1;
goto cleanup_and_exit;
}
 
l = (struct name_list *) xmalloc (sizeof (struct name_list));
l->name = output_name;
2258,7 → 2618,7
{
bfd_nonfatal_message (output_name, NULL, NULL, NULL);
status = 1;
return;
goto cleanup_and_exit;
}
 
if (ok_object)
2319,7 → 2679,6
{
status = 1;
bfd_nonfatal_message (filename, NULL, NULL, NULL);
return;
}
 
filename = bfd_get_filename (ibfd);
2327,9 → 2686,9
{
status = 1;
bfd_nonfatal_message (filename, NULL, NULL, NULL);
return;
}
 
cleanup_and_exit: ;
/* Delete all the files that we opened. */
#if 0
for (l = list; l != NULL; l = l->next)
2342,6 → 2701,7
unlink (l->name);
}
}
 
rmdir (dir);
#endif
 
2394,7 → 2754,14
switch (do_debug_sections)
{
case compress:
case compress_zlib:
case compress_gnu_zlib:
case compress_gabi_zlib:
ibfd->flags |= BFD_COMPRESS;
/* Don't check if input is ELF here since this information is
only available after bfd_check_format_matches is called. */
if (do_debug_sections != compress_gnu_zlib)
ibfd->flags |= BFD_COMPRESS_GABI;
break;
case decompress:
ibfd->flags |= BFD_DECOMPRESS;
2453,7 → 2820,11
if (! copy_object (ibfd, obfd, input_arch))
status = 1;
 
if (!bfd_close (obfd))
/* PR 17512: file: 0f15796a.
If the file could not be copied it may not be in a writeable
state. So use bfd_close_all_done to avoid the possibility of
writing uninitialised data into the file. */
if (! (status ? bfd_close_all_done (obfd) : bfd_close (obfd)))
{
status = 1;
bfd_nonfatal_message (output_filename, NULL, NULL, NULL);
2627,8 → 2998,7
flags = p->flags | (flags & (SEC_HAS_CONTENTS | SEC_RELOC));
else if (strip_symbols == STRIP_NONDEBUG
&& (flags & (SEC_ALLOC | SEC_GROUP)) != 0
&& !(ibfd->xvec->flavour == bfd_target_elf_flavour
&& elf_section_type (isection) == SHT_NOTE))
&& !is_nondebug_keep_contents_section (ibfd, isection))
{
flags &= ~(SEC_HAS_CONTENTS | SEC_LOAD | SEC_GROUP);
if (obfd->xvec->flavour == bfd_target_elf_flavour)
2655,6 → 3025,7
elf_section_type (osection) = SHT_NOBITS;
 
size = bfd_section_size (ibfd, isection);
size = bfd_convert_section_size (ibfd, isection, obfd, size);
if (copy_byte >= 0)
size = (size + interleave - 1) / interleave * copy_width;
else if (extract_symbol)
2712,6 → 3083,9
/* Copy merge entity size. */
osection->entsize = isection->entsize;
 
/* Copy compress status. */
osection->compress_status = isection->compress_status;
 
/* This used to be mangle_section; we do here to avoid using
bfd_get_section_by_name since some formats allow multiple
sections with the same name. */
2718,11 → 3092,6
isection->output_section = osection;
isection->output_offset = 0;
 
/* Do not copy backend data if --extract-symbol is passed; anything
that needs to look at the section contents will fail. */
if (extract_symbol)
return;
 
if ((isection->flags & SEC_GROUP) != 0)
{
asymbol *gsym = group_signature (isection);
2771,6 → 3140,9
if (is_strip_section (ibfd, isection))
return TRUE;
 
if (is_update_section (ibfd, isection))
return TRUE;
 
flags = bfd_get_section_flags (ibfd, isection);
if ((flags & SEC_GROUP) != 0)
return TRUE;
2850,9 → 3222,13
 
temp_relpp = (arelent **) xmalloc (relsize);
for (i = 0; i < relcount; i++)
{
/* PR 17512: file: 9e907e0c. */
if (relpp[i]->sym_ptr_ptr)
if (is_specified_symbol (bfd_asymbol_name (*relpp[i]->sym_ptr_ptr),
keep_specific_htab))
temp_relpp [temp_relcount++] = relpp [i];
}
relcount = temp_relcount;
free (relpp);
relpp = temp_relpp;
2882,6 → 3258,10
return;
 
osection = isection->output_section;
/* The output SHF_COMPRESSED section size is different from input if
ELF classes of input and output aren't the same. We can't use
the output section size since --interleave will shrink the output
section. Size will be updated if the section is converted. */
size = bfd_get_section_size (isection);
 
if (bfd_get_section_flags (ibfd, isection) & SEC_HAS_CONTENTS
2889,7 → 3269,9
{
bfd_byte *memhunk = NULL;
 
if (!bfd_get_full_section_contents (ibfd, isection, &memhunk))
if (!bfd_get_full_section_contents (ibfd, isection, &memhunk)
|| !bfd_convert_section_contents (ibfd, isection, obfd,
&memhunk, &size))
{
status = 1;
bfd_nonfatal_message (NULL, ibfd, isection, NULL);
3156,7 → 3538,7
int i;
char *output_file = NULL;
 
while ((c = getopt_long (argc, argv, "I:O:F:K:N:R:o:sSpdgxXHhVvw",
while ((c = getopt_long (argc, argv, "I:O:F:K:N:R:o:sSpdgxXHhVvwDU",
strip_options, (int *) 0)) != EOF)
{
switch (c)
3432,6 → 3814,79
}
}
 
/* Allocate and return a pointer to a struct section_add, initializing the
structure using ARG, a string in the format "sectionname=filename".
The returned structure will have its next pointer set to NEXT. The
OPTION field is the name of the command line option currently being
parsed, and is only used if an error needs to be reported. */
 
static struct section_add *
init_section_add (const char *arg,
struct section_add *next,
const char *option)
{
struct section_add *pa;
const char *s;
 
s = strchr (arg, '=');
if (s == NULL)
fatal (_("bad format for %s"), option);
 
pa = (struct section_add *) xmalloc (sizeof (struct section_add));
pa->name = xstrndup (arg, s - arg);
pa->filename = s + 1;
pa->next = next;
pa->contents = NULL;
pa->size = 0;
 
return pa;
}
 
/* Load the file specified in PA, allocating memory to hold the file
contents, and store a pointer to the allocated memory in the contents
field of PA. The size field of PA is also updated. All errors call
FATAL. */
 
static void
section_add_load_file (struct section_add *pa)
{
size_t off, alloc;
FILE *f;
 
/* We don't use get_file_size so that we can do
--add-section .note.GNU_stack=/dev/null
get_file_size doesn't work on /dev/null. */
 
f = fopen (pa->filename, FOPEN_RB);
if (f == NULL)
fatal (_("cannot open: %s: %s"),
pa->filename, strerror (errno));
 
off = 0;
alloc = 4096;
pa->contents = (bfd_byte *) xmalloc (alloc);
while (!feof (f))
{
off_t got;
 
if (off == alloc)
{
alloc <<= 1;
pa->contents = (bfd_byte *) xrealloc (pa->contents, alloc);
}
 
got = fread (pa->contents + off, 1, alloc - off, f);
if (ferror (f))
fatal (_("%s: fread failed"), pa->filename);
 
off += got;
}
 
pa->size = off;
 
fclose (f);
}
 
static int
copy_main (int argc, char *argv[])
{
3447,7 → 3902,7
struct stat statbuf;
const bfd_arch_info_type *input_arch = NULL;
 
while ((c = getopt_long (argc, argv, "b:B:i:I:j:K:N:s:O:d:F:L:G:R:SpgxXHhVvW:w",
while ((c = getopt_long (argc, argv, "b:B:i:I:j:K:N:s:O:d:F:L:G:R:SpgxXHhVvW:wDU",
copy_options, (int *) 0)) != EOF)
{
switch (c)
3603,57 → 4058,67
break;
 
case OPTION_ADD_SECTION:
add_sections = init_section_add (optarg, add_sections,
"--add-section");
section_add_load_file (add_sections);
break;
 
case OPTION_UPDATE_SECTION:
update_sections = init_section_add (optarg, update_sections,
"--update-section");
section_add_load_file (update_sections);
break;
 
case OPTION_DUMP_SECTION:
dump_sections = init_section_add (optarg, dump_sections,
"--dump-section");
break;
 
case OPTION_ADD_SYMBOL:
{
const char *s;
size_t off, alloc;
struct section_add *pa;
FILE *f;
char *s, *t;
struct addsym_node *newsym = xmalloc (sizeof *newsym);
 
newsym->next = NULL;
s = strchr (optarg, '=');
 
if (s == NULL)
fatal (_("bad format for %s"), "--add-section");
fatal (_("bad format for %s"), "--add-symbol");
t = strchr (s + 1, ':');
 
pa = (struct section_add *) xmalloc (sizeof (struct section_add));
pa->name = xstrndup (optarg, s - optarg);
pa->filename = s + 1;
 
/* We don't use get_file_size so that we can do
--add-section .note.GNU_stack=/dev/null
get_file_size doesn't work on /dev/null. */
 
f = fopen (pa->filename, FOPEN_RB);
if (f == NULL)
fatal (_("cannot open: %s: %s"),
pa->filename, strerror (errno));
 
off = 0;
alloc = 4096;
pa->contents = (bfd_byte *) xmalloc (alloc);
while (!feof (f))
newsym->symdef = xstrndup (optarg, s - optarg);
if (t)
{
off_t got;
 
if (off == alloc)
newsym->section = xstrndup (s + 1, t - (s + 1));
newsym->symval = strtol (t + 1, NULL, 0);
}
else
{
alloc <<= 1;
pa->contents = (bfd_byte *) xrealloc (pa->contents, alloc);
newsym->section = NULL;
newsym->symval = strtol (s + 1, NULL, 0);
t = s;
}
 
got = fread (pa->contents + off, 1, alloc - off, f);
if (ferror (f))
fatal (_("%s: fread failed"), pa->filename);
t = strchr (t + 1, ',');
if (t)
newsym->flags = parse_symflags (t+1, &newsym->othersym);
else
newsym->flags = BSF_GLOBAL;
 
off += got;
/* Keep 'othersym' symbols at the front of the list. */
if (newsym->othersym)
{
newsym->next = add_sym_list;
if (!add_sym_list)
add_sym_tail = &newsym->next;
add_sym_list = newsym;
}
 
pa->size = off;
 
fclose (f);
 
pa->next = add_sections;
add_sections = pa;
else
{
*add_sym_tail = newsym;
add_sym_tail = &newsym->next;
}
add_symbols++;
}
break;
 
case OPTION_CHANGE_START:
3758,6 → 4223,21
break;
 
case OPTION_COMPRESS_DEBUG_SECTIONS:
if (optarg)
{
if (strcasecmp (optarg, "none") == 0)
do_debug_sections = decompress;
else if (strcasecmp (optarg, "zlib") == 0)
do_debug_sections = compress_zlib;
else if (strcasecmp (optarg, "zlib-gnu") == 0)
do_debug_sections = compress_gnu_zlib;
else if (strcasecmp (optarg, "zlib-gabi") == 0)
do_debug_sections = compress_gabi_zlib;
else
fatal (_("unrecognized --compress-debug-sections type `%s'"),
optarg);
}
else
do_debug_sections = compress;
break;
 
4282,6 → 4762,9
 
create_symbol_htabs ();
 
if (argv != NULL)
bfd_set_error_program_name (argv[0]);
 
if (is_strip)
strip_main (argc, argv);
else
/contrib/toolchain/binutils/binutils/rdcoff.c
1,6 → 1,5
/* stabs.c -- Parse COFF debugging information
Copyright 1996, 1999, 2000, 2002, 2003, 2005, 2007
Free Software Foundation, Inc.
Copyright (C) 1996-2015 Free Software Foundation, Inc.
Written by Ian Lance Taylor <ian@cygnus.com>.
 
This file is part of GNU Binutils.
84,7 → 83,7
debug_type basic[T_MAX + 1];
};
 
static debug_type *coff_get_slot (struct coff_types *, int);
static debug_type *coff_get_slot (struct coff_types *, long);
static debug_type parse_coff_type
(bfd *, struct coff_symbols *, struct coff_types *, long, int,
union internal_auxent *, bfd_boolean, void *);
105,12 → 104,17
/* Return the slot for a type. */
 
static debug_type *
coff_get_slot (struct coff_types *types, int indx)
coff_get_slot (struct coff_types *types, long indx)
{
struct coff_slots **pps;
 
pps = &types->slots;
 
/* PR 17512: file: 078-18333-0.001:0.1.
FIXME: The value of 1000 is a guess. Maybe a better heuristic is needed. */
if (indx / COFF_SLOTS > 1000)
fatal (_("Excessively large slot index: %lx"), indx);
 
while (indx >= COFF_SLOTS)
{
if (*pps == NULL)
/contrib/toolchain/binutils/binutils/rddbg.c
1,6 → 1,5
/* rddbg.c -- Read debugging information into a generic form.
Copyright 1995, 1996, 1997, 2000, 2002, 2003, 2005, 2007, 2008,
2010 Free Software Foundation, Inc.
Copyright (C) 1995-2015 Free Software Foundation, Inc.
Written by Ian Lance Taylor <ian@cygnus.com>.
 
This file is part of GNU Binutils.
140,7 → 139,7
}
 
strsize = bfd_section_size (abfd, strsec);
strings = (bfd_byte *) xmalloc (strsize);
strings = (bfd_byte *) xmalloc (strsize + 1);
if (! bfd_get_section_contents (abfd, strsec, strings, 0, strsize))
{
fprintf (stderr, "%s: %s: %s\n",
148,7 → 147,8
bfd_errmsg (bfd_get_error ()));
return FALSE;
}
 
/* Zero terminate the strings table, just in case. */
strings [strsize] = 0;
if (shandle == NULL)
{
shandle = start_stab (dhandle, abfd, TRUE, syms, symcount);
160,7 → 160,8
 
stroff = 0;
next_stroff = 0;
for (stab = stabs; stab < stabs + stabsize; stab += 12)
/* PR 17512: file: 078-60391-0.001:0.1. */
for (stab = stabs; stab <= (stabs + stabsize) - 12; stab += 12)
{
unsigned int strx;
int type;
185,13 → 186,12
}
else
{
size_t len;
char *f, *s;
 
f = NULL;
 
if (stroff + strx > strsize)
if (stroff + strx >= strsize)
{
fprintf (stderr, "%s: %s: stab entry %ld is corrupt, strx = 0x%x, type = %d\n",
fprintf (stderr, _("%s: %s: stab entry %ld is corrupt, strx = 0x%x, type = %d\n"),
bfd_get_filename (abfd), names[i].secname,
(long) (stab - stabs) / 12, strx, type);
continue;
198,19 → 198,30
}
 
s = (char *) strings + stroff + strx;
f = NULL;
 
while (s[strlen (s) - 1] == '\\'
/* PR 17512: file: 002-87578-0.001:0.1.
It is possible to craft a file where, without the 'strlen (s) > 0',
an attempt to read the byte before 'strings' would occur. */
while ((len = strlen (s)) > 0
&& s[len - 1] == '\\'
&& stab + 12 < stabs + stabsize)
{
char *p;
 
stab += 12;
p = s + strlen (s) - 1;
p = s + len - 1;
*p = '\0';
s = concat (s,
((char *) strings
+ stroff
+ bfd_get_32 (abfd, stab)),
strx = stroff + bfd_get_32 (abfd, stab);
if (strx >= strsize)
{
fprintf (stderr, _("%s: %s: stab entry %ld is corrupt\n"),
bfd_get_filename (abfd), names[i].secname,
(long) (stab - stabs) / 12);
break;
}
else
s = concat (s, (char *) strings + strx,
(const char *) NULL);
 
/* We have to restore the backslash, because, if
/contrib/toolchain/binutils/binutils/rename.c
1,5 → 1,5
/* rename.c -- rename a file, preserving symlinks.
Copyright 1999, 2002, 2003, 2005, 2007, 2008 Free Software Foundation, Inc.
Copyright (C) 1999-2015 Free Software Foundation, Inc.
 
This file is part of GNU Binutils.
 
/contrib/toolchain/binutils/binutils/stabs.c
1,6 → 1,5
/* stabs.c -- Parse stabs debugging information
Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
Copyright (C) 1995-2015 Free Software Foundation, Inc.
Written by Ian Lance Taylor <ian@cygnus.com>.
 
This file is part of GNU Binutils.
837,8 → 836,6
 
case 'G':
{
char leading;
long c;
asymbol **ps;
 
/* A global symbol. The value must be extracted from the
847,6 → 844,11
(debug_type **) NULL);
if (dtype == DEBUG_TYPE_NULL)
return FALSE;
if (name != NULL)
{
char leading;
long c;
 
leading = bfd_get_symbol_leading_char (info->abfd);
for (c = info->symcount, ps = info->syms; c > 0; --c, ++ps)
{
858,8 → 860,11
if (*n == *name && strcmp (n, name) == 0)
break;
}
 
if (c > 0)
value = bfd_asymbol_value (*ps);
}
 
if (! stab_record_variable (dhandle, info, name, dtype, DEBUG_GLOBAL,
value))
return FALSE;
1769,7 → 1774,7
else if (n3 == (bfd_signed_vma) 0xffffffff)
return debug_make_int_type (dhandle, 4, TRUE);
#ifdef BFD64
else if (n3 == ((((bfd_signed_vma) 0xffffffff) << 32) | 0xffffffff))
else if (n3 == (bfd_signed_vma) 0xffffffffffffffffLL)
return debug_make_int_type (dhandle, 8, TRUE);
#endif
}
/contrib/toolchain/binutils/binutils/sysdep.h
1,7 → 1,5
/* sysdep.h -- handle host dependencies for binutils
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009, 2012
Free Software Foundation, Inc.
Copyright (C) 1991-2015 Free Software Foundation, Inc.
 
This file is part of GNU Binutils.
 
62,7 → 60,6
#endif
#endif
 
 
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
115,6 → 112,10
extern int vsnprintf(char *, size_t, const char *, va_list);
#endif
 
#if !HAVE_DECL_STRNLEN
size_t strnlen (const char *, size_t);
#endif
 
#ifndef O_RDONLY
#define O_RDONLY 0
#endif
/contrib/toolchain/binutils/binutils/version.c
1,7 → 1,5
/* version.c -- binutils version information
Copyright 1991, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013
Free Software Foundation, Inc.
Copyright (C) 1991-2015 Free Software Foundation, Inc.
 
This file is part of GNU Binutils.
 
33,7 → 31,7
/* This output is intended to follow the GNU standards document. */
/* xgettext:c-format */
printf ("GNU %s %s\n", name, BFD_VERSION_STRING);
printf (_("Copyright 2013 Free Software Foundation, Inc.\n"));
printf (_("Copyright (C) 2015 Free Software Foundation, Inc.\n"));
printf (_("\
This program is free software; you may redistribute it under the terms of\n\
the GNU General Public License version 3 or (at your option) any later version.\n\
/contrib/toolchain/binutils/binutils/wrstabs.c
1,6 → 1,5
/* wrstabs.c -- Output stabs debugging information
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006,
2007, 2009 Free Software Foundation, Inc.
Copyright (C) 1996-2015 Free Software Foundation, Inc.
Written by Ian Lance Taylor <ian@cygnus.com>.
 
This file is part of GNU Binutils.