public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Fangrui Song <maskray@google.com>
To: binutils@sourceware.org
Cc: Fangrui Song <i@maskray.me>
Subject: [PATCH] ld: Add --undefined-version
Date: Thu, 13 Oct 2022 13:13:32 -0700	[thread overview]
Message-ID: <20221013201332.2747246-1-maskray@google.com> (raw)

From: Fangrui Song <i@maskray.me>

This cancels a previous --no-undefined-version.
gold has had --undefined-version for a long time.
---
 ld/ldlex.h  | 1 +
 ld/lexsup.c | 5 +++++
 2 files changed, 6 insertions(+)

diff --git a/ld/ldlex.h b/ld/ldlex.h
index 57ade1f754b..894582595c1 100644
--- a/ld/ldlex.h
+++ b/ld/ldlex.h
@@ -120,6 +120,7 @@ enum option_values
 #if SUPPORT_ERROR_HANDLING_SCRIPT
   OPTION_ERROR_HANDLING_SCRIPT,
 #endif
+  OPTION_UNDEFINED_VERSION,
   OPTION_NO_UNDEFINED_VERSION,
   OPTION_DEFAULT_SYMVER,
   OPTION_DEFAULT_IMPORTED_SYMVER,
diff --git a/ld/lexsup.c b/ld/lexsup.c
index 299371fb775..5053e784b75 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -396,6 +396,8 @@ static const struct ld_option ld_options[] =
      OPTION_ERROR_HANDLING_SCRIPT},
     '\0', N_("SCRIPT"), N_("Provide a script to help with undefined symbol errors"), TWO_DASHES},
 #endif
+  { {"undefined-version", no_argument, NULL, OPTION_UNDEFINED_VERSION},
+    '\0', NULL, N_("Allow undefined version"), EXACTLY_TWO_DASHES },
   { {"no-undefined-version", no_argument, NULL, OPTION_NO_UNDEFINED_VERSION},
     '\0', NULL, N_("Disallow undefined version"), TWO_DASHES },
   { {"default-symver", no_argument, NULL, OPTION_DEFAULT_SYMVER},
@@ -1088,6 +1090,9 @@ parse_args (unsigned argc, char **argv)
 	  break;
 #endif
 
+	case OPTION_UNDEFINED_VERSION:
+	  link_info.allow_undefined_version = true;
+	  break;
 	case OPTION_NO_UNDEFINED_VERSION:
 	  link_info.allow_undefined_version = false;
 	  break;
-- 
2.38.0.413.g74048e4d9e-goog


             reply	other threads:[~2022-10-13 20:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-13 20:13 Fangrui Song [this message]
2022-10-13 22:47 ` Alan Modra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221013201332.2747246-1-maskray@google.com \
    --to=maskray@google.com \
    --cc=binutils@sourceware.org \
    --cc=i@maskray.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).