Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Jan 2021 20:11:12 GMT
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 3dfcb70b6ae9 - main - elfctl: add backwards compatibility for "no" prefixes
Message-ID:  <202101142011.10EKBCWs091335@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=3dfcb70b6ae9bcb9fd6a66721bebdb8c6a53c329

commit 3dfcb70b6ae9bcb9fd6a66721bebdb8c6a53c329
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2021-01-13 19:21:38 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2021-01-14 20:09:08 +0000

    elfctl: add backwards compatibility for "no" prefixes
    
    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
---
 usr.bin/elfctl/elfctl.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/usr.bin/elfctl/elfctl.c b/usr.bin/elfctl/elfctl.c
index 9d75c002d82c..570bdba2e2be 100644
--- a/usr.bin/elfctl/elfctl.c
+++ b/usr.bin/elfctl/elfctl.c
@@ -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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202101142011.10EKBCWs091335>