lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 30 Mar 2023 01:39:21 +0200
From:   technoboy85@...il.com
To:     rust-for-linux@...r.kernel.org
Cc:     linux-kernel@...r.kernel.org, Miguel Ojeda <ojeda@...nel.org>,
        Alex Gaynor <alex.gaynor@...il.com>,
        Wedson Almeida Filho <wedsonaf@...il.com>,
        Matteo Croce <teknoraver@...a.com>
Subject: [PATCH] rust: fix bindgen arguments

From: Matteo Croce <teknoraver@...a.com>

bindgen renamed some arguments to be more inclusive.
Detect if bindgen uses the new syntax and use it,
otherwise fallback to the previous one.

Signed-off-by: Matteo Croce <teknoraver@...a.com>
---
 rust/Makefile | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/rust/Makefile b/rust/Makefile
index ff70c4c916f8..3a4971d84b63 100644
--- a/rust/Makefile
+++ b/rust/Makefile
@@ -68,6 +68,11 @@ quiet_cmd_rustdoc = RUSTDOC $(if $(rustdoc_host),H, ) $<
 		--crate-name $(subst rustdoc-,,$@) \
 		@$(objtree)/include/generated/rustc_cfg $<
 
+bindgen-list = $(shell if $(BINDGEN) --help |grep -q -- --allowlist;			\
+	then echo "--blocklist-type '.*' --allowlist-var '' --allowlist-function";	\
+	else echo "--blacklist-type '.*' --whitelist-var '' --whitelist-function";	\
+	fi)
+
 # The `html_logo_url` and `html_favicon_url` forms of the `doc` attribute
 # can be used to specify a custom logo. However:
 #   - The given value is used as-is, thus it cannot be relative or a local file
@@ -300,8 +305,7 @@ $(obj)/bindings/bindings_generated.rs: $(src)/bindings/bindings_helper.h \
 # given it is `libclang`; but for consistency, future Clang changes and/or
 # a potential future GCC backend for `bindgen`, we disable it too.
 $(obj)/bindings/bindings_helpers_generated.rs: private bindgen_target_flags = \
-    --blacklist-type '.*' --whitelist-var '' \
-    --whitelist-function 'rust_helper_.*'
+    $(bindgen-list) 'rust_helper_.*'
 $(obj)/bindings/bindings_helpers_generated.rs: private bindgen_target_cflags = \
     -I$(objtree)/$(obj) -Wno-missing-prototypes -Wno-missing-declarations
 $(obj)/bindings/bindings_helpers_generated.rs: private bindgen_target_extra = ; \
-- 
2.40.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ