(linenum→info "unix/slp.c:2238")

binutils/2.18/ld/ldgram.c

    1: /* A Bison parser, made by GNU Bison 2.3.  */
    2: 
    3: /* Skeleton implementation for Bison's Yacc-like parsers in C
    4: 
    5:    Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
    6:    Free Software Foundation, Inc.
    7: 
    8:    This program is free software; you can redistribute it and/or modify
    9:    it under the terms of the GNU General Public License as published by
   10:    the Free Software Foundation; either version 2, or (at your option)
   11:    any later version.
   12: 
   13:    This program is distributed in the hope that it will be useful,
   14:    but WITHOUT ANY WARRANTY; without even the implied warranty of
   15:    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   16:    GNU General Public License for more details.
   17: 
   18:    You should have received a copy of the GNU General Public License
   19:    along with this program; if not, write to the Free Software
   20:    Foundation, Inc., 51 Franklin Street, Fifth Floor,
   21:    Boston, MA 02110-1301, USA.  */
   22: 
   23: /* As a special exception, you may create a larger work that contains
   24:    part or all of the Bison parser skeleton and distribute that work
   25:    under terms of your choice, so long as that work isn't itself a
   26:    parser generator using the skeleton or a modified version thereof
   27:    as a parser skeleton.  Alternatively, if you modify or redistribute
   28:    the parser skeleton itself, you may (at your option) remove this
   29:    special exception, which will cause the skeleton and the resulting
   30:    Bison output files to be licensed under the GNU General Public
   31:    License without this special exception.
   32: 
   33:    This special exception was added by the Free Software Foundation in
   34:    version 2.2 of Bison.  */
   35: 
   36: /* C LALR(1) parser skeleton written by Richard Stallman, by
   37:    simplifying the original so-called "semantic" parser.  */
   38: 
   39: /* All symbols defined below should begin with yy or YY, to avoid
   40:    infringing on user name space.  This should be done even for local
   41:    variables, as they might otherwise be expanded by user macros.
   42:    There are some unavoidable exceptions within include files to
   43:    define necessary library symbols; they are noted "INFRINGES ON
   44:    USER NAME SPACE" below.  */
   45: 
   46: /* Identify Bison output.  */
   47: #define YYBISON 1
   48: 
   49: /* Bison version.  */
   50: #define YYBISON_VERSION "2.3"
   51: 
   52: /* Skeleton name.  */
   53: #define YYSKELETON_NAME "yacc.c"
   54: 
   55: /* Pure parsers.  */
   56: #define YYPURE 0
   57: 
   58: /* Using locations.  */
   59: #define YYLSP_NEEDED 0
   60: 
   61: 
   62: 
   63: /* Tokens.  */
   64: #ifndef YYTOKENTYPE
   65: # define YYTOKENTYPE
   66:    /* Put the tokens into the symbol table, so that GDB and other debuggers
   67:       know about them.  */
   68:    enum yytokentype {
   69:      INT = 258,
   70:      NAME = 259,
   71:      LNAME = 260,
   72:      OREQ = 261,
   73:      ANDEQ = 262,
   74:      RSHIFTEQ = 263,
   75:      LSHIFTEQ = 264,
   76:      DIVEQ = 265,
   77:      MULTEQ = 266,
   78:      MINUSEQ = 267,
   79:      PLUSEQ = 268,
   80:      OROR = 269,
   81:      ANDAND = 270,
   82:      NE = 271,
   83:      EQ = 272,
   84:      GE = 273,
   85:      LE = 274,
   86:      RSHIFT = 275,
   87:      LSHIFT = 276,
   88:      UNARY = 277,
   89:      END = 278,
   90:      ALIGN_K = 279,
   91:      BLOCK = 280,
   92:      BIND = 281,
   93:      QUAD = 282,
   94:      SQUAD = 283,
   95:      LONG = 284,
   96:      SHORT = 285,
   97:      BYTE = 286,
   98:      SECTIONS = 287,
   99:      PHDRS = 288,
  100:      DATA_SEGMENT_ALIGN = 289,
  101:      DATA_SEGMENT_RELRO_END = 290,
  102:      DATA_SEGMENT_END = 291,
  103:      SORT_BY_NAME = 292,
  104:      SORT_BY_ALIGNMENT = 293,
  105:      SIZEOF_HEADERS = 294,
  106:      OUTPUT_FORMAT = 295,
  107:      FORCE_COMMON_ALLOCATION = 296,
  108:      OUTPUT_ARCH = 297,
  109:      INHIBIT_COMMON_ALLOCATION = 298,
  110:      SEGMENT_START = 299,
  111:      INCLUDE = 300,
  112:      MEMORY = 301,
  113:      NOLOAD = 302,
  114:      DSECT = 303,
  115:      COPY = 304,
  116:      INFO = 305,
  117:      OVERLAY = 306,
  118:      DEFINED = 307,
  119:      TARGET_K = 308,
  120:      SEARCH_DIR = 309,
  121:      MAP = 310,
  122:      ENTRY = 311,
  123:      NEXT = 312,
  124:      SIZEOF = 313,
  125:      ALIGNOF = 314,
  126:      ADDR = 315,
  127:      LOADADDR = 316,
  128:      MAX_K = 317,
  129:      MIN_K = 318,
  130:      STARTUP = 319,
  131:      HLL = 320,
  132:      SYSLIB = 321,
  133:      FLOAT = 322,
  134:      NOFLOAT = 323,
  135:      NOCROSSREFS = 324,
  136:      ORIGIN = 325,
  137:      FILL = 326,
  138:      LENGTH = 327,
  139:      CREATE_OBJECT_SYMBOLS = 328,
  140:      INPUT = 329,
  141:      GROUP = 330,
  142:      OUTPUT = 331,
  143:      CONSTRUCTORS = 332,
  144:      ALIGNMOD = 333,
  145:      AT = 334,
  146:      SUBALIGN = 335,
  147:      PROVIDE = 336,
  148:      PROVIDE_HIDDEN = 337,
  149:      AS_NEEDED = 338,
  150:      CHIP = 339,
  151:      LIST = 340,
  152:      SECT = 341,
  153:      ABSOLUTE = 342,
  154:      LOAD = 343,
  155:      NEWLINE = 344,
  156:      ENDWORD = 345,
  157:      ORDER = 346,
  158:      NAMEWORD = 347,
  159:      ASSERT_K = 348,
  160:      FORMAT = 349,
  161:      PUBLIC = 350,
  162:      DEFSYMEND = 351,
  163:      BASE = 352,
  164:      ALIAS = 353,
  165:      TRUNCATE = 354,
  166:      REL = 355,
  167:      INPUT_SCRIPT = 356,
  168:      INPUT_MRI_SCRIPT = 357,
  169:      INPUT_DEFSYM = 358,
  170:      CASE = 359,
  171:      EXTERN = 360,
  172:      START = 361,
  173:      VERS_TAG = 362,
  174:      VERS_IDENTIFIER = 363,
  175:      GLOBAL = 364,
  176:      LOCAL = 365,
  177:      VERSIONK = 366,
  178:      INPUT_VERSION_SCRIPT = 367,
  179:      KEEP = 368,
  180:      ONLY_IF_RO = 369,
  181:      ONLY_IF_RW = 370,
  182:      SPECIAL = 371,
  183:      EXCLUDE_FILE = 372,
  184:      CONSTANT = 373,
  185:      INPUT_DYNAMIC_LIST = 374
  186:    };
  187: #endif
  188: /* Tokens.  */
  189: #define INT 258
  190: #define NAME 259
  191: #define LNAME 260
  192: #define OREQ 261
  193: #define ANDEQ 262
  194: #define RSHIFTEQ 263
  195: #define LSHIFTEQ 264
  196: #define DIVEQ 265
  197: #define MULTEQ 266
  198: #define MINUSEQ 267
  199: #define PLUSEQ 268
  200: #define OROR 269
  201: #define ANDAND 270
  202: #define NE 271
  203: #define EQ 272
  204: #define GE 273
  205: #define LE 274
  206: #define RSHIFT 275
  207: #define LSHIFT 276
  208: #define UNARY 277
  209: #define END 278
  210: #define ALIGN_K 279
  211: #define BLOCK 280
  212: #define BIND 281
  213: #define QUAD 282
  214: #define SQUAD 283
  215: #define LONG 284
  216: #define SHORT 285
  217: #define BYTE 286
  218: #define SECTIONS 287
  219: #define PHDRS 288
  220: #define DATA_SEGMENT_ALIGN 289
  221: #define DATA_SEGMENT_RELRO_END 290
  222: #define DATA_SEGMENT_END 291
  223: #define SORT_BY_NAME 292
  224: #define SORT_BY_ALIGNMENT 293
  225: #define SIZEOF_HEADERS 294
  226: #define OUTPUT_FORMAT 295
  227: #define FORCE_COMMON_ALLOCATION 296
  228: #define OUTPUT_ARCH 297
  229: #define INHIBIT_COMMON_ALLOCATION 298
  230: #define SEGMENT_START 299
  231: #define INCLUDE 300
  232: #define MEMORY 301
  233: #define NOLOAD 302
  234: #define DSECT 303
  235: #define COPY 304
  236: #define INFO 305
  237: #define OVERLAY 306
  238: #define DEFINED 307
  239: #define TARGET_K 308
  240: #define SEARCH_DIR 309
  241: #define MAP 310
  242: #define ENTRY 311
  243: #define NEXT 312
  244: #define SIZEOF 313
  245: #define ALIGNOF 314
  246: #define ADDR 315
  247: #define LOADADDR 316
  248: #define MAX_K 317
  249: #define MIN_K 318
  250: #define STARTUP 319
  251: #define HLL 320
  252: #define SYSLIB 321
  253: #define FLOAT 322
  254: #define NOFLOAT 323
  255: #define NOCROSSREFS 324
  256: #define ORIGIN 325
  257: #define FILL 326
  258: #define LENGTH 327
  259: #define CREATE_OBJECT_SYMBOLS 328
  260: #define INPUT 329
  261: #define GROUP 330
  262: #define OUTPUT 331
  263: #define CONSTRUCTORS 332
  264: #define ALIGNMOD 333
  265: #define AT 334
  266: #define SUBALIGN 335
  267: #define PROVIDE 336
  268: #define PROVIDE_HIDDEN 337
  269: #define AS_NEEDED 338
  270: #define CHIP 339
  271: #define LIST 340
  272: #define SECT 341
  273: #define ABSOLUTE 342
  274: #define LOAD 343
  275: #define NEWLINE 344
  276: #define ENDWORD 345
  277: #define ORDER 346
  278: #define NAMEWORD 347
  279: #define ASSERT_K 348
  280: #define FORMAT 349
  281: #define PUBLIC 350
  282: #define DEFSYMEND 351
  283: #define BASE 352
  284: #define ALIAS 353
  285: #define TRUNCATE 354
  286: #define REL 355
  287: #define INPUT_SCRIPT 356
  288: #define INPUT_MRI_SCRIPT 357
  289: #define INPUT_DEFSYM 358
  290: #define CASE 359
  291: #define EXTERN 360
  292: #define START 361
  293: #define VERS_TAG 362
  294: #define VERS_IDENTIFIER 363
  295: #define GLOBAL 364
  296: #define LOCAL 365
  297: #define VERSIONK 366
  298: #define INPUT_VERSION_SCRIPT 367
  299: #define KEEP 368
  300: #define ONLY_IF_RO 369
  301: #define ONLY_IF_RW 370
  302: #define SPECIAL 371
  303: #define EXCLUDE_FILE 372
  304: #define CONSTANT 373
  305: #define INPUT_DYNAMIC_LIST 374
  306: 
  307: 
  308: 
  309: 
  310: /* Copy the first part of user declarations.  */
  311: #line 23 "ldgram.y"
  312: 
  313: /*
  314: 
  315:  */
  316: 
  317: #define DONTDECLARE_MALLOC
  318: 
  319: #include "sysdep.h"
  320: #include "bfd.h"
  321: #include "bfdlink.h"
  322: #include "ld.h"
  323: #include "ldexp.h"
  324: #include "ldver.h"
  325: #include "ldlang.h"
  326: #include "ldfile.h"
  327: #include "ldemul.h"
  328: #include "ldmisc.h"
  329: #include "ldmain.h"
  330: #include "mri.h"
  331: #include "ldctor.h"
  332: #include "ldlex.h"
  333: 
  334: #ifndef YYDEBUG
  335: #define YYDEBUG 1
  336: #endif
  337: 
  338: static enum section_type sectype;
  339: static lang_memory_region_type *region;
  340: 
  341: FILE *saved_script_handle = NULL;
  342: bfd_boolean force_make_executable = FALSE;
  343: 
  344: bfd_boolean ldgram_in_script = FALSE;
  345: bfd_boolean ldgram_had_equals = FALSE;
  346: bfd_boolean ldgram_had_keep = FALSE;
  347: char *ldgram_vers_current_lang = NULL;
  348: 
  349: #define ERROR_NAME_MAX 20
  350: static char *error_names[ERROR_NAME_MAX];
  351: static int error_index;
  352: #define PUSH_ERROR(x) if (error_index < ERROR_NAME_MAX) error_names[error_index] = x; error_index++;
  353: #define POP_ERROR()   error_index--;
  354: 
  355: 
  356: /* Enabling traces.  */
  357: #ifndef YYDEBUG
  358: # define YYDEBUG 0
  359: #endif
  360: 
  361: /* Enabling verbose error messages.  */
  362: #ifdef YYERROR_VERBOSE
  363: # undef YYERROR_VERBOSE
  364: # define YYERROR_VERBOSE 1
  365: #else
  366: # define YYERROR_VERBOSE 0
  367: #endif
  368: 
  369: /* Enabling the token table.  */
  370: #ifndef YYTOKEN_TABLE
  371: # define YYTOKEN_TABLE 0
  372: #endif
  373: 
  374: #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
  375: typedef union YYSTYPE
  376: #line 66 "ldgram.y"
  377: {
  378:   bfd_vma integer;
  379:   struct big_int
  380:     {
  381:       bfd_vma integer;
  382:       char *str;
  383:     } bigint;
  384:   fill_type *fill;
  385:   char *name;
  386:   const char *cname;
  387:   struct wildcard_spec wildcard;
  388:   struct wildcard_list *wildcard_list;
  389:   struct name_list *name_list;
  390:   int token;
  391:   union etree_union *etree;
  392:   struct phdr_info
  393:     {
  394:       bfd_boolean filehdr;
  395:       bfd_boolean phdrs;
  396:       union etree_union *at;
  397:       union etree_union *flags;
  398:     } phdr;
  399:   struct lang_nocrossref *nocrossref;
  400:   struct lang_output_section_phdr_list *section_phdr;
  401:   struct bfd_elf_version_deps *deflist;
  402:   struct bfd_elf_version_expr *versyms;
  403:   struct bfd_elf_version_tree *versnode;
  404: }
  405: /* Line 187 of yacc.c.  */
  406: #line 407 "ldgram.c"
  407:         YYSTYPE;
  408: # define yystype YYSTYPE /* obsolescent; will be withdrawn */
  409: # define YYSTYPE_IS_DECLARED 1
  410: # define YYSTYPE_IS_TRIVIAL 1
  411: #endif
  412: 
  413: 
  414: 
  415: /* Copy the second part of user declarations.  */
  416: 
  417: 
  418: /* Line 216 of yacc.c.  */
  419: #line 420 "ldgram.c"
  420: 
  421: #ifdef short
  422: # undef short
  423: #endif
  424: 
  425: #ifdef YYTYPE_UINT8
  426: typedef YYTYPE_UINT8 yytype_uint8;
  427: #else
  428: typedef unsigned char yytype_uint8;
  429: #endif
  430: 
  431: #ifdef YYTYPE_INT8
  432: typedef YYTYPE_INT8 yytype_int8;
  433: #elif (defined __STDC__ || defined __C99__FUNC__ \
  434:      || defined __cplusplus || defined _MSC_VER)
  435: typedef signed char yytype_int8;
  436: #else
  437: typedef short int yytype_int8;
  438: #endif
  439: 
  440: #ifdef YYTYPE_UINT16
  441: typedef YYTYPE_UINT16 yytype_uint16;
  442: #else
  443: typedef unsigned short int yytype_uint16;
  444: #endif
  445: 
  446: #ifdef YYTYPE_INT16
  447: typedef YYTYPE_INT16 yytype_int16;
  448: #else
  449: typedef short int yytype_int16;
  450: #endif
  451: 
  452: #ifndef YYSIZE_T
  453: # ifdef __SIZE_TYPE__
  454: #  define YYSIZE_T __SIZE_TYPE__
  455: # elif defined size_t
  456: #  define YYSIZE_T size_t
  457: # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
  458:      || defined __cplusplus || defined _MSC_VER)
  459: #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
  460: #  define YYSIZE_T size_t
  461: # else
  462: #  define YYSIZE_T unsigned int
  463: # endif
  464: #endif
  465: 
  466: #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
  467: 
  468: #ifndef YY_
  469: # if YYENABLE_NLS
  470: #  if ENABLE_NLS
  471: #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
  472: #   define YY_(msgid) dgettext ("bison-runtime", msgid)
  473: #  endif
  474: # endif
  475: # ifndef YY_
  476: #  define YY_(msgid) msgid
  477: # endif
  478: #endif
  479: 
  480: /* Suppress unused-variable warnings by "using" E.  */
  481: #if ! defined lint || defined __GNUC__
  482: # define YYUSE(e) ((void) (e))
  483: #else
  484: # define YYUSE(e) /* empty */
  485: #endif
  486: 
  487: /* Identity function, used to suppress warnings about constant conditions.  */
  488: #ifndef lint
  489: # define YYID(n) (n)
  490: #else
  491: #if (defined __STDC__ || defined __C99__FUNC__ \
  492:      || defined __cplusplus || defined _MSC_VER)
  493: static int
  494: YYID (int i)
  495: #else
  496: static int
  497: YYID (i)
  498:     int i;
  499: #endif
  500: {
  501:   return i;
  502: }
  503: #endif
  504: 
  505: #if ! defined yyoverflow || YYERROR_VERBOSE
  506: 
  507: /* The parser invokes alloca or malloc; define the necessary symbols.  */
  508: 
  509: # ifdef YYSTACK_USE_ALLOCA
  510: #  if YYSTACK_USE_ALLOCA
  511: #   ifdef __GNUC__
  512: #    define YYSTACK_ALLOC __builtin_alloca
  513: #   elif defined __BUILTIN_VA_ARG_INCR
  514: #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
  515: #   elif defined _AIX
  516: #    define YYSTACK_ALLOC __alloca
  517: #   elif defined _MSC_VER
  518: #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
  519: #    define alloca _alloca
  520: #   else
  521: #    define YYSTACK_ALLOC alloca
  522: #    if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
  523:      || defined __cplusplus || defined _MSC_VER)
  524: #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
  525: #     ifndef _STDLIB_H
  526: #      define _STDLIB_H 1
  527: #     endif
  528: #    endif
  529: #   endif
  530: #  endif
  531: # endif
  532: 
  533: # ifdef YYSTACK_ALLOC
  534:    /* Pacify GCC's `empty if-body' warning.  */
  535: #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (