ld: Add --undefined-version
authorFangrui Song <i@maskray.me>
Fri, 14 Oct 2022 02:06:43 +0000 (19:06 -0700)
committerFangrui Song <i@maskray.me>
Fri, 14 Oct 2022 02:06:43 +0000 (19:06 -0700)
This cancels a previous --no-undefined-version.
gold has had --undefined-version for a long time.

ld/ldlex.h
ld/lexsup.c

index 57ade1f754b419223d5b299aa912db8b8e7da641..894582595c11b59a9f3e9a84fe5dcb784c0e9c41 100644 (file)
@@ -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,
index 0c01c9966e00be6e0b9b20940ac519a3a6f4396f..0068ff5979827386b95312f97f38c0aa6fd41965 100644 (file)
@@ -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;