ld: Add --undefined-version

This cancels a previous --no-undefined-version.
gold has had --undefined-version for a long time.
This commit is contained in:
Fangrui Song 2022-10-13 19:06:43 -07:00
parent 091782c46d
commit 27fb6a1a7f
2 changed files with 6 additions and 0 deletions

View 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,

View 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;