2 Copyright (C) 1991-2024 Free Software Foundation, Inc.
4 This file is part of the GNU Binutils.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
19 MA 02110-1301, USA. */
26 /* Codes used for the long options with no short synonyms. 150 isn't
27 special; it's just an arbitrary non-ASCII char value. */
35 OPTION_DYNAMIC_LINKER
,
36 OPTION_NO_DYNAMIC_LINKER
,
41 OPTION_EMBEDDED_RELOCS
,
42 OPTION_EXPORT_DYNAMIC
,
43 OPTION_NO_EXPORT_DYNAMIC
,
48 OPTION_NO_KEEP_MEMORY
,
49 OPTION_NO_WARN_MISMATCH
,
50 OPTION_NO_WARN_SEARCH_MISMATCH
,
51 OPTION_NOINHIBIT_EXEC
,
53 OPTION_NO_WHOLE_ARCHIVE
,
58 OPTION_RETAIN_SYMBOLS_FILE
,
65 OPTION_SECTION_ORDERING_FILE
,
68 OPTION_SYMBOLIC_FUNCTIONS
,
74 OPTION_TRODATA_SEGMENT
,
75 OPTION_TLDATA_SEGMENT
,
76 OPTION_TRADITIONAL_FORMAT
,
80 OPTION_VERSION_SCRIPT
,
81 OPTION_VERSION_EXPORTS_SECTION
,
83 OPTION_DYNAMIC_LIST_CPP_NEW
,
84 OPTION_DYNAMIC_LIST_CPP_TYPEINFO
,
85 OPTION_DYNAMIC_LIST_DATA
,
86 OPTION_EXPORT_DYNAMIC_SYMBOL
,
87 OPTION_EXPORT_DYNAMIC_SYMBOL_LIST
,
89 OPTION_WARN_CONSTRUCTORS
,
93 OPTION_WARN_MULTIPLE_GP
,
95 OPTION_WARN_SECTION_ALIGN
,
96 OPTION_SPLIT_BY_RELOC
,
97 OPTION_SPLIT_BY_FILE
,
99 OPTION_ADD_DT_NEEDED_FOR_DYNAMIC
,
100 OPTION_NO_ADD_DT_NEEDED_FOR_DYNAMIC
,
101 OPTION_ADD_DT_NEEDED_FOR_REGULAR
,
102 OPTION_NO_ADD_DT_NEEDED_FOR_REGULAR
,
104 OPTION_FORCE_EXE_SUFFIX
,
106 OPTION_NO_GC_SECTIONS
,
107 OPTION_PRINT_GC_SECTIONS
,
108 OPTION_NO_PRINT_GC_SECTIONS
,
109 OPTION_GC_KEEP_EXPORTED
,
111 OPTION_CHECK_SECTIONS
,
112 OPTION_NO_CHECK_SECTIONS
,
116 OPTION_SECTION_START
,
119 OPTION_ALLOW_SHLIB_UNDEFINED
,
120 OPTION_NO_ALLOW_SHLIB_UNDEFINED
,
121 OPTION_ALLOW_MULTIPLE_DEFINITION
,
122 #if SUPPORT_ERROR_HANDLING_SCRIPT
123 OPTION_ERROR_HANDLING_SCRIPT
,
125 OPTION_UNDEFINED_VERSION
,
126 OPTION_NO_UNDEFINED_VERSION
,
127 OPTION_DEFAULT_SYMVER
,
128 OPTION_DEFAULT_IMPORTED_SYMVER
,
130 OPTION_SPARE_DYNAMIC_TAGS
,
131 OPTION_NO_DEFINE_COMMON
,
134 OPTION_STRIP_DISCARDED
,
135 OPTION_NO_STRIP_DISCARDED
,
136 OPTION_ACCEPT_UNKNOWN_INPUT_ARCH
,
137 OPTION_NO_ACCEPT_UNKNOWN_INPUT_ARCH
,
140 OPTION_UNRESOLVED_SYMBOLS
,
141 OPTION_WARN_UNRESOLVED_SYMBOLS
,
142 OPTION_ERROR_UNRESOLVED_SYMBOLS
,
144 OPTION_WARN_ALTERNATE_EM
,
145 OPTION_REDUCE_MEMORY_OVERHEADS
,
146 OPTION_MAX_CACHE_SIZE
,
147 #if BFD_SUPPORTS_PLUGINS
150 OPTION_PLUGIN_SAVE_TEMPS
,
151 #endif /* BFD_SUPPORTS_PLUGINS */
152 OPTION_DEFAULT_SCRIPT
,
153 OPTION_PRINT_OUTPUT_FORMAT
,
154 OPTION_PRINT_SYSROOT
,
155 OPTION_IGNORE_UNRESOLVED_SYMBOL
,
158 OPTION_DISABLE_MULTIPLE_DEFS_ABS
,
159 OPTION_PRINT_MEMORY_USAGE
,
160 OPTION_REQUIRE_DEFINED_SYMBOL
,
161 OPTION_ORPHAN_HANDLING
,
162 OPTION_FORCE_GROUP_ALLOCATION
,
163 OPTION_PRINT_MAP_DISCARDED
,
164 OPTION_NO_PRINT_MAP_DISCARDED
,
165 OPTION_PRINT_MAP_LOCALS
,
166 OPTION_NO_PRINT_MAP_LOCALS
,
167 OPTION_NON_CONTIGUOUS_REGIONS
,
168 OPTION_NON_CONTIGUOUS_REGIONS_WARNINGS
,
169 OPTION_DEPENDENCY_FILE
,
170 OPTION_CTF_VARIABLES
,
171 OPTION_NO_CTF_VARIABLES
,
172 OPTION_CTF_SHARE_TYPES
,
173 OPTION_ERROR_EXECSTACK
,
174 OPTION_NO_ERROR_EXECSTACK
,
175 OPTION_WARN_EXECSTACK_OBJECTS
,
176 OPTION_WARN_EXECSTACK
,
177 OPTION_NO_WARN_EXECSTACK
,
178 OPTION_WARN_RWX_SEGMENTS
,
179 OPTION_NO_WARN_RWX_SEGMENTS
,
180 OPTION_ERROR_RWX_SEGMENTS
,
181 OPTION_NO_ERROR_RWX_SEGMENTS
,
182 OPTION_ENABLE_LINKER_VERSION
,
183 OPTION_DISABLE_LINKER_VERSION
,
185 OPTION_REMAP_INPUTS_FILE
,
186 /* Used by emultempl/elf.em, emultempl/pe.em and emultempl/pep.em. */
189 /* Used by emulparams/elf32mcore.sh, emultempl/beos.em, emultempl/pe.em
190 and emultempl/pep.em. */
192 /* Used by emultempl/ppc32elf.em and emultempl/ppc64elf.em. */
193 OPTION_NO_INLINE_OPT
,
196 OPTION_NO_TLS_GET_ADDR_OPT
,
200 /* Used by emultempl/armelf.em and emultempl/tic6xdsbt.em. */
201 OPTION_NO_MERGE_EXIDX_ENTRIES
,
202 /* Used by emultempl/aarch64elf.em and emultempl/armelf.em. */
204 OPTION_NO_ENUM_SIZE_WARNING
,
205 OPTION_NO_WCHAR_SIZE_WARNING
,
206 /* Used by emultempl/armelf.em and emultempl/pe.em. */
208 /* Used by emultempl/beos.em, emultempl/nto.em, emultempl/pe.em and
211 /* Used by emultempl/aarch64elf.em, emultempl/armelf.em,
212 emultempl/cskyelf.em, emultempl/hppaelf.em, emultempl/metagelf.em
213 and emultempl/ppc64elf.em. */
214 OPTION_STUBGROUP_SIZE
,
215 /* Used by emulparams/plt_unwind.sh. */
216 OPTION_LD_GENERATED_UNWIND_INFO
,
217 OPTION_NO_LD_GENERATED_UNWIND_INFO
,
218 /* Used by emultempl/aarch64elf.em. */
219 OPTION_FIX_ERRATUM_835769
,
220 OPTION_FIX_ERRATUM_843419
,
221 OPTION_NO_APPLY_DYNAMIC_RELOCS
,
222 /* Used by emultempl/aix.em. */
247 /* Used by emultempl/alphaelf.em. */
251 /* Used by emultempl/armelf.em. */
258 OPTION_VFP11_DENORM_FIX
,
259 OPTION_FIX_V4BX_INTERWORKING
,
260 OPTION_FIX_CORTEX_A8
,
261 OPTION_NO_FIX_CORTEX_A8
,
263 OPTION_NO_FIX_ARM1176
,
265 OPTION_STM32L4XX_FIX
,
268 /* Used by emultempl/avrelf.em. */
269 OPTION_NO_CALL_RET_REPLACEMENT
,
270 OPTION_PMEM_WRAP_AROUND
,
274 /* Used by emultempl/bfin.em. */
277 /* Used by emultempl/cskyelf.em. */
279 OPTION_NO_BRANCH_STUB
,
280 /* Used by emultempl/elf.em. */
281 OPTION_DISABLE_NEW_DTAGS
,
282 OPTION_ENABLE_NEW_DTAGS
,
285 OPTION_NO_EH_FRAME_HDR
,
287 OPTION_PACKAGE_METADATA
,
289 OPTION_COMPRESS_DEBUG
,
292 /* Used by emultempl/hppaelf.em. */
293 OPTION_MULTI_SUBSPACE
,
294 /* Used by emultempl/ia64elf.em. */
296 /* Used by emultempl/m68hc1xelf.em. */
297 OPTION_NO_TRAMPOLINE
,
299 /* Used by emultempl/m68kelf.em. */
301 /* Used by emultempl/mipself.em. */
304 OPTION_IGNORE_BRANCH_ISA
,
305 OPTION_NO_IGNORE_BRANCH_ISA
,
306 OPTION_COMPACT_BRANCHES
,
307 OPTION_NO_COMPACT_BRANCHES
,
308 /* Used by emultempl/msp430.em. */
311 OPTION_DISABLE_TRANS
,
312 /* Used by emultempl/nds32elf.em. */
314 OPTION_ELIM_GC_RELOCS
,
317 OPTION_REDUCE_FP_UPDATE
,
318 OPTION_NO_REDUCE_FP_UPDATE
,
319 OPTION_EXPORT_SYMBOLS
,
321 OPTION_TLSDESC_TRAMPOLINE
,
322 OPTION_NO_TLSDESC_TRAMPOLINE
,
323 /* Used by emultempl/nto.em. */
325 /* Used by emultempl/pe.em, emultempl/pep.em and emultempl/beos.em. */
327 OPTION_FILE_ALIGNMENT
,
329 OPTION_MAJOR_IMAGE_VERSION
,
330 OPTION_MAJOR_OS_VERSION
,
331 OPTION_MAJOR_SUBSYSTEM_VERSION
,
332 OPTION_MINOR_IMAGE_VERSION
,
333 OPTION_MINOR_OS_VERSION
,
334 OPTION_MINOR_SUBSYSTEM_VERSION
,
335 OPTION_SECTION_ALIGNMENT
,
338 OPTION_SUPPORT_OLD_CODE
,
341 OPTION_EXCLUDE_SYMBOLS
,
342 OPTION_EXCLUDE_ALL_SYMBOLS
,
344 OPTION_STDCALL_ALIASES
,
345 OPTION_ENABLE_STDCALL_FIXUP
,
346 OPTION_DISABLE_STDCALL_FIXUP
,
347 OPTION_WARN_DUPLICATE_EXPORTS
,
349 OPTION_ENABLE_AUTO_IMAGE_BASE
,
350 OPTION_DISABLE_AUTO_IMAGE_BASE
,
351 OPTION_DLL_SEARCH_PREFIX
,
352 OPTION_NO_DEFAULT_EXCLUDES
,
353 OPTION_DLL_ENABLE_AUTO_IMPORT
,
354 OPTION_DLL_DISABLE_AUTO_IMPORT
,
355 OPTION_ENABLE_EXTRA_PE_DEBUG
,
356 OPTION_DLL_ENABLE_RUNTIME_PSEUDO_RELOC
,
357 OPTION_DLL_DISABLE_RUNTIME_PSEUDO_RELOC
,
358 OPTION_LARGE_ADDRESS_AWARE
,
359 OPTION_DISABLE_LARGE_ADDRESS_AWARE
,
360 OPTION_DLL_ENABLE_RUNTIME_PSEUDO_RELOC_V1
,
361 OPTION_DLL_ENABLE_RUNTIME_PSEUDO_RELOC_V2
,
362 OPTION_EXCLUDE_MODULES_FOR_IMPLIB
,
363 OPTION_USE_NUL_PREFIXED_IMPORT_TABLES
,
364 OPTION_NO_LEADING_UNDERSCORE
,
365 OPTION_LEADING_UNDERSCORE
,
366 OPTION_ENABLE_LONG_SECTION_NAMES
,
367 OPTION_DISABLE_LONG_SECTION_NAMES
,
368 /* DLLCharacteristics flags. */
370 OPTION_FORCE_INTEGRITY
,
376 OPTION_TERMINAL_SERVER_AWARE
,
378 OPTION_INSERT_TIMESTAMP
,
379 OPTION_NO_INSERT_TIMESTAMP
,
381 OPTION_ENABLE_RELOC_SECTION
,
382 OPTION_DISABLE_RELOC_SECTION
,
383 /* DLL Characteristics flags. */
384 OPTION_DISABLE_DYNAMIC_BASE
,
385 OPTION_DISABLE_FORCE_INTEGRITY
,
386 OPTION_DISABLE_NX_COMPAT
,
387 OPTION_DISABLE_NO_ISOLATION
,
388 OPTION_DISABLE_NO_SEH
,
389 OPTION_DISABLE_NO_BIND
,
390 OPTION_DISABLE_WDM_DRIVER
,
391 OPTION_DISABLE_TERMINAL_SERVER_AWARE
,
392 /* Used by emultempl/pep.em. */
393 OPTION_DISABLE_HIGH_ENTROPY_VA
,
394 OPTION_HIGH_ENTROPY_VA
,
395 /* Used by emultempl/ppc32elf.em. */
399 OPTION_PPC476_WORKAROUND
,
400 OPTION_NO_PPC476_WORKAROUND
,
402 OPTION_VLE_RELOC_FIXUP
,
403 /* Used by emultempl/ppc64elf.em. */
404 OPTION_PLT_STATIC_CHAIN
,
405 OPTION_NO_PLT_STATIC_CHAIN
,
406 OPTION_PLT_THREAD_SAFE
,
407 OPTION_NO_PLT_THREAD_SAFE
,
408 OPTION_PLT_LOCALENTRY
,
409 OPTION_NO_PLT_LOCALENTRY
,
410 OPTION_POWER10_STUBS
,
411 OPTION_NO_POWER10_STUBS
,
417 OPTION_TLS_GET_ADDR_OPT
,
418 OPTION_TLS_GET_ADDR_REGSAVE
,
419 OPTION_NO_TLS_GET_ADDR_REGSAVE
,
424 OPTION_NON_OVERLAPPING_OPD
,
425 /* Used by emultempl/riscvelf.em. */
428 OPTION_CHECK_ULEB128
,
429 OPTION_NO_CHECK_ULEB128
,
430 /* Used by emultempl/rxelf.em. */
431 OPTION_NO_FLAG_MISMATCH_WARNINGS
,
433 OPTION_NO_IGNORE_LMA
,
434 OPTION_FLAG_MISMATCH_WARNINGS
,
435 /* Used by emultempl/s390.em. */
437 /* Used by emultempl/spuelf.em. */
439 OPTION_SPU_NO_OVERLAYS
,
440 OPTION_SPU_COMPACT_STUBS
,
441 OPTION_SPU_STUB_SYMS
,
442 OPTION_SPU_NON_OVERLAY_STUBS
,
443 OPTION_SPU_LOCAL_STORE
,
444 OPTION_SPU_STACK_ANALYSIS
,
445 OPTION_SPU_STACK_SYMS
,
446 OPTION_SPU_AUTO_OVERLAY
,
447 OPTION_SPU_AUTO_RELINK
,
448 OPTION_SPU_OVERLAY_RODATA
,
449 OPTION_SPU_SOFT_ICACHE
,
450 OPTION_SPU_LINE_SIZE
,
451 OPTION_SPU_NUM_LINES
,
453 OPTION_SPU_NON_IA_TEXT
,
454 OPTION_SPU_FIXED_SPACE
,
455 OPTION_SPU_RESERVED_SPACE
,
456 OPTION_SPU_EXTRA_STACK
,
457 OPTION_SPU_NO_AUTO_OVERLAY
,
458 OPTION_SPU_EMIT_FIXUPS
,
459 /* Used by emultempl/tic6xdsbt.em. */
462 /* Used by emultempl/ticoff.em. */
464 /* Used by emultempl/vms.em. */
465 OPTION_IDENTIFICATION
,
466 /* Used by emultempl/vxworks.em. */
467 OPTION_FORCE_DYNAMIC
,
468 /* Used by emultempl/xtensaelf.em. */
470 OPTION_LITERAL_MOVEMENT
,
471 OPTION_NO_LITERAL_MOVEMENT
,
476 /* The initial parser states. */
477 typedef enum input_enum
479 input_selected
, /* We've set the initial state. */
482 input_version_script
,
483 input_section_ordering_script
,
488 extern input_type parser_input
;
490 extern unsigned int lineno
;
491 extern const char *lex_string
;
494 extern int yylex (void);
495 extern void lex_push_file (FILE *, const char *, unsigned int);
496 extern void lex_redirect (const char *, const char *, unsigned int);
497 extern void ldlex_script (void);
498 extern void ldlex_inputlist (void);
499 extern void ldlex_mri_script (void);
500 extern void ldlex_version_script (void);
501 extern void ldlex_version_file (void);
502 extern void ldlex_expression (void);
503 extern void ldlex_wild (void);
504 extern void ldlex_popstate (void);
505 extern void ldlex_backup (void);
506 extern const char* ldlex_filename (void);
509 extern int lex_input (void);
510 extern void lex_unput (int);
511 extern void parse_args (unsigned, char **);