aboutsummaryrefslogtreecommitdiff
path: root/ld/lexsup.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2023-03-15 14:27:21 +0000
committerNick Clifton <nickc@redhat.com>2023-03-15 14:27:21 +0000
commit2d5783fad77c2cb9cdcb396d65fe0a60e3d8938b (patch)
tree6f498d98b1bd86aba1498861443099802ac0f8c8 /ld/lexsup.c
parent71f646f2b3fc6e273fd17b5fdc9ba6bae242b330 (diff)
downloadgdb-2d5783fad77c2cb9cdcb396d65fe0a60e3d8938b.zip
gdb-2d5783fad77c2cb9cdcb396d65fe0a60e3d8938b.tar.gz
gdb-2d5783fad77c2cb9cdcb396d65fe0a60e3d8938b.tar.bz2
Add --enable-linker-version option to bfd linker to add an entry in the .comment section.
PR 30187 * NEWS: Mention the new feature. * ld.texi: Document the new feature. * ldgram.y: Handle LINKER_VERSION token. * ldlang.c (lang_add_version): New function. (enable_linker_version): New global variable. * ldlang.h (land_add_version): Prototype. (enable_linker_version): Export. * ldlex.h (OPTION_ENABLE_LINKER_VERSION): Define. (OPTION_DISABLE_LINKER_VERSION): Define. * ldlex.l (LINKER_VERSION): Add token. * lexsup.c (ld_options): Add --enable-linker-version and --disable-linker-version. (parse_args): Handle the new options. * scripttempl/arclinux.sc: Remove stabs and comment sections and replace with inclusion of misc-sections.sc * scripttempl/avr.sc: Likewise. * scripttempl/dlx.sc: Likewise. * scripttempl/elf.sc: Likewise. * scripttempl/elf32cr16.sc: Likewise. * scripttempl/elf32crx.sc: Likewise. * scripttempl/elf32msp430.sc: Likewise. * scripttempl/elf64bpf.sc: Likewise. * scripttempl/elf64hppa.sc: Likewise. * scripttempl/elf_chaos.sc: Likewise. * scripttempl/elfarc.sc: Likewise. * scripttempl/elfarcv2.sc: Likewise. * scripttempl/elfd10v.sc: Likewise. * scripttempl/elfd30v.sc: Likewise. * scripttempl/elfm68hc11.sc: Likewise. * scripttempl/elfm68hc12.sc: Likewise. * scripttempl/elfm9s12z.sc: Likewise. * scripttempl/elfmicroblaze.sc: Likewise. * scripttempl/elfxgate.sc: Likewise. * scripttempl/elfxtensa.sc: Likewise. * scripttempl/epiphany_4x4.sc: Likewise. * scripttempl/ft32.sc: Likewise. * scripttempl/ip2k.sc: Likewise. * scripttempl/iq2000.sc: Likewise. * scripttempl/mep.sc: Likewise. * scripttempl/nds32elf.sc: Likewise. * scripttempl/pru.sc: Likewise. * scripttempl/v850.sc: Likewise. * scripttempl/v850_rh850.sc: Likewise. * scripttempl/visium.sc: Likewise. * scripttempl/xstormy16.sc: Likewise. * scripttempl/z80.sc: Likewise. * testsuite/ld-scripts/script.exp: Run new tests. * scripttempl/misc-sections.sc: New file. * testsuite/ld-scripts/ld-version-2.d: New file. * testsuite/ld-scripts/ld-version.d: New file. * testsuite/ld-scripts/ld-version.t: New file.
Diffstat (limited to 'ld/lexsup.c')
-rw-r--r--ld/lexsup.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/ld/lexsup.c b/ld/lexsup.c
index a1c6140..7dc2228 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -130,6 +130,10 @@ static const struct ld_option ld_options[] =
'\0', NULL, N_("Enable support of non-contiguous memory regions"), TWO_DASHES },
{ {"enable-non-contiguous-regions-warnings", no_argument, NULL, OPTION_NON_CONTIGUOUS_REGIONS_WARNINGS},
'\0', NULL, N_("Enable warnings when --enable-non-contiguous-regions may cause unexpected behaviour"), TWO_DASHES },
+ { {"disable-linker-version", no_argument, NULL, OPTION_DISABLE_LINKER_VERSION},
+ '\0', NULL, N_("Disable the LINKER_VERSION linker script directive"), TWO_DASHES },
+ { {"enable-linker-version", no_argument, NULL, OPTION_ENABLE_LINKER_VERSION},
+ '\0', NULL, N_("Enable the LINKER_VERSION linker script directive"), TWO_DASHES },
{ {"EB", no_argument, NULL, OPTION_EB},
'\0', NULL, N_("Link big-endian objects"), ONE_DASH },
{ {"EL", no_argument, NULL, OPTION_EL},
@@ -1095,6 +1099,13 @@ parse_args (unsigned argc, char **argv)
break;
#endif
+ case OPTION_ENABLE_LINKER_VERSION:
+ enable_linker_version = true;
+ break;
+ case OPTION_DISABLE_LINKER_VERSION:
+ enable_linker_version = false;
+ break;
+
case OPTION_UNDEFINED_VERSION:
link_info.allow_undefined_version = true;
break;