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
,
67 OPTION_SYMBOLIC_FUNCTIONS
,
73 OPTION_TRODATA_SEGMENT
,
74 OPTION_TLDATA_SEGMENT
,
75 OPTION_TRADITIONAL_FORMAT
,
79 OPTION_VERSION_SCRIPT
,
80 OPTION_VERSION_EXPORTS_SECTION
,
82 OPTION_DYNAMIC_LIST_CPP_NEW
,
83 OPTION_DYNAMIC_LIST_CPP_TYPEINFO
,
84 OPTION_DYNAMIC_LIST_DATA
,
85 OPTION_EXPORT_DYNAMIC_SYMBOL
,
86 OPTION_EXPORT_DYNAMIC_SYMBOL_LIST
,
88 OPTION_WARN_CONSTRUCTORS
,
92 OPTION_WARN_MULTIPLE_GP
,
94 OPTION_WARN_SECTION_ALIGN
,
95 OPTION_SPLIT_BY_RELOC
,
96 OPTION_SPLIT_BY_FILE
,
98 OPTION_ADD_DT_NEEDED_FOR_DYNAMIC
,
99 OPTION_NO_ADD_DT_NEEDED_FOR_DYNAMIC
,
100 OPTION_ADD_DT_NEEDED_FOR_REGULAR
,
101 OPTION_NO_ADD_DT_NEEDED_FOR_REGULAR
,
103 OPTION_FORCE_EXE_SUFFIX
,
105 OPTION_NO_GC_SECTIONS
,
106 OPTION_PRINT_GC_SECTIONS
,
107 OPTION_NO_PRINT_GC_SECTIONS
,
108 OPTION_GC_KEEP_EXPORTED
,
110 OPTION_CHECK_SECTIONS
,
111 OPTION_NO_CHECK_SECTIONS
,
115 OPTION_SECTION_START
,
118 OPTION_ALLOW_SHLIB_UNDEFINED
,
119 OPTION_NO_ALLOW_SHLIB_UNDEFINED
,
120 OPTION_ALLOW_MULTIPLE_DEFINITION
,
121 #if SUPPORT_ERROR_HANDLING_SCRIPT
122 OPTION_ERROR_HANDLING_SCRIPT
,
124 OPTION_UNDEFINED_VERSION
,
125 OPTION_NO_UNDEFINED_VERSION
,
126 OPTION_DEFAULT_SYMVER
,
127 OPTION_DEFAULT_IMPORTED_SYMVER
,
129 OPTION_SPARE_DYNAMIC_TAGS
,
130 OPTION_NO_DEFINE_COMMON
,
133 OPTION_STRIP_DISCARDED
,
134 OPTION_NO_STRIP_DISCARDED
,
135 OPTION_ACCEPT_UNKNOWN_INPUT_ARCH
,
136 OPTION_NO_ACCEPT_UNKNOWN_INPUT_ARCH
,
139 OPTION_UNRESOLVED_SYMBOLS
,
140 OPTION_WARN_UNRESOLVED_SYMBOLS
,
141 OPTION_ERROR_UNRESOLVED_SYMBOLS
,
143 OPTION_WARN_ALTERNATE_EM
,
144 OPTION_REDUCE_MEMORY_OVERHEADS
,
145 OPTION_MAX_CACHE_SIZE
,
146 #if BFD_SUPPORTS_PLUGINS
149 OPTION_PLUGIN_SAVE_TEMPS
,
150 #endif /* BFD_SUPPORTS_PLUGINS */
151 OPTION_DEFAULT_SCRIPT
,
152 OPTION_PRINT_OUTPUT_FORMAT
,
153 OPTION_PRINT_SYSROOT
,
154 OPTION_IGNORE_UNRESOLVED_SYMBOL
,
157 OPTION_DISABLE_MULTIPLE_DEFS_ABS
,
158 OPTION_PRINT_MEMORY_USAGE
,
159 OPTION_REQUIRE_DEFINED_SYMBOL
,
160 OPTION_ORPHAN_HANDLING
,
161 OPTION_FORCE_GROUP_ALLOCATION
,
162 OPTION_PRINT_MAP_DISCARDED
,
163 OPTION_NO_PRINT_MAP_DISCARDED
,
164 OPTION_PRINT_MAP_LOCALS
,
165 OPTION_NO_PRINT_MAP_LOCALS
,
166 OPTION_NON_CONTIGUOUS_REGIONS
,
167 OPTION_NON_CONTIGUOUS_REGIONS_WARNINGS
,
168 OPTION_DEPENDENCY_FILE
,
169 OPTION_CTF_VARIABLES
,
170 OPTION_NO_CTF_VARIABLES
,
171 OPTION_CTF_SHARE_TYPES
,
172 OPTION_ERROR_EXECSTACK
,
173 OPTION_NO_ERROR_EXECSTACK
,
174 OPTION_WARN_EXECSTACK_OBJECTS
,
175 OPTION_WARN_EXECSTACK
,
176 OPTION_NO_WARN_EXECSTACK
,
177 OPTION_WARN_RWX_SEGMENTS
,
178 OPTION_NO_WARN_RWX_SEGMENTS
,
179 OPTION_ERROR_RWX_SEGMENTS
,
180 OPTION_NO_ERROR_RWX_SEGMENTS
,
181 OPTION_ENABLE_LINKER_VERSION
,
182 OPTION_DISABLE_LINKER_VERSION
,
184 OPTION_REMAP_INPUTS_FILE
,
185 /* Used by emultempl/elf.em, emultempl/pe.em and emultempl/pep.em. */
188 /* Used by emulparams/elf32mcore.sh, emultempl/beos.em, emultempl/pe.em
189 and emultempl/pep.em. */
191 /* Used by emultempl/ppc32elf.em and emultempl/ppc64elf.em. */
192 OPTION_NO_INLINE_OPT
,
195 OPTION_NO_TLS_GET_ADDR_OPT
,
199 /* Used by emultempl/armelf.em and emultempl/tic6xdsbt.em. */
200 OPTION_NO_MERGE_EXIDX_ENTRIES
,
201 /* Used by emultempl/aarch64elf.em and emultempl/armelf.em. */
203 OPTION_NO_ENUM_SIZE_WARNING
,
204 OPTION_NO_WCHAR_SIZE_WARNING
,
205 /* Used by emultempl/armelf.em and emultempl/pe.em. */
207 /* Used by emultempl/beos.em, emultempl/nto.em, emultempl/pe.em and
210 /* Used by emultempl/aarch64elf.em, emultempl/armelf.em,
211 emultempl/cskyelf.em, emultempl/hppaelf.em, emultempl/metagelf.em
212 and emultempl/ppc64elf.em. */
213 OPTION_STUBGROUP_SIZE
,
214 /* Used by emulparams/plt_unwind.sh. */
215 OPTION_LD_GENERATED_UNWIND_INFO
,
216 OPTION_NO_LD_GENERATED_UNWIND_INFO
,
217 /* Used by emultempl/aarch64elf.em. */
218 OPTION_FIX_ERRATUM_835769
,
219 OPTION_FIX_ERRATUM_843419
,
220 OPTION_NO_APPLY_DYNAMIC_RELOCS
,
221 /* Used by emultempl/aix.em. */
246 /* Used by emultempl/alphaelf.em. */
250 /* Used by emultempl/armelf.em. */
257 OPTION_VFP11_DENORM_FIX
,
258 OPTION_FIX_V4BX_INTERWORKING
,
259 OPTION_FIX_CORTEX_A8
,
260 OPTION_NO_FIX_CORTEX_A8
,
262 OPTION_NO_FIX_ARM1176
,
264 OPTION_STM32L4XX_FIX
,
267 /* Used by emultempl/avrelf.em. */
268 OPTION_NO_CALL_RET_REPLACEMENT
,
269 OPTION_PMEM_WRAP_AROUND
,
273 /* Used by emultempl/bfin.em. */
276 /* Used by emultempl/cskyelf.em. */
278 OPTION_NO_BRANCH_STUB
,
279 /* Used by emultempl/elf.em. */
280 OPTION_DISABLE_NEW_DTAGS
,
281 OPTION_ENABLE_NEW_DTAGS
,
284 OPTION_NO_EH_FRAME_HDR
,
286 OPTION_PACKAGE_METADATA
,
288 OPTION_COMPRESS_DEBUG
,
289 /* Used by emultempl/hppaelf.em. */
290 OPTION_MULTI_SUBSPACE
,
291 /* Used by emultempl/ia64elf.em. */
293 /* Used by emultempl/m68hc1xelf.em. */
294 OPTION_NO_TRAMPOLINE
,
296 /* Used by emultempl/m68kelf.em. */
298 /* Used by emultempl/mipself.em. */
301 OPTION_IGNORE_BRANCH_ISA
,
302 OPTION_NO_IGNORE_BRANCH_ISA
,
303 OPTION_COMPACT_BRANCHES
,
304 OPTION_NO_COMPACT_BRANCHES
,
305 /* Used by emultempl/msp430.em. */
308 OPTION_DISABLE_TRANS
,
309 /* Used by emultempl/nds32elf.em. */
311 OPTION_ELIM_GC_RELOCS
,
314 OPTION_REDUCE_FP_UPDATE
,
315 OPTION_NO_REDUCE_FP_UPDATE
,
316 OPTION_EXPORT_SYMBOLS
,
318 OPTION_TLSDESC_TRAMPOLINE
,
319 OPTION_NO_TLSDESC_TRAMPOLINE
,
320 /* Used by emultempl/nto.em. */
322 /* Used by emultempl/pe.em, emultempl/pep.em and emultempl/beos.em. */
324 OPTION_FILE_ALIGNMENT
,
326 OPTION_MAJOR_IMAGE_VERSION
,
327 OPTION_MAJOR_OS_VERSION
,
328 OPTION_MAJOR_SUBSYSTEM_VERSION
,
329 OPTION_MINOR_IMAGE_VERSION
,
330 OPTION_MINOR_OS_VERSION
,
331 OPTION_MINOR_SUBSYSTEM_VERSION
,
332 OPTION_SECTION_ALIGNMENT
,
335 OPTION_SUPPORT_OLD_CODE
,
338 OPTION_EXCLUDE_SYMBOLS
,
339 OPTION_EXCLUDE_ALL_SYMBOLS
,
341 OPTION_STDCALL_ALIASES
,
342 OPTION_ENABLE_STDCALL_FIXUP
,
343 OPTION_DISABLE_STDCALL_FIXUP
,
344 OPTION_WARN_DUPLICATE_EXPORTS
,
346 OPTION_ENABLE_AUTO_IMAGE_BASE
,
347 OPTION_DISABLE_AUTO_IMAGE_BASE
,
348 OPTION_DLL_SEARCH_PREFIX
,
349 OPTION_NO_DEFAULT_EXCLUDES
,
350 OPTION_DLL_ENABLE_AUTO_IMPORT
,
351 OPTION_DLL_DISABLE_AUTO_IMPORT
,
352 OPTION_ENABLE_EXTRA_PE_DEBUG
,
353 OPTION_DLL_ENABLE_RUNTIME_PSEUDO_RELOC
,
354 OPTION_DLL_DISABLE_RUNTIME_PSEUDO_RELOC
,
355 OPTION_LARGE_ADDRESS_AWARE
,
356 OPTION_DISABLE_LARGE_ADDRESS_AWARE
,
357 OPTION_DLL_ENABLE_RUNTIME_PSEUDO_RELOC_V1
,
358 OPTION_DLL_ENABLE_RUNTIME_PSEUDO_RELOC_V2
,
359 OPTION_EXCLUDE_MODULES_FOR_IMPLIB
,
360 OPTION_USE_NUL_PREFIXED_IMPORT_TABLES
,
361 OPTION_NO_LEADING_UNDERSCORE
,
362 OPTION_LEADING_UNDERSCORE
,
363 OPTION_ENABLE_LONG_SECTION_NAMES
,
364 OPTION_DISABLE_LONG_SECTION_NAMES
,
365 /* DLLCharacteristics flags. */
367 OPTION_FORCE_INTEGRITY
,
373 OPTION_TERMINAL_SERVER_AWARE
,
375 OPTION_INSERT_TIMESTAMP
,
376 OPTION_NO_INSERT_TIMESTAMP
,
378 OPTION_ENABLE_RELOC_SECTION
,
379 OPTION_DISABLE_RELOC_SECTION
,
380 /* DLL Characteristics flags. */
381 OPTION_DISABLE_DYNAMIC_BASE
,
382 OPTION_DISABLE_FORCE_INTEGRITY
,
383 OPTION_DISABLE_NX_COMPAT
,
384 OPTION_DISABLE_NO_ISOLATION
,
385 OPTION_DISABLE_NO_SEH
,
386 OPTION_DISABLE_NO_BIND
,
387 OPTION_DISABLE_WDM_DRIVER
,
388 OPTION_DISABLE_TERMINAL_SERVER_AWARE
,
389 /* Used by emultempl/pep.em. */
390 OPTION_DISABLE_HIGH_ENTROPY_VA
,
391 OPTION_HIGH_ENTROPY_VA
,
392 /* Used by emultempl/ppc32elf.em. */
396 OPTION_PPC476_WORKAROUND
,
397 OPTION_NO_PPC476_WORKAROUND
,
399 OPTION_VLE_RELOC_FIXUP
,
400 /* Used by emultempl/ppc64elf.em. */
401 OPTION_PLT_STATIC_CHAIN
,
402 OPTION_NO_PLT_STATIC_CHAIN
,
403 OPTION_PLT_THREAD_SAFE
,
404 OPTION_NO_PLT_THREAD_SAFE
,
405 OPTION_PLT_LOCALENTRY
,
406 OPTION_NO_PLT_LOCALENTRY
,
407 OPTION_POWER10_STUBS
,
408 OPTION_NO_POWER10_STUBS
,
414 OPTION_TLS_GET_ADDR_OPT
,
415 OPTION_TLS_GET_ADDR_REGSAVE
,
416 OPTION_NO_TLS_GET_ADDR_REGSAVE
,
421 OPTION_NON_OVERLAPPING_OPD
,
422 /* Used by emultempl/riscvelf.em. */
425 OPTION_CHECK_ULEB128
,
426 OPTION_NO_CHECK_ULEB128
,
427 /* Used by emultempl/rxelf.em. */
428 OPTION_NO_FLAG_MISMATCH_WARNINGS
,
430 OPTION_NO_IGNORE_LMA
,
431 OPTION_FLAG_MISMATCH_WARNINGS
,
432 /* Used by emultempl/s390.em. */
434 /* Used by emultempl/spuelf.em. */
436 OPTION_SPU_NO_OVERLAYS
,
437 OPTION_SPU_COMPACT_STUBS
,
438 OPTION_SPU_STUB_SYMS
,
439 OPTION_SPU_NON_OVERLAY_STUBS
,
440 OPTION_SPU_LOCAL_STORE
,
441 OPTION_SPU_STACK_ANALYSIS
,
442 OPTION_SPU_STACK_SYMS
,
443 OPTION_SPU_AUTO_OVERLAY
,
444 OPTION_SPU_AUTO_RELINK
,
445 OPTION_SPU_OVERLAY_RODATA
,
446 OPTION_SPU_SOFT_ICACHE
,
447 OPTION_SPU_LINE_SIZE
,
448 OPTION_SPU_NUM_LINES
,
450 OPTION_SPU_NON_IA_TEXT
,
451 OPTION_SPU_FIXED_SPACE
,
452 OPTION_SPU_RESERVED_SPACE
,
453 OPTION_SPU_EXTRA_STACK
,
454 OPTION_SPU_NO_AUTO_OVERLAY
,
455 OPTION_SPU_EMIT_FIXUPS
,
456 /* Used by emultempl/tic6xdsbt.em. */
459 /* Used by emultempl/ticoff.em. */
461 /* Used by emultempl/vms.em. */
462 OPTION_IDENTIFICATION
,
463 /* Used by emultempl/vxworks.em. */
464 OPTION_FORCE_DYNAMIC
,
465 /* Used by emultempl/xtensaelf.em. */
467 OPTION_LITERAL_MOVEMENT
,
468 OPTION_NO_LITERAL_MOVEMENT
,
473 /* The initial parser states. */
474 typedef enum input_enum
476 input_selected
, /* We've set the initial state. */
479 input_version_script
,
484 extern input_type parser_input
;
486 extern unsigned int lineno
;
487 extern const char *lex_string
;
490 extern int yylex (void);
491 extern void lex_push_file (FILE *, const char *, unsigned int);
492 extern void lex_redirect (const char *, const char *, unsigned int);
493 extern void ldlex_script (void);
494 extern void ldlex_inputlist (void);
495 extern void ldlex_mri_script (void);
496 extern void ldlex_version_script (void);
497 extern void ldlex_version_file (void);
498 extern void ldlex_expression (void);
499 extern void ldlex_wild (void);
500 extern void ldlex_popstate (void);
501 extern void ldlex_backup (void);
502 extern const char* ldlex_filename (void);
505 extern int lex_input (void);
506 extern void lex_unput (int);
507 extern void parse_args (unsigned, char **);