aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2024-01-17 07:46:37 -0800
committerH.J. Lu <hjl.tools@gmail.com>2024-01-19 05:35:16 -0800
commit8d10083c23b9415a6d645b44d136104fcf8ed176 (patch)
treec9903a9e57929b251ff226ae830d2a966986accb
parent3b6a6fd9c0ac24333c10e68e249e4e39a8c34059 (diff)
downloadgdb-8d10083c23b9415a6d645b44d136104fcf8ed176.zip
gdb-8d10083c23b9415a6d645b44d136104fcf8ed176.tar.gz
gdb-8d10083c23b9415a6d645b44d136104fcf8ed176.tar.bz2
ld: Put all emulation options in ldlex.h
For each command line option, parse_args() calls ldemul_parse_args() to check if the command line option is an emulation option. But when there is a conflict between the emulation option value and the default option value, the default command line option will be processed as if the emulation option is used. Remove PARSE_AND_LIST_PROLOGUE and move all emulation options to ldlex.h to avoid conflicts. PR ld/31247 * ldlex.h (option_values): Add all emulation options. * emulparams/elf32mcore.sh (PARSE_AND_LIST_PROLOGUE): Removed. * emulparams/plt_unwind.sh (PARSE_AND_LIST_PROLOGUE): Likewise. * emultempl/aarch64elf.em (PARSE_AND_LIST_PROLOGUE): Likewise. * emultempl/alphaelf.em (PARSE_AND_LIST_PROLOGUE): Likewise. * emultempl/armelf.em (PARSE_AND_LIST_PROLOGUE): Likewise. * emultempl/avrelf.em (PARSE_AND_LIST_PROLOGUE): Likewise. * emultempl/bfin.em (PARSE_AND_LIST_PROLOGUE): Likewise. * emultempl/cskyelf.em (PARSE_AND_LIST_PROLOGUE): Likewise. * emultempl/hppaelf.em (PARSE_AND_LIST_PROLOGUE): Likewise. * emultempl/ia64elf.em (PARSE_AND_LIST_PROLOGUE): Likewise. * emultempl/m68hc1xelf.em (PARSE_AND_LIST_PROLOGUE): Likewise. * emultempl/m68kelf.em (PARSE_AND_LIST_PROLOGUE): Likewise. * emultempl/metagelf.em (PARSE_AND_LIST_PROLOGUE): Likewise. * emultempl/mipself.em (PARSE_AND_LIST_PROLOGUE): Likewise. * emultempl/nds32elf.em (PARSE_AND_LIST_PROLOGUE): Likewise. * emultempl/nto.em (PARSE_AND_LIST_PROLOGUE): Likewise. * emultempl/ppc32elf.em (PARSE_AND_LIST_PROLOGUE): Likewise. * emultempl/ppc64elf.em (PARSE_AND_LIST_PROLOGUE): Likewise. * emultempl/riscvelf.em (PARSE_AND_LIST_PROLOGUE): Likewise. * emultempl/rxelf.em (PARSE_AND_LIST_PROLOGUE): Likewise. * emultempl/s390.em (PARSE_AND_LIST_PROLOGUE): Likewise. * emultempl/scoreelf.em (PARSE_AND_LIST_PROLOGUE): Likewise. * emultempl/spuelf.em (PARSE_AND_LIST_PROLOGUE): Likewise. * emultempl/tic6xdsbt.em (PARSE_AND_LIST_PROLOGUE): Likewise. * emultempl/vxworks.em (PARSE_AND_LIST_PROLOGUE): Likewise. * emultempl/aix.em: Include "ldlex.h". (OPTION_XXX): Removed. (gld${EMULATION_NAME}_read_file): Replace lineno with linenumber. * emultempl/beos.em (OPTION_XXX): Removed. * emultempl/elf.em: Include "ldlex.h". Don't check PARSE_AND_LIST_PROLOGUE. (OPTION_XXX): Removed. * emultempl/msp430.em: Include "ldlex.h". (OPTION_XXX): Removed. * emultempl/pe.em (OPTION_XXX): Removed. * emultempl/pep.em (OPTION_XXX): Likewise. * emultempl/ticoff.em: Include "ldlex.h". (OPTION_XXX): Removed. * emultempl/vms.em: Include "ldlex.h". (OPTION_XXX): Removed. * emultempl/xtensaelf.em (elf32xtensa_size_opt, elf32xtensa_no_literal_movement, elf32xtensa_abi): Moved out of PARSE_AND_LIST_PROLOGUE. (PARSE_AND_LIST_PROLOGUE): Removed.
-rw-r--r--ld/emulparams/elf32mcore.sh4
-rw-r--r--ld/emulparams/plt_unwind.sh5
-rw-r--r--ld/emultempl/aarch64elf.em10
-rw-r--r--ld/emultempl/aix.em50
-rw-r--r--ld/emultempl/alphaelf.em6
-rw-r--r--ld/emultempl/armelf.em25
-rw-r--r--ld/emultempl/avrelf.em9
-rw-r--r--ld/emultempl/beos.em16
-rw-r--r--ld/emultempl/bfin.em5
-rw-r--r--ld/emultempl/cskyelf.em6
-rw-r--r--ld/emultempl/elf.em22
-rw-r--r--ld/emultempl/hppaelf.em5
-rw-r--r--ld/emultempl/ia64elf.em4
-rw-r--r--ld/emultempl/m68hc1xelf.em5
-rw-r--r--ld/emultempl/m68kelf.em4
-rw-r--r--ld/emultempl/metagelf.em4
-rw-r--r--ld/emultempl/mipself.em12
-rw-r--r--ld/emultempl/msp430.em5
-rw-r--r--ld/emultempl/nds32elf.em12
-rw-r--r--ld/emultempl/nto.em8
-rw-r--r--ld/emultempl/pe.em78
-rw-r--r--ld/emultempl/pep.em73
-rw-r--r--ld/emultempl/ppc32elf.em20
-rw-r--r--ld/emultempl/ppc64elf.em35
-rw-r--r--ld/emultempl/riscvelf.em10
-rw-r--r--ld/emultempl/rxelf.em7
-rw-r--r--ld/emultempl/s390.em4
-rw-r--r--ld/emultempl/scoreelf.em1
-rw-r--r--ld/emultempl/spuelf.em24
-rw-r--r--ld/emultempl/tic6xdsbt.em6
-rw-r--r--ld/emultempl/ticoff.em2
-rw-r--r--ld/emultempl/vms.em2
-rw-r--r--ld/emultempl/vxworks.em6
-rw-r--r--ld/emultempl/xtensaelf.em14
-rw-r--r--ld/ldlex.h286
35 files changed, 304 insertions, 481 deletions
diff --git a/ld/emulparams/elf32mcore.sh b/ld/emulparams/elf32mcore.sh
index 88a8cb6..7d433fc 100644
--- a/ld/emulparams/elf32mcore.sh
+++ b/ld/emulparams/elf32mcore.sh
@@ -30,10 +30,6 @@ TEMPLATE_NAME=elf
# This code gets inserted into the generic elf32.sc linker script
# and allows us to define our own command line switches.
-PARSE_AND_LIST_PROLOGUE='
-#define OPTION_BASE_FILE 300
-'
-
PARSE_AND_LIST_LONGOPTS='
{"base-file", required_argument, NULL, OPTION_BASE_FILE},
'
diff --git a/ld/emulparams/plt_unwind.sh b/ld/emulparams/plt_unwind.sh
index ab16156..beb6726 100644
--- a/ld/emulparams/plt_unwind.sh
+++ b/ld/emulparams/plt_unwind.sh
@@ -1,10 +1,5 @@
PLT_UNWIND=yes
-PARSE_AND_LIST_PROLOGUE='
-#define OPTION_LD_GENERATED_UNWIND_INFO 301
-#define OPTION_NO_LD_GENERATED_UNWIND_INFO 302
-'
-
PARSE_AND_LIST_LONGOPTS='
{"ld-generated-unwind-info", no_argument, NULL,
OPTION_LD_GENERATED_UNWIND_INFO},
diff --git a/ld/emultempl/aarch64elf.em b/ld/emultempl/aarch64elf.em
index b647909..aa2859d 100644
--- a/ld/emultempl/aarch64elf.em
+++ b/ld/emultempl/aarch64elf.em
@@ -355,16 +355,6 @@ EOF
# Define some shell vars to insert bits of code into the standard elf
# parse_args and list_options functions.
#
-PARSE_AND_LIST_PROLOGUE='
-#define OPTION_NO_ENUM_SIZE_WARNING 309
-#define OPTION_PIC_VENEER 310
-#define OPTION_STUBGROUP_SIZE 311
-#define OPTION_NO_WCHAR_SIZE_WARNING 312
-#define OPTION_FIX_ERRATUM_835769 313
-#define OPTION_FIX_ERRATUM_843419 314
-#define OPTION_NO_APPLY_DYNAMIC_RELOCS 315
-'
-
PARSE_AND_LIST_SHORTOPTS=p
PARSE_AND_LIST_LONGOPTS='
diff --git a/ld/emultempl/aix.em b/ld/emultempl/aix.em
index a445c32..33857b5 100644
--- a/ld/emultempl/aix.em
+++ b/ld/emultempl/aix.em
@@ -48,6 +48,7 @@ fragment <<EOF
#include "ldexp.h"
#include "ldlang.h"
#include "ldfile.h"
+#include "ldlex.h"
#include "ldemul.h"
#include "ldctor.h"
#include <ldgram.h>
@@ -171,35 +172,6 @@ gld${EMULATION_NAME}_before_parse (void)
/* Handle AIX specific options. */
-enum
- {
- OPTION_IGNORE = 300,
- OPTION_AUTOIMP,
- OPTION_ERNOTOK,
- OPTION_EROK,
- OPTION_EXPALL,
- OPTION_EXPFULL,
- OPTION_EXPORT,
- OPTION_IMPORT,
- OPTION_INITFINI,
- OPTION_LOADMAP,
- OPTION_MAXDATA,
- OPTION_MAXSTACK,
- OPTION_MODTYPE,
- OPTION_NOAUTOIMP,
- OPTION_NOEXPALL,
- OPTION_NOEXPFULL,
- OPTION_NOSTRCMPCT,
- OPTION_PD,
- OPTION_PT,
- OPTION_STRCMPCT,
- OPTION_UNIX,
- OPTION_32,
- OPTION_64,
- OPTION_LIBPATH,
- OPTION_NOLIBPATH,
- };
-
static void
gld${EMULATION_NAME}_add_options
(int ns, char **shortopts, int nl, struct option **longopts,
@@ -1299,7 +1271,7 @@ gld${EMULATION_NAME}_read_file (const char *filename, bool import)
{
struct obstack *o;
FILE *f;
- int lineno;
+ int linenumber;
int c;
bool keep;
const char *imppath;
@@ -1323,7 +1295,7 @@ gld${EMULATION_NAME}_read_file (const char *filename, bool import)
impfile = NULL;
impmember = NULL;
- lineno = 0;
+ linenumber = 0;
/* Default to 32 and 64 bit mode
symbols at top of /lib/syscalls.exp do not have a mode modifier and they
@@ -1347,7 +1319,7 @@ gld${EMULATION_NAME}_read_file (const char *filename, bool import)
}
obstack_1grow (o, '\0');
- ++lineno;
+ ++linenumber;
s = (char *) obstack_base (o);
while (ISSPACE (*s))
@@ -1377,7 +1349,7 @@ gld${EMULATION_NAME}_read_file (const char *filename, bool import)
else if (*s == '(')
einfo (_("%F%P:%s:%d: #! ([member]) is not supported "
"in import files\n"),
- filename, lineno);
+ filename, linenumber);
else
{
char cs;
@@ -1403,7 +1375,7 @@ gld${EMULATION_NAME}_read_file (const char *filename, bool import)
impmember = "";
if (cs != '\0')
einfo (_("%P:%s:%d: warning: syntax error in import file\n"),
- filename, lineno);
+ filename, linenumber);
}
else
{
@@ -1415,7 +1387,7 @@ gld${EMULATION_NAME}_read_file (const char *filename, bool import)
*s = '\0';
else
einfo (_("%P:%s:%d: warning: syntax error in import file\n"),
- filename, lineno);
+ filename, linenumber);
}
}
@@ -1451,7 +1423,7 @@ gld${EMULATION_NAME}_read_file (const char *filename, bool import)
if (*se != '\0')
einfo (_("%P:%s%d: warning: syntax error in "
"import/export file\n"),
- filename, lineno);
+ filename, linenumber);
}
if (s != se)
@@ -1469,7 +1441,7 @@ gld${EMULATION_NAME}_read_file (const char *filename, bool import)
{
einfo (_("%P:%s:%d: warning: syntax error in "
"import/export file\n"),
- filename, lineno);
+ filename, linenumber);
}
}
@@ -1503,7 +1475,7 @@ gld${EMULATION_NAME}_read_file (const char *filename, bool import)
address, imppath, impfile,
impmember, syscall_flag))
einfo (_("%X%P:%s:%d: failed to import symbol %s: %E\n"),
- filename, lineno, symname);
+ filename, linenumber, symname);
}
}
}
@@ -1513,7 +1485,7 @@ gld${EMULATION_NAME}_read_file (const char *filename, bool import)
if (obstack_object_size (o) > 0)
{
einfo (_("%P:%s:%d: warning: ignoring unterminated last line\n"),
- filename, lineno);
+ filename, linenumber);
obstack_free (o, obstack_base (o));
}
diff --git a/ld/emultempl/alphaelf.em b/ld/emultempl/alphaelf.em
index cf32cd4..0445e79 100644
--- a/ld/emultempl/alphaelf.em
+++ b/ld/emultempl/alphaelf.em
@@ -111,12 +111,6 @@ EOF
# Define some shell vars to insert bits of code into the standard elf
# parse_args and list_options functions.
#
-PARSE_AND_LIST_PROLOGUE='
-#define OPTION_TASO 300
-#define OPTION_SECUREPLT (OPTION_TASO + 1)
-#define OPTION_NO_SECUREPLT (OPTION_SECUREPLT + 1)
-'
-
PARSE_AND_LIST_LONGOPTS='
{ "taso", no_argument, NULL, OPTION_TASO },
{ "secureplt", no_argument, NULL, OPTION_SECUREPLT },
diff --git a/ld/emultempl/armelf.em b/ld/emultempl/armelf.em
index 7fb1826..8f501ae 100644
--- a/ld/emultempl/armelf.em
+++ b/ld/emultempl/armelf.em
@@ -566,31 +566,6 @@ EOF
# Define some shell vars to insert bits of code into the standard elf
# parse_args and list_options functions.
#
-PARSE_AND_LIST_PROLOGUE='
-#define OPTION_THUMB_ENTRY 301
-#define OPTION_BE8 302
-#define OPTION_TARGET1_REL 303
-#define OPTION_TARGET1_ABS 304
-#define OPTION_TARGET2 305
-#define OPTION_FIX_V4BX 306
-#define OPTION_USE_BLX 307
-#define OPTION_VFP11_DENORM_FIX 308
-#define OPTION_NO_ENUM_SIZE_WARNING 309
-#define OPTION_PIC_VENEER 310
-#define OPTION_FIX_V4BX_INTERWORKING 311
-#define OPTION_STUBGROUP_SIZE 312
-#define OPTION_NO_WCHAR_SIZE_WARNING 313
-#define OPTION_FIX_CORTEX_A8 314
-#define OPTION_NO_FIX_CORTEX_A8 315
-#define OPTION_NO_MERGE_EXIDX_ENTRIES 316
-#define OPTION_FIX_ARM1176 317
-#define OPTION_NO_FIX_ARM1176 318
-#define OPTION_LONG_PLT 319
-#define OPTION_STM32L4XX_FIX 320
-#define OPTION_CMSE_IMPLIB 321
-#define OPTION_IN_IMPLIB 322
-'
-
PARSE_AND_LIST_SHORTOPTS=p
PARSE_AND_LIST_LONGOPTS='
diff --git a/ld/emultempl/avrelf.em b/ld/emultempl/avrelf.em
index 3fe8100..792be72 100644
--- a/ld/emultempl/avrelf.em
+++ b/ld/emultempl/avrelf.em
@@ -232,15 +232,6 @@ avr_finish (void)
EOF
-PARSE_AND_LIST_PROLOGUE='
-
-#define OPTION_NO_CALL_RET_REPLACEMENT 301
-#define OPTION_PMEM_WRAP_AROUND 302
-#define OPTION_NO_STUBS 303
-#define OPTION_DEBUG_STUBS 304
-#define OPTION_DEBUG_RELAX 305
-'
-
PARSE_AND_LIST_LONGOPTS='
{ "no-call-ret-replacement", no_argument,
NULL, OPTION_NO_CALL_RET_REPLACEMENT},
diff --git a/ld/emultempl/beos.em b/ld/emultempl/beos.em
index 844d498..29c386c 100644
--- a/ld/emultempl/beos.em
+++ b/ld/emultempl/beos.em
@@ -70,22 +70,6 @@ gld${EMULATION_NAME}_before_parse (void)
/* PE format extra command line options. */
-/* Used for setting flags in the PE header. */
-#define OPTION_BASE_FILE (300 + 1)
-#define OPTION_DLL (OPTION_BASE_FILE + 1)
-#define OPTION_FILE_ALIGNMENT (OPTION_DLL + 1)
-#define OPTION_IMAGE_BASE (OPTION_FILE_ALIGNMENT + 1)
-#define OPTION_MAJOR_IMAGE_VERSION (OPTION_IMAGE_BASE + 1)
-#define OPTION_MAJOR_OS_VERSION (OPTION_MAJOR_IMAGE_VERSION + 1)
-#define OPTION_MAJOR_SUBSYSTEM_VERSION (OPTION_MAJOR_OS_VERSION + 1)
-#define OPTION_MINOR_IMAGE_VERSION (OPTION_MAJOR_SUBSYSTEM_VERSION + 1)
-#define OPTION_MINOR_OS_VERSION (OPTION_MINOR_IMAGE_VERSION + 1)
-#define OPTION_MINOR_SUBSYSTEM_VERSION (OPTION_MINOR_OS_VERSION + 1)
-#define OPTION_SECTION_ALIGNMENT (OPTION_MINOR_SUBSYSTEM_VERSION + 1)
-#define OPTION_STACK (OPTION_SECTION_ALIGNMENT + 1)
-#define OPTION_SUBSYSTEM (OPTION_STACK + 1)
-#define OPTION_HEAP (OPTION_SUBSYSTEM + 1)
-
static void
gld${EMULATION_NAME}_add_options
(int ns ATTRIBUTE_UNUSED, char **shortopts ATTRIBUTE_UNUSED, int nl,
diff --git a/ld/emultempl/bfin.em b/ld/emultempl/bfin.em
index eb13055..4b9be67 100644
--- a/ld/emultempl/bfin.em
+++ b/ld/emultempl/bfin.em
@@ -39,11 +39,6 @@ EOF
# Define some shell vars to insert bits of code into the standard elf
# parse_args and list_options functions.
#
-PARSE_AND_LIST_PROLOGUE='
-#define OPTION_CODE_IN_L1 300
-#define OPTION_DATA_IN_L1 301
-'
-
PARSE_AND_LIST_LONGOPTS='
{ "code-in-l1", no_argument, NULL, OPTION_CODE_IN_L1 },
{ "data-in-l1", no_argument, NULL, OPTION_DATA_IN_L1 },
diff --git a/ld/emultempl/cskyelf.em b/ld/emultempl/cskyelf.em
index 82815e5..64a6ddf 100644
--- a/ld/emultempl/cskyelf.em
+++ b/ld/emultempl/cskyelf.em
@@ -288,12 +288,6 @@ EOF
# This code gets inserted into the generic elf32.sc linker script
# and allows us to define our own command line switches.
-PARSE_AND_LIST_PROLOGUE='
-#define OPTION_BRANCH_STUB 301
-#define OPTION_NO_BRANCH_STUB 302
-#define OPTION_STUBGROUP_SIZE 303
-'
-
PARSE_AND_LIST_LONGOPTS='
{"branch-stub", no_argument, NULL, OPTION_BRANCH_STUB},
{"no-branch-stub", no_argument, NULL, OPTION_NO_BRANCH_STUB},
diff --git a/ld/emultempl/elf.em b/ld/emultempl/elf.em
index 71cec19..f551225 100644
--- a/ld/emultempl/elf.em
+++ b/ld/emultempl/elf.em
@@ -45,6 +45,7 @@ fragment <<EOF
#include "ldexp.h"
#include "ldlang.h"
#include "ldfile.h"
+#include "ldlex.h"
#include "ldemul.h"
#include <ldgram.h>
#include "elf-bfd.h"
@@ -556,28 +557,7 @@ EOF
fi
fi
-if test -n "$PARSE_AND_LIST_PROLOGUE" ; then
fragment <<EOF
- $PARSE_AND_LIST_PROLOGUE
-EOF
-fi
-
-fragment <<EOF
-
-enum elf_options
-{
- OPTION_DISABLE_NEW_DTAGS = 400,
- OPTION_ENABLE_NEW_DTAGS,
- OPTION_GROUP,
- OPTION_EH_FRAME_HDR,
- OPTION_NO_EH_FRAME_HDR,
- OPTION_EXCLUDE_LIBS,
- OPTION_HASH_STYLE,
- OPTION_BUILD_ID,
- OPTION_PACKAGE_METADATA,
- OPTION_AUDIT,
- OPTION_COMPRESS_DEBUG
-};
static void
gld${EMULATION_NAME}_add_options
diff --git a/ld/emultempl/hppaelf.em b/ld/emultempl/hppaelf.em
index 09db0cb..4525798 100644
--- a/ld/emultempl/hppaelf.em
+++ b/ld/emultempl/hppaelf.em
@@ -314,11 +314,6 @@ EOF
# Define some shell vars to insert bits of code into the standard elf
# parse_args and list_options functions.
#
-PARSE_AND_LIST_PROLOGUE='
-#define OPTION_MULTI_SUBSPACE 301
-#define OPTION_STUBGROUP_SIZE (OPTION_MULTI_SUBSPACE + 1)
-'
-
PARSE_AND_LIST_LONGOPTS='
{ "multi-subspace", no_argument, NULL, OPTION_MULTI_SUBSPACE },
{ "stub-group-size", required_argument, NULL, OPTION_STUBGROUP_SIZE },
diff --git a/ld/emultempl/ia64elf.em b/ld/emultempl/ia64elf.em
index a4657bc..a74849d 100644
--- a/ld/emultempl/ia64elf.em
+++ b/ld/emultempl/ia64elf.em
@@ -43,10 +43,6 @@ ia64elf_after_parse (void)
EOF
-PARSE_AND_LIST_PROLOGUE='
-#define OPTION_ITANIUM 300
-'
-
PARSE_AND_LIST_LONGOPTS='
{ "itanium", no_argument, NULL, OPTION_ITANIUM},
'
diff --git a/ld/emultempl/m68hc1xelf.em b/ld/emultempl/m68hc1xelf.em
index 5355b0f..7aaa78a 100644
--- a/ld/emultempl/m68hc1xelf.em
+++ b/ld/emultempl/m68hc1xelf.em
@@ -322,11 +322,6 @@ EOF
# Define some shell vars to insert bits of code into the standard elf
# parse_args and list_options functions.
#
-PARSE_AND_LIST_PROLOGUE='
-#define OPTION_NO_TRAMPOLINE 300
-#define OPTION_BANK_WINDOW 301
-'
-
# The options are repeated below so that no abbreviations are allowed.
# Otherwise -s matches stub-group-size
PARSE_AND_LIST_LONGOPTS='
diff --git a/ld/emultempl/m68kelf.em b/ld/emultempl/m68kelf.em
index 0477f1e..30e7d17 100644
--- a/ld/emultempl/m68kelf.em
+++ b/ld/emultempl/m68kelf.em
@@ -200,10 +200,6 @@ EOF
# Define some shell vars to insert bits of code into the standard elf
# parse_args and list_options functions.
#
-PARSE_AND_LIST_PROLOGUE='
-#define OPTION_GOT 301
-'
-
PARSE_AND_LIST_LONGOPTS='
{ "got", required_argument, NULL, OPTION_GOT},
'
diff --git a/ld/emultempl/metagelf.em b/ld/emultempl/metagelf.em
index 81ab64c..10d3ff1 100644
--- a/ld/emultempl/metagelf.em
+++ b/ld/emultempl/metagelf.em
@@ -282,10 +282,6 @@ EOF
# Define some shell vars to insert bits of code into the standard elf
# parse_args and list_options functions.
#
-PARSE_AND_LIST_PROLOGUE='
-#define OPTION_STUBGROUP_SIZE 301
-'
-
PARSE_AND_LIST_LONGOPTS='
{ "stub-group-size", required_argument, NULL, OPTION_STUBGROUP_SIZE },
'
diff --git a/ld/emultempl/mipself.em b/ld/emultempl/mipself.em
index f8fe4b9..3259f65 100644
--- a/ld/emultempl/mipself.em
+++ b/ld/emultempl/mipself.em
@@ -232,18 +232,6 @@ EOF
# Define some shell vars to insert bits of code into the standard elf
# parse_args and list_options functions.
#
-PARSE_AND_LIST_PROLOGUE='
-enum
- {
- OPTION_INSN32 = 301,
- OPTION_NO_INSN32,
- OPTION_IGNORE_BRANCH_ISA,
- OPTION_NO_IGNORE_BRANCH_ISA,
- OPTION_COMPACT_BRANCHES,
- OPTION_NO_COMPACT_BRANCHES
- };
-'
-
PARSE_AND_LIST_LONGOPTS='
{ "insn32", no_argument, NULL, OPTION_INSN32 },
{ "no-insn32", no_argument, NULL, OPTION_NO_INSN32 },
diff --git a/ld/emultempl/msp430.em b/ld/emultempl/msp430.em
index 92402b3..2d22531 100644
--- a/ld/emultempl/msp430.em
+++ b/ld/emultempl/msp430.em
@@ -39,6 +39,7 @@ fragment <<EOF
#include "ldexp.h"
#include "ldlang.h"
#include "ldfile.h"
+#include "ldlex.h"
#include "ldemul.h"
#include "libiberty.h"
#include <ldgram.h>
@@ -443,10 +444,6 @@ msp430_elf_after_open (void)
bfd_map_over_sections (abfd, add_region_prefix, NULL);
}
-#define OPTION_CODE_REGION 321
-#define OPTION_DATA_REGION (OPTION_CODE_REGION + 1)
-#define OPTION_DISABLE_TRANS (OPTION_CODE_REGION + 2)
-
static void
gld${EMULATION_NAME}_add_options
(int ns, char **shortopts, int nl, struct option **longopts,
diff --git a/ld/emultempl/nds32elf.em b/ld/emultempl/nds32elf.em
index bde9e35..260e2a4 100644
--- a/ld/emultempl/nds32elf.em
+++ b/ld/emultempl/nds32elf.em
@@ -132,18 +132,6 @@ EOF
# Define some shell vars to insert bits of code into the standard elf
# parse_args and list_options functions.
#
-PARSE_AND_LIST_PROLOGUE='
-#define OPTION_BASELINE 301
-#define OPTION_ELIM_GC_RELOCS (OPTION_BASELINE + 1)
-#define OPTION_FP_AS_GP (OPTION_BASELINE + 2)
-#define OPTION_NO_FP_AS_GP (OPTION_BASELINE + 3)
-#define OPTION_REDUCE_FP_UPDATE (OPTION_BASELINE + 4)
-#define OPTION_NO_REDUCE_FP_UPDATE (OPTION_BASELINE + 5)
-#define OPTION_EXPORT_SYMBOLS (OPTION_BASELINE + 6)
-#define OPTION_HYPER_RELAX (OPTION_BASELINE + 7)
-#define OPTION_TLSDESC_TRAMPOLINE (OPTION_BASELINE + 8)
-#define OPTION_NO_TLSDESC_TRAMPOLINE (OPTION_BASELINE + 9)
-'
PARSE_AND_LIST_LONGOPTS='
{ "mfp-as-gp", no_argument, NULL, OPTION_FP_AS_GP},
{ "mno-fp-as-gp", no_argument, NULL, OPTION_NO_FP_AS_GP},
diff --git a/ld/emultempl/nto.em b/ld/emultempl/nto.em
index de69e13..7cda665 100644
--- a/ld/emultempl/nto.em
+++ b/ld/emultempl/nto.em
@@ -190,14 +190,6 @@ EOF
# parse_args and list_options functions.
#
-PARSE_AND_LIST_PROLOGUE=${PARSE_AND_LIST_PROLOGUE}'
-enum nto_options
-{
- OPTION_STACK = 500,
- OPTION_LAZY_STACK,
-};
-'
-
PARSE_AND_LIST_LONGOPTS=${PARSE_AND_LIST_LONGOPTS}'
{ "stack", required_argument, NULL, OPTION_STACK },
{ "lazy-stack", no_argument, NULL, OPTION_LAZY_STACK },
diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em
index c6ed111..9ab5e6e 100644
--- a/ld/emultempl/pe.em
+++ b/ld/emultempl/pe.em
@@ -235,84 +235,6 @@ fragment <<EOF
/* PE format extra command line options. */
-/* Used for setting flags in the PE header. */
-enum options
-{
- OPTION_BASE_FILE = 300 + 1,
- OPTION_DLL,
- OPTION_FILE_ALIGNMENT,
- OPTION_IMAGE_BASE,
- OPTION_MAJOR_IMAGE_VERSION,
- OPTION_MAJOR_OS_VERSION,
- OPTION_MAJOR_SUBSYSTEM_VERSION,
- OPTION_MINOR_IMAGE_VERSION,
- OPTION_MINOR_OS_VERSION,
- OPTION_MINOR_SUBSYSTEM_VERSION,
- OPTION_SECTION_ALIGNMENT,
- OPTION_STACK,
- OPTION_SUBSYSTEM,
- OPTION_HEAP,
- OPTION_SUPPORT_OLD_CODE,
- OPTION_OUT_DEF,
- OPTION_EXPORT_ALL,
- OPTION_EXCLUDE_SYMBOLS,
- OPTION_EXCLUDE_ALL_SYMBOLS,
- OPTION_KILL_ATS,
- OPTION_STDCALL_ALIASES,
- OPTION_ENABLE_STDCALL_FIXUP,
- OPTION_DISABLE_STDCALL_FIXUP,
- OPTION_THUMB_ENTRY,
- OPTION_WARN_DUPLICATE_EXPORTS,
- OPTION_IMP_COMPAT,
- OPTION_ENABLE_AUTO_IMAGE_BASE,
- OPTION_DISABLE_AUTO_IMAGE_BASE,
- OPTION_DLL_SEARCH_PREFIX,
- OPTION_NO_DEFAULT_EXCLUDES,
- OPTION_DLL_ENABLE_AUTO_IMPORT,
- OPTION_DLL_DISABLE_AUTO_IMPORT,
- OPTION_ENABLE_EXTRA_PE_DEBUG,
- OPTION_EXCLUDE_LIBS,
- OPTION_DLL_ENABLE_RUNTIME_PSEUDO_RELOC,
- OPTION_DLL_DISABLE_RUNTIME_PSEUDO_RELOC,
- OPTION_LARGE_ADDRESS_AWARE,
- OPTION_DISABLE_LARGE_ADDRESS_AWARE,
- OPTION_DLL_ENABLE_RUNTIME_PSEUDO_RELOC_V1,
- OPTION_DLL_ENABLE_RUNTIME_PSEUDO_RELOC_V2,
- OPTION_EXCLUDE_MODULES_FOR_IMPLIB,
- OPTION_USE_NUL_PREFIXED_IMPORT_TABLES,
- OPTION_NO_LEADING_UNDERSCORE,
- OPTION_LEADING_UNDERSCORE,
- OPTION_ENABLE_LONG_SECTION_NAMES,
- OPTION_DISABLE_LONG_SECTION_NAMES,
-/* DLLCharacteristics flags. */
- OPTION_DYNAMIC_BASE,
- OPTION_FORCE_INTEGRITY,
- OPTION_NX_COMPAT,
- OPTION_NO_ISOLATION,
- OPTION_NO_SEH,
- OPTION_NO_BIND,
- OPTION_WDM_DRIVER,
- OPTION_TERMINAL_SERVER_AWARE,
-/* Determinism. */
- OPTION_INSERT_TIMESTAMP,
- OPTION_NO_INSERT_TIMESTAMP,
- OPTION_BUILD_ID,
-#ifdef PDB_H
- OPTION_PDB,
-#endif
- OPTION_ENABLE_RELOC_SECTION,
- OPTION_DISABLE_RELOC_SECTION,
-/* DLL Characteristics flags. */
- OPTION_DISABLE_DYNAMIC_BASE,
- OPTION_DISABLE_FORCE_INTEGRITY,
- OPTION_DISABLE_NX_COMPAT,
- OPTION_DISABLE_NO_ISOLATION,
- OPTION_DISABLE_NO_SEH,
- OPTION_DISABLE_NO_BIND,
- OPTION_DISABLE_WDM_DRIVER,
- OPTION_DISABLE_TERMINAL_SERVER_AWARE
-};
-
static void
gld${EMULATION_NAME}_add_options
(int ns ATTRIBUTE_UNUSED,
diff --git a/ld/emultempl/pep.em b/ld/emultempl/pep.em
index bd2ee2e..00c4ea9 100644
--- a/ld/emultempl/pep.em
+++ b/ld/emultempl/pep.em
@@ -245,79 +245,6 @@ gld${EMULATION_NAME}_before_parse (void)
/* PE format extra command line options. */
-/* Used for setting flags in the PE header. */
-enum options
-{
- OPTION_BASE_FILE = 300 + 1,
- OPTION_DLL,
- OPTION_FILE_ALIGNMENT,
- OPTION_IMAGE_BASE,
- OPTION_MAJOR_IMAGE_VERSION,
- OPTION_MAJOR_OS_VERSION,
- OPTION_MAJOR_SUBSYSTEM_VERSION,
- OPTION_MINOR_IMAGE_VERSION,
- OPTION_MINOR_OS_VERSION,
- OPTION_MINOR_SUBSYSTEM_VERSION,
- OPTION_SECTION_ALIGNMENT,
- OPTION_STACK,
- OPTION_SUBSYSTEM,
- OPTION_HEAP,
- OPTION_SUPPORT_OLD_CODE,
- OPTION_OUT_DEF,
- OPTION_EXPORT_ALL,
- OPTION_EXCLUDE_SYMBOLS,
- OPTION_EXCLUDE_ALL_SYMBOLS,
- OPTION_KILL_ATS,
- OPTION_STDCALL_ALIASES,
- OPTION_ENABLE_STDCALL_FIXUP,
- OPTION_DISABLE_STDCALL_FIXUP,
- OPTION_WARN_DUPLICATE_EXPORTS,
- OPTION_IMP_COMPAT,
- OPTION_ENABLE_AUTO_IMAGE_BASE,
- OPTION_DISABLE_AUTO_IMAGE_BASE,
- OPTION_DLL_SEARCH_PREFIX,
- OPTION_NO_DEFAULT_EXCLUDES,
- OPTION_DLL_ENABLE_AUTO_IMPORT,
- OPTION_DLL_DISABLE_AUTO_IMPORT,
- OPTION_ENABLE_EXTRA_PE_DEBUG,
- OPTION_EXCLUDE_LIBS,
- OPTION_DLL_ENABLE_RUNTIME_PSEUDO_RELOC,
- OPTION_DLL_DISABLE_RUNTIME_PSEUDO_RELOC,
- OPTION_DLL_ENABLE_RUNTIME_PSEUDO_RELOC_V2,
- OPTION_EXCLUDE_MODULES_FOR_IMPLIB,
- OPTION_USE_NUL_PREFIXED_IMPORT_TABLES,
- OPTION_NO_LEADING_UNDERSCORE,
- OPTION_LEADING_UNDERSCORE,
- OPTION_ENABLE_LONG_SECTION_NAMES,
- OPTION_DISABLE_LONG_SECTION_NAMES,
- OPTION_HIGH_ENTROPY_VA,
- OPTION_DYNAMIC_BASE,
- OPTION_FORCE_INTEGRITY,
- OPTION_NX_COMPAT,
- OPTION_NO_ISOLATION,
- OPTION_NO_SEH,
- OPTION_NO_BIND,
- OPTION_WDM_DRIVER,
- OPTION_INSERT_TIMESTAMP,
- OPTION_NO_INSERT_TIMESTAMP,
- OPTION_TERMINAL_SERVER_AWARE,
- OPTION_BUILD_ID,
-#ifdef PDB_H
- OPTION_PDB,
-#endif
- OPTION_ENABLE_RELOC_SECTION,
- OPTION_DISABLE_RELOC_SECTION,
- OPTION_DISABLE_HIGH_ENTROPY_VA,
- OPTION_DISABLE_DYNAMIC_BASE,
- OPTION_DISABLE_FORCE_INTEGRITY,
- OPTION_DISABLE_NX_COMPAT,
- OPTION_DISABLE_NO_ISOLATION,
- OPTION_DISABLE_NO_SEH,
- OPTION_DISABLE_NO_BIND,
- OPTION_DISABLE_WDM_DRIVER,
- OPTION_DISABLE_TERMINAL_SERVER_AWARE
-};
-
static void
gld${EMULATION_NAME}_add_options
(int ns ATTRIBUTE_UNUSED,
diff --git a/ld/emultempl/ppc32elf.em b/ld/emultempl/ppc32elf.em
index 0730a05..12476f4 100644
--- a/ld/emultempl/ppc32elf.em
+++ b/ld/emultempl/ppc32elf.em
@@ -264,26 +264,6 @@ fi
# Define some shell vars to insert bits of code into the standard elf
# parse_args and list_options functions.
#
-PARSE_AND_LIST_PROLOGUE=${PARSE_AND_LIST_PROLOGUE}'
-enum ppc32_opt
-{
- OPTION_NO_TLS_OPT = 321,
- OPTION_NO_TLS_GET_ADDR_OPT,
- OPTION_NEW_PLT,
- OPTION_OLD_PLT,
- OPTION_PLT_ALIGN,
- OPTION_NO_PLT_ALIGN,
- OPTION_NO_INLINE_OPT,
- OPTION_OLD_GOT,
- OPTION_STUBSYMS,
- OPTION_NO_STUBSYMS,
- OPTION_PPC476_WORKAROUND,
- OPTION_NO_PPC476_WORKAROUND,
- OPTION_NO_PICFIXUP,
- OPTION_VLE_RELOC_FIXUP
-};
-'
-
PARSE_AND_LIST_LONGOPTS=${PARSE_AND_LIST_LONGOPTS}'
{ "emit-stub-syms", no_argument, NULL, OPTION_STUBSYMS },
{ "no-emit-stub-syms", no_argument, NULL, OPTION_NO_STUBSYMS },
diff --git a/ld/emultempl/ppc64elf.em b/ld/emultempl/ppc64elf.em
index 533caed..23905e9 100644
--- a/ld/emultempl/ppc64elf.em
+++ b/ld/emultempl/ppc64elf.em
@@ -684,41 +684,6 @@ fi
# Define some shell vars to insert bits of code into the standard elf
# parse_args and list_options functions.
#
-PARSE_AND_LIST_PROLOGUE=${PARSE_AND_LIST_PROLOGUE}'
-enum ppc64_opt
-{
- OPTION_STUBGROUP_SIZE = 321,
- OPTION_PLT_STATIC_CHAIN,
- OPTION_NO_PLT_STATIC_CHAIN,
- OPTION_PLT_THREAD_SAFE,
- OPTION_NO_PLT_THREAD_SAFE,
- OPTION_PLT_ALIGN,
- OPTION_NO_PLT_ALIGN,
- OPTION_PLT_LOCALENTRY,
- OPTION_NO_PLT_LOCALENTRY,
- OPTION_POWER10_STUBS,
- OPTION_NO_POWER10_STUBS,
- OPTION_NO_PCREL_OPT,
- OPTION_STUBSYMS,
- OPTION_NO_STUBSYMS,
- OPTION_SAVRES,
- OPTION_NO_SAVRES,
- OPTION_DOTSYMS,
- OPTION_NO_DOTSYMS,
- OPTION_NO_TLS_OPT,
- OPTION_TLS_GET_ADDR_OPT,
- OPTION_NO_TLS_GET_ADDR_OPT,
- OPTION_TLS_GET_ADDR_REGSAVE,
- OPTION_NO_TLS_GET_ADDR_REGSAVE,
- OPTION_NO_OPD_OPT,
- OPTION_NO_INLINE_OPT,
- OPTION_NO_TOC_OPT,
- OPTION_NO_MULTI_TOC,
- OPTION_NO_TOC_SORT,
- OPTION_NON_OVERLAPPING_OPD
-};
-'
-
PARSE_AND_LIST_LONGOPTS=${PARSE_AND_LIST_LONGOPTS}'
{ "stub-group-size", required_argument, NULL, OPTION_STUBGROUP_SIZE },
{ "plt-static-chain", no_argument, NULL, OPTION_PLT_STATIC_CHAIN },
diff --git a/ld/emultempl/riscvelf.em b/ld/emultempl/riscvelf.em
index fe53b2a..afc43ed 100644
--- a/ld/emultempl/riscvelf.em
+++ b/ld/emultempl/riscvelf.em
@@ -31,16 +31,6 @@ EOF
# Define some shell vars to insert bits of code into the standard elf
# parse_args and list_options functions. */
-PARSE_AND_LIST_PROLOGUE=${PARSE_AND_LIST_PROLOGUE}'
-enum risccv_opt
-{
- OPTION_RELAX_GP = 321,
- OPTION_NO_RELAX_GP,
- OPTION_CHECK_ULEB128,
- OPTION_NO_CHECK_ULEB128,
-};
-'
-
PARSE_AND_LIST_LONGOPTS=${PARSE_AND_LIST_LONGOPTS}'
{ "relax-gp", no_argument, NULL, OPTION_RELAX_GP },
{ "no-relax-gp", no_argument, NULL, OPTION_NO_RELAX_GP },
diff --git a/ld/emultempl/rxelf.em b/ld/emultempl/rxelf.em
index 3b8df6e..cc76a27 100644
--- a/ld/emultempl/rxelf.em
+++ b/ld/emultempl/rxelf.em
@@ -45,13 +45,6 @@ EOF
# Define some shell vars to insert bits of code into the standard elf
# parse_args and list_options functions.
#
-PARSE_AND_LIST_PROLOGUE='
-#define OPTION_NO_FLAG_MISMATCH_WARNINGS 301
-#define OPTION_IGNORE_LMA 302
-#define OPTION_NO_IGNORE_LMA 303
-#define OPTION_FLAG_MISMATCH_WARNINGS 304
-'
-
PARSE_AND_LIST_LONGOPTS='
{ "no-flag-mismatch-warnings", no_argument, NULL, OPTION_NO_FLAG_MISMATCH_WARNINGS},
{ "flag-mismatch-warnings", no_argument, NULL, OPTION_FLAG_MISMATCH_WARNINGS},
diff --git a/ld/emultempl/s390.em b/ld/emultempl/s390.em
index 11e7f19..179cbbd 100644
--- a/ld/emultempl/s390.em
+++ b/ld/emultempl/s390.em
@@ -42,10 +42,6 @@ EOF
# Define some shell vars to insert bits of code into the standard elf
# parse_args and list_options functions.
#
-PARSE_AND_LIST_PROLOGUE='
-#define OPTION_PGSTE 301
-'
-
PARSE_AND_LIST_LONGOPTS='
{ "s390-pgste", no_argument, NULL, OPTION_PGSTE},
'
diff --git a/ld/emultempl/scoreelf.em b/ld/emultempl/scoreelf.em
index 6238b5e..499a583 100644
--- a/ld/emultempl/scoreelf.em
+++ b/ld/emultempl/scoreelf.em
@@ -76,7 +76,6 @@ EOF
# Define some shell vars to insert bits of code into the standard elf
# parse_args and list_options functions.
#
-PARSE_AND_LIST_PROLOGUE=''
PARSE_AND_LIST_SHORTOPTS=
PARSE_AND_LIST_LONGOPTS=''
PARSE_AND_LIST_OPTIONS=''
diff --git a/ld/emultempl/spuelf.em b/ld/emultempl/spuelf.em
index cc39435..2ff41b1 100644
--- a/ld/emultempl/spuelf.em
+++ b/ld/emultempl/spuelf.em
@@ -589,30 +589,6 @@ fi
# Define some shell vars to insert bits of code into the standard elf
# parse_args and list_options functions.
#
-PARSE_AND_LIST_PROLOGUE='
-#define OPTION_SPU_PLUGIN 301
-#define OPTION_SPU_NO_OVERLAYS (OPTION_SPU_PLUGIN + 1)
-#define OPTION_SPU_COMPACT_STUBS (OPTION_SPU_NO_OVERLAYS + 1)
-#define OPTION_SPU_STUB_SYMS (OPTION_SPU_COMPACT_STUBS + 1)
-#define OPTION_SPU_NON_OVERLAY_STUBS (OPTION_SPU_STUB_SYMS + 1)
-#define OPTION_SPU_LOCAL_STORE (OPTION_SPU_NON_OVERLAY_STUBS + 1)
-#define OPTION_SPU_STACK_ANALYSIS (OPTION_SPU_LOCAL_STORE + 1)
-#define OPTION_SPU_STACK_SYMS (OPTION_SPU_STACK_ANALYSIS + 1)
-#define OPTION_SPU_AUTO_OVERLAY (OPTION_SPU_STACK_SYMS + 1)
-#define OPTION_SPU_AUTO_RELINK (OPTION_SPU_AUTO_OVERLAY + 1)
-#define OPTION_SPU_OVERLAY_RODATA (OPTION_SPU_AUTO_RELINK + 1)
-#define OPTION_SPU_SOFT_ICACHE (OPTION_SPU_OVERLAY_RODATA + 1)
-#define OPTION_SPU_LINE_SIZE (OPTION_SPU_SOFT_ICACHE + 1)
-#define OPTION_SPU_NUM_LINES (OPTION_SPU_LINE_SIZE + 1)
-#define OPTION_SPU_LRLIVE (OPTION_SPU_NUM_LINES + 1)
-#define OPTION_SPU_NON_IA_TEXT (OPTION_SPU_LRLIVE + 1)
-#define OPTION_SPU_FIXED_SPACE (OPTION_SPU_NON_IA_TEXT + 1)
-#define OPTION_SPU_RESERVED_SPACE (OPTION_SPU_FIXED_SPACE + 1)
-#define OPTION_SPU_EXTRA_STACK (OPTION_SPU_RESERVED_SPACE + 1)
-#define OPTION_SPU_NO_AUTO_OVERLAY (OPTION_SPU_EXTRA_STACK + 1)
-#define OPTION_SPU_EMIT_FIXUPS (OPTION_SPU_NO_AUTO_OVERLAY + 1)
-'
-
PARSE_AND_LIST_LONGOPTS='
{ "plugin", no_argument, NULL, OPTION_SPU_PLUGIN },
{ "soft-icache", no_argument, NULL, OPTION_SPU_SOFT_ICACHE },
diff --git a/ld/emultempl/tic6xdsbt.em b/ld/emultempl/tic6xdsbt.em
index 524e3f7..8140ef9 100644
--- a/ld/emultempl/tic6xdsbt.em
+++ b/ld/emultempl/tic6xdsbt.em
@@ -165,12 +165,6 @@ EOF
# This code gets inserted into the generic elf32.sc linker script
# and allows us to define our own command line switches.
-PARSE_AND_LIST_PROLOGUE='
-#define OPTION_DSBT_INDEX 300
-#define OPTION_DSBT_SIZE 301
-#define OPTION_NO_MERGE_EXIDX_ENTRIES 302
-'
-
PARSE_AND_LIST_LONGOPTS='
{"dsbt-index", required_argument, NULL, OPTION_DSBT_INDEX},
{"dsbt-size", required_argument, NULL, OPTION_DSBT_SIZE},
diff --git a/ld/emultempl/ticoff.em b/ld/emultempl/ticoff.em
index 4b048be..fb6cf3a 100644
--- a/ld/emultempl/ticoff.em
+++ b/ld/emultempl/ticoff.em
@@ -40,12 +40,12 @@ fragment <<EOF
#include "ldexp.h"
#include "ldlang.h"
#include "ldfile.h"
+#include "ldlex.h"
#include "ldemul.h"
static int coff_version;
/* TI COFF extra command line options */
-#define OPTION_COFF_FORMAT (300 + 1)
static void
gld${EMULATION_NAME}_add_options
diff --git a/ld/emultempl/vms.em b/ld/emultempl/vms.em
index 67e9ea6..8baacb3 100644
--- a/ld/emultempl/vms.em
+++ b/ld/emultempl/vms.em
@@ -24,6 +24,7 @@
fragment <<EOF
#include "libiberty.h"
#include "getopt.h"
+#include "ldlex.h"
static void
gld${EMULATION_NAME}_before_parse (void)
@@ -125,7 +126,6 @@ vms_place_orphan (asection *s,
}
/* VMS specific options. */
-#define OPTION_IDENTIFICATION (300 + 1)
static void
gld${EMULATION_NAME}_add_options
diff --git a/ld/emultempl/vxworks.em b/ld/emultempl/vxworks.em
index 00cfeab..307049c 100644
--- a/ld/emultempl/vxworks.em
+++ b/ld/emultempl/vxworks.em
@@ -55,12 +55,6 @@ vxworks_after_open (void)
EOF
-PARSE_AND_LIST_PROLOGUE=$PARSE_AND_LIST_PROLOGUE'
-enum {
- OPTION_FORCE_DYNAMIC = 501
-};
-'
-
PARSE_AND_LIST_LONGOPTS=$PARSE_AND_LIST_LONGOPTS'
{"force-dynamic", no_argument, NULL, OPTION_FORCE_DYNAMIC},
'
diff --git a/ld/emultempl/xtensaelf.em b/ld/emultempl/xtensaelf.em
index 5129353..3508eb7 100644
--- a/ld/emultempl/xtensaelf.em
+++ b/ld/emultempl/xtensaelf.em
@@ -39,6 +39,9 @@ static void xtensa_colocate_output_literals (lang_statement_union_type *);
static void xtensa_strip_inconsistent_linkonce_sections
(lang_statement_list_type *);
+extern int elf32xtensa_size_opt;
+extern int elf32xtensa_no_literal_movement;
+extern int elf32xtensa_abi;
/* This number is irrelevant until we turn on use_literal_pages */
static bfd_vma xtensa_page_power = 12; /* 4K pages. */
@@ -1922,17 +1925,6 @@ EOF
# Define some shell vars to insert bits of code into the standard ELF
# parse_args and list_options functions.
#
-PARSE_AND_LIST_PROLOGUE='
-#define OPTION_OPT_SIZEOPT (300)
-#define OPTION_LITERAL_MOVEMENT (OPTION_OPT_SIZEOPT + 1)
-#define OPTION_NO_LITERAL_MOVEMENT (OPTION_LITERAL_MOVEMENT + 1)
-#define OPTION_ABI_WINDOWED (OPTION_NO_LITERAL_MOVEMENT + 1)
-#define OPTION_ABI_CALL0 (OPTION_ABI_WINDOWED + 1)
-extern int elf32xtensa_size_opt;
-extern int elf32xtensa_no_literal_movement;
-extern int elf32xtensa_abi;
-'
-
PARSE_AND_LIST_LONGOPTS='
{ "size-opt", no_argument, NULL, OPTION_OPT_SIZEOPT},
{ "literal-movement", no_argument, NULL, OPTION_LITERAL_MOVEMENT},
diff --git a/ld/ldlex.h b/ld/ldlex.h
index 161a9d4..e5ac2fa 100644
--- a/ld/ldlex.h
+++ b/ld/ldlex.h
@@ -181,6 +181,292 @@ enum option_values
OPTION_DISABLE_LINKER_VERSION,
OPTION_REMAP_INPUTS,
OPTION_REMAP_INPUTS_FILE,
+ /* Used by emultempl/elf.em, emultempl/pe.em and emultempl/pep.em. */
+ OPTION_BUILD_ID,
+ OPTION_EXCLUDE_LIBS,
+ /* Used by emulparams/elf32mcore.sh, emultempl/beos.em, emultempl/pe.em
+ and emultempl/pep.em. */
+ OPTION_BASE_FILE,
+ /* Used by emultempl/ppc32elf.em and emultempl/ppc64elf.em. */
+ OPTION_NO_INLINE_OPT,
+ OPTION_NO_PLT_ALIGN,
+ OPTION_NO_STUBSYMS,
+ OPTION_NO_TLS_GET_ADDR_OPT,
+ OPTION_NO_TLS_OPT,
+ OPTION_PLT_ALIGN,
+ OPTION_STUBSYMS,
+ /* Used by emultempl/armelf.em and emultempl/tic6xdsbt.em. */
+ OPTION_NO_MERGE_EXIDX_ENTRIES,
+ /* Used by emultempl/aarch64elf.em and emultempl/armelf.em. */
+ OPTION_PIC_VENEER,
+ OPTION_NO_ENUM_SIZE_WARNING,
+ OPTION_NO_WCHAR_SIZE_WARNING,
+ /* Used by emultempl/armelf.em and emultempl/pe.em. */
+ OPTION_THUMB_ENTRY,
+ /* Used by emultempl/beos.em, emultempl/nto.em, emultempl/pe.em and
+ emultempl/pep.em. */
+ OPTION_STACK,
+ /* Used by emultempl/aarch64elf.em, emultempl/armelf.em,
+ emultempl/cskyelf.em, emultempl/hppaelf.em, emultempl/metagelf.em
+ and emultempl/ppc64elf.em. */
+ OPTION_STUBGROUP_SIZE,
+ /* Used by emulparams/plt_unwind.sh. */
+ OPTION_LD_GENERATED_UNWIND_INFO,
+ OPTION_NO_LD_GENERATED_UNWIND_INFO,
+ /* Used by emultempl/aarch64elf.em. */
+ OPTION_FIX_ERRATUM_835769,
+ OPTION_FIX_ERRATUM_843419,
+ OPTION_NO_APPLY_DYNAMIC_RELOCS,
+ /* Used by emultempl/aix.em. */
+ OPTION_AUTOIMP,
+ OPTION_ERNOTOK,
+ OPTION_EROK,
+ OPTION_EXPALL,
+ OPTION_EXPFULL,
+ OPTION_EXPORT,
+ OPTION_IMPORT,
+ OPTION_INITFINI,
+ OPTION_LOADMAP,
+ OPTION_MAXDATA,
+ OPTION_MAXSTACK,
+ OPTION_MODTYPE,
+ OPTION_NOAUTOIMP,
+ OPTION_NOEXPALL,
+ OPTION_NOEXPFULL,
+ OPTION_NOSTRCMPCT,
+ OPTION_PD,
+ OPTION_PT,
+ OPTION_STRCMPCT,
+ OPTION_UNIX,
+ OPTION_32,
+ OPTION_64,
+ OPTION_LIBPATH,
+ OPTION_NOLIBPATH,
+ /* Used by emultempl/alphaelf.em. */
+ OPTION_TASO,
+ OPTION_SECUREPLT,
+ OPTION_NO_SECUREPLT,
+ /* Used by emultempl/armelf.em. */
+ OPTION_BE8,
+ OPTION_TARGET1_REL,
+ OPTION_TARGET1_ABS,
+ OPTION_TARGET2,
+ OPTION_FIX_V4BX,
+ OPTION_USE_BLX,
+ OPTION_VFP11_DENORM_FIX,
+ OPTION_FIX_V4BX_INTERWORKING,
+ OPTION_FIX_CORTEX_A8,
+ OPTION_NO_FIX_CORTEX_A8,
+ OPTION_FIX_ARM1176,
+ OPTION_NO_FIX_ARM1176,
+ OPTION_LONG_PLT,
+ OPTION_STM32L4XX_FIX,
+ OPTION_CMSE_IMPLIB,
+ OPTION_IN_IMPLIB,
+ /* Used by emultempl/avrelf.em. */
+ OPTION_NO_CALL_RET_REPLACEMENT,
+ OPTION_PMEM_WRAP_AROUND,
+ OPTION_NO_STUBS,
+ OPTION_DEBUG_STUBS,
+ OPTION_DEBUG_RELAX,
+ /* Used by emultempl/bfin.em. */
+ OPTION_CODE_IN_L1,
+ OPTION_DATA_IN_L1,
+ /* Used by emultempl/cskyelf.em. */
+ OPTION_BRANCH_STUB,
+ OPTION_NO_BRANCH_STUB,
+ /* Used by emultempl/elf.em. */
+ OPTION_DISABLE_NEW_DTAGS,
+ OPTION_ENABLE_NEW_DTAGS,
+ OPTION_GROUP,
+ OPTION_EH_FRAME_HDR,
+ OPTION_NO_EH_FRAME_HDR,
+ OPTION_HASH_STYLE,
+ OPTION_PACKAGE_METADATA,
+ OPTION_AUDIT,
+ OPTION_COMPRESS_DEBUG,
+ /* Used by emultempl/hppaelf.em. */
+ OPTION_MULTI_SUBSPACE,
+ /* Used by emultempl/ia64elf.em. */
+ OPTION_ITANIUM,
+ /* Used by emultempl/m68hc1xelf.em. */
+ OPTION_NO_TRAMPOLINE,
+ OPTION_BANK_WINDOW,
+ /* Used by emultempl/m68kelf.em. */
+ OPTION_GOT,
+ /* Used by emultempl/mipself.em. */
+ OPTION_INSN32,
+ OPTION_NO_INSN32,
+ OPTION_IGNORE_BRANCH_ISA,
+ OPTION_NO_IGNORE_BRANCH_ISA,
+ OPTION_COMPACT_BRANCHES,
+ OPTION_NO_COMPACT_BRANCHES,
+ /* Used by emultempl/msp430.em. */
+ OPTION_CODE_REGION,
+ OPTION_DATA_REGION,
+ OPTION_DISABLE_TRANS,
+ /* Used by emultempl/nds32elf.em. */
+ OPTION_BASELINE,
+ OPTION_ELIM_GC_RELOCS,
+ OPTION_FP_AS_GP,
+ OPTION_NO_FP_AS_GP,
+ OPTION_REDUCE_FP_UPDATE,
+ OPTION_NO_REDUCE_FP_UPDATE,
+ OPTION_EXPORT_SYMBOLS,
+ OPTION_HYPER_RELAX,
+ OPTION_TLSDESC_TRAMPOLINE,
+ OPTION_NO_TLSDESC_TRAMPOLINE,
+ /* Used by emultempl/nto.em. */
+ OPTION_LAZY_STACK,
+ /* Used by emultempl/pe.em, emultempl/pep.em and emultempl/beos.em. */
+ OPTION_DLL,
+ OPTION_FILE_ALIGNMENT,
+ OPTION_IMAGE_BASE,
+ OPTION_MAJOR_IMAGE_VERSION,
+ OPTION_MAJOR_OS_VERSION,
+ OPTION_MAJOR_SUBSYSTEM_VERSION,
+ OPTION_MINOR_IMAGE_VERSION,
+ OPTION_MINOR_OS_VERSION,
+ OPTION_MINOR_SUBSYSTEM_VERSION,
+ OPTION_SECTION_ALIGNMENT,
+ OPTION_SUBSYSTEM,
+ OPTION_HEAP,
+ OPTION_SUPPORT_OLD_CODE,
+ OPTION_OUT_DEF,
+ OPTION_EXPORT_ALL,
+ OPTION_EXCLUDE_SYMBOLS,
+ OPTION_EXCLUDE_ALL_SYMBOLS,
+ OPTION_KILL_ATS,
+ OPTION_STDCALL_ALIASES,
+ OPTION_ENABLE_STDCALL_FIXUP,
+ OPTION_DISABLE_STDCALL_FIXUP,
+ OPTION_WARN_DUPLICATE_EXPORTS,
+ OPTION_IMP_COMPAT,
+ OPTION_ENABLE_AUTO_IMAGE_BASE,
+ OPTION_DISABLE_AUTO_IMAGE_BASE,
+ OPTION_DLL_SEARCH_PREFIX,
+ OPTION_NO_DEFAULT_EXCLUDES,
+ OPTION_DLL_ENABLE_AUTO_IMPORT,
+ OPTION_DLL_DISABLE_AUTO_IMPORT,
+ OPTION_ENABLE_EXTRA_PE_DEBUG,
+ OPTION_DLL_ENABLE_RUNTIME_PSEUDO_RELOC,
+ OPTION_DLL_DISABLE_RUNTIME_PSEUDO_RELOC,
+ OPTION_LARGE_ADDRESS_AWARE,
+ OPTION_DISABLE_LARGE_ADDRESS_AWARE,
+ OPTION_DLL_ENABLE_RUNTIME_PSEUDO_RELOC_V1,
+ OPTION_DLL_ENABLE_RUNTIME_PSEUDO_RELOC_V2,
+ OPTION_EXCLUDE_MODULES_FOR_IMPLIB,
+ OPTION_USE_NUL_PREFIXED_IMPORT_TABLES,
+ OPTION_NO_LEADING_UNDERSCORE,
+ OPTION_LEADING_UNDERSCORE,
+ OPTION_ENABLE_LONG_SECTION_NAMES,
+ OPTION_DISABLE_LONG_SECTION_NAMES,
+ /* DLLCharacteristics flags. */
+ OPTION_DYNAMIC_BASE,
+ OPTION_FORCE_INTEGRITY,
+ OPTION_NX_COMPAT,
+ OPTION_NO_ISOLATION,
+ OPTION_NO_SEH,
+ OPTION_NO_BIND,
+ OPTION_WDM_DRIVER,
+ OPTION_TERMINAL_SERVER_AWARE,
+ /* Determinism. */
+ OPTION_INSERT_TIMESTAMP,
+ OPTION_NO_INSERT_TIMESTAMP,
+ OPTION_PDB,
+ OPTION_ENABLE_RELOC_SECTION,
+ OPTION_DISABLE_RELOC_SECTION,
+ /* DLL Characteristics flags. */
+ OPTION_DISABLE_DYNAMIC_BASE,
+ OPTION_DISABLE_FORCE_INTEGRITY,
+ OPTION_DISABLE_NX_COMPAT,
+ OPTION_DISABLE_NO_ISOLATION,
+ OPTION_DISABLE_NO_SEH,
+ OPTION_DISABLE_NO_BIND,
+ OPTION_DISABLE_WDM_DRIVER,
+ OPTION_DISABLE_TERMINAL_SERVER_AWARE,
+ /* Used by emultempl/pep.em. */
+ OPTION_DISABLE_HIGH_ENTROPY_VA,
+ OPTION_HIGH_ENTROPY_VA,
+ /* Used by emultempl/ppc32elf.em. */
+ OPTION_NEW_PLT,
+ OPTION_OLD_PLT,
+ OPTION_OLD_GOT,
+ OPTION_PPC476_WORKAROUND,
+ OPTION_NO_PPC476_WORKAROUND,
+ OPTION_NO_PICFIXUP,
+ OPTION_VLE_RELOC_FIXUP,
+ /* Used by emultempl/ppc64elf.em. */
+ OPTION_PLT_STATIC_CHAIN,
+ OPTION_NO_PLT_STATIC_CHAIN,
+ OPTION_PLT_THREAD_SAFE,
+ OPTION_NO_PLT_THREAD_SAFE,
+ OPTION_PLT_LOCALENTRY,
+ OPTION_NO_PLT_LOCALENTRY,
+ OPTION_POWER10_STUBS,
+ OPTION_NO_POWER10_STUBS,
+ OPTION_NO_PCREL_OPT,
+ OPTION_SAVRES,
+ OPTION_NO_SAVRES,
+ OPTION_DOTSYMS,
+ OPTION_NO_DOTSYMS,
+ OPTION_TLS_GET_ADDR_OPT,
+ OPTION_TLS_GET_ADDR_REGSAVE,
+ OPTION_NO_TLS_GET_ADDR_REGSAVE,
+ OPTION_NO_OPD_OPT,
+ OPTION_NO_TOC_OPT,
+ OPTION_NO_MULTI_TOC,
+ OPTION_NO_TOC_SORT,
+ OPTION_NON_OVERLAPPING_OPD,
+ /* Used by emultempl/riscvelf.em. */
+ OPTION_RELAX_GP,
+ OPTION_NO_RELAX_GP,
+ OPTION_CHECK_ULEB128,
+ OPTION_NO_CHECK_ULEB128,
+ /* Used by emultempl/rxelf.em. */
+ OPTION_NO_FLAG_MISMATCH_WARNINGS,
+ OPTION_IGNORE_LMA,
+ OPTION_NO_IGNORE_LMA,
+ OPTION_FLAG_MISMATCH_WARNINGS,
+ /* Used by emultempl/s390.em. */
+ OPTION_PGSTE,
+ /* Used by emultempl/spuelf.em. */
+ OPTION_SPU_PLUGIN,
+ OPTION_SPU_NO_OVERLAYS,
+ OPTION_SPU_COMPACT_STUBS,
+ OPTION_SPU_STUB_SYMS,
+ OPTION_SPU_NON_OVERLAY_STUBS,
+ OPTION_SPU_LOCAL_STORE,
+ OPTION_SPU_STACK_ANALYSIS,
+ OPTION_SPU_STACK_SYMS,
+ OPTION_SPU_AUTO_OVERLAY,
+ OPTION_SPU_AUTO_RELINK,
+ OPTION_SPU_OVERLAY_RODATA,
+ OPTION_SPU_SOFT_ICACHE,
+ OPTION_SPU_LINE_SIZE,
+ OPTION_SPU_NUM_LINES,
+ OPTION_SPU_LRLIVE,
+ OPTION_SPU_NON_IA_TEXT,
+ OPTION_SPU_FIXED_SPACE,
+ OPTION_SPU_RESERVED_SPACE,
+ OPTION_SPU_EXTRA_STACK,
+ OPTION_SPU_NO_AUTO_OVERLAY,
+ OPTION_SPU_EMIT_FIXUPS,
+ /* Used by emultempl/tic6xdsbt.em. */
+ OPTION_DSBT_INDEX,
+ OPTION_DSBT_SIZE,
+ /* Used by emultempl/ticoff.em. */
+ OPTION_COFF_FORMAT,
+ /* Used by emultempl/vms.em. */
+ OPTION_IDENTIFICATION,
+ /* Used by emultempl/vxworks.em. */
+ OPTION_FORCE_DYNAMIC,
+ /* Used by emultempl/xtensaelf.em. */
+ OPTION_OPT_SIZEOPT,
+ OPTION_LITERAL_MOVEMENT,
+ OPTION_NO_LITERAL_MOVEMENT,
+ OPTION_ABI_WINDOWED,
+ OPTION_ABI_CALL0,
};
/* The initial parser states. */