Skip to content

Commit

Permalink
elfctl: add backwards compatibility for "no" prefixes
Browse files Browse the repository at this point in the history
I am going to prefix opt-out ELF feature flag names with "no" to make
their meaning more clear (review D28139), but there are some uses of the
existing names already (e.g., the PR referenced below).

For now accept the older, unprefixed name as well, and emit a warning.
We can revert this after FreeBSD 13 branches.

% elfctl -e +aslr foo
elfctl: interpreting aslr as noaslr; please specify noaslr

PR:		239873 (related)
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28140
  • Loading branch information
emaste committed Jan 14, 2021
1 parent b360682 commit 3dfcb70
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions usr.bin/elfctl/elfctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,16 @@ convert_to_feature_val(char *feature_str, uint32_t *feature_val)
input |= featurelist[i].value;
break;
}
/* XXX Backwards compatibility for "no"-prefix flags. */
if (strncmp(featurelist[i].alias, "no", 2) == 0 &&
strcmp(featurelist[i].alias + 2, feature) == 0) {
input |= featurelist[i].value;
warnx(
"interpreting %s as %s; please specify %s",
feature, featurelist[i].alias,
featurelist[i].alias);
break;
}
}
if (i == len) {
warnx("%s is not a valid feature", feature);
Expand Down

0 comments on commit 3dfcb70

Please sign in to comment.