1 /* yyscript.y -- linker script grammer for gold. */
3 /* This is a bison grammar to parse a subset of the original GNU ld
4 linker script language. */
17 /* We need to use a pure parser because we might be multi-threaded.
18 We pass some arguments through the parser to the lexer. */
22 %parse
-param
{void* closure
}
23 %lex
-param
{void* closure
}
25 /* Since we require bison anyhow, we take advantage of it. */
29 /* The values associated with tokens. */
36 /* Operators, including a precedence table for expressions. */
38 %right PLUSEQ MINUSEQ MULTEQ DIVEQ
'=' LSHIFTEQ RSHIFTEQ ANDEQ OREQ
53 %token
<string> STRING
54 %token
<integer
> INTEGER
56 /* Keywords. This list is taken from ldgram.y and ldlex.l in the old
57 GNU linker, with the keywords which only appear in MRI mode
58 removed. Not all these keywords are actually used in this grammar.
59 In most cases the keyword is recognized as the token name in upper
60 case. The comments indicate where this is not the case. */
64 %token ALIGN_K
/* ALIGN */
65 %token ASSERT_K
/* ASSERT */
74 %token CREATE_OBJECT_SYMBOLS
75 %token DATA_SEGMENT_ALIGN
76 %token DATA_SEGMENT_END
77 %token DATA_SEGMENT_RELRO_END
85 %token FORCE_COMMON_ALLOCATION
86 %token GLOBAL
/* global */
91 %token INHIBIT_COMMON_ALLOCATION
94 %token LENGTH
/* LENGTH, l, len */
96 %token LOCAL
/* local */
99 %token MAX_K
/* MAX */
101 %token MIN_K
/* MIN */
108 %token ORIGIN
/* ORIGIN, o, org */
115 %token PROVIDE_HIDDEN
122 %token SIZEOF_HEADERS
/* SIZEOF_HEADERS, sizeof_headers */
123 %token SORT_BY_ALIGNMENT
130 %token TARGET_K
/* TARGET */
132 %token VERSIONK
/* VERSION */
142 OUTPUT_FORMAT
'(' STRING
')'
144 { script_start_group
(closure
); }
146 { script_end_group
(closure
); }
151 | input_list opt_comma input_list_element
156 { script_add_file
(closure
, $1); }
158 { script_start_as_needed
(closure
); }
160 { script_end_as_needed
(closure
); }