From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Fri, 21 May 2021 09:29:55 +0200 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by lore.white.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1ljzbX-0001S4-Ku for lore@lore.pengutronix.de; Fri, 21 May 2021 09:29:55 +0200 Received: from localhost ([127.0.0.1] helo=metis.ext.pengutronix.de) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1ljzbX-0007S4-3Z; Fri, 21 May 2021 09:29:55 +0200 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ljzaV-00079h-W1; Fri, 21 May 2021 09:28:52 +0200 Received: from [2a0a:edc0:0:1101:1d::39] (helo=dude03.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1ljzaV-0002JA-4r; Fri, 21 May 2021 09:28:51 +0200 Received: from mol by dude03.red.stw.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1ljzaV-00AoVx-3b; Fri, 21 May 2021 09:28:51 +0200 From: Michael Olbrich To: ptxdist@pengutronix.de, Lucas Stach Date: Fri, 21 May 2021 09:28:39 +0200 Message-Id: <20210521072841.2133655-2-m.olbrich@pengutronix.de> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210521072841.2133655-1-m.olbrich@pengutronix.de> References: <20210504203506.20672-1-l.stach@pengutronix.de> <20210521072841.2133655-1-m.olbrich@pengutronix.de> MIME-Version: 1.0 Subject: [ptxdist] [PATCH 1/2] wrapper: add package variable to blacklist compiler flags X-BeenThere: ptxdist@pengutronix.de X-Mailman-Version: 2.1.29 Precedence: list List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: ptxdist@pengutronix.de Cc: Michael Olbrich Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "ptxdist" X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: ptxdist-bounces@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false Another option to prevent unwanted implicit dependencies. Signed-off-by: Michael Olbrich --- doc/ref_make_variables.rst | 8 ++++++++ rules/post/ptxd_make_world_common.make | 1 + scripts/wrapper/libwrapper.sh | 6 ++++++ 3 files changed, 15 insertions(+) diff --git a/doc/ref_make_variables.rst b/doc/ref_make_variables.rst index b770b1b49f18..674acdcea982 100644 --- a/doc/ref_make_variables.rst +++ b/doc/ref_make_variables.rst @@ -308,6 +308,14 @@ Build Environment for all Stages flags. Adding them via environment variables or ``make`` arguments can have unexpected side effects, such as as overwriting existing defaults. +``_FLAGS_BLACKLIST`` + A list of arbitrary flags. If any one of these flags is found as an + argument to the compiler, preprocessor or linker then the call will fail. + This is useful to prevent implicit dependencies: Many packages try to + link to libraries at configure time and use them if it works. Adding + '-l' to the blacklist makes it possible to prevent such a detection + and explicitly avoid the dependency. + ``_WRAPPER_BLACKLIST`` PTXdist has several options in the platformconfig that inject options in the compiler command line. This is used, for example, to add hardening diff --git a/rules/post/ptxd_make_world_common.make b/rules/post/ptxd_make_world_common.make index 172f4c3296af..e5cf50214e9c 100644 --- a/rules/post/ptxd_make_world_common.make +++ b/rules/post/ptxd_make_world_common.make @@ -94,6 +94,7 @@ world/env/impl = \ pkg_build_dir="$(call ptx/escape,$($(1)_BUILD_DIR))" \ \ pkg_wrapper_blacklist="$(call ptx/escape,$($(1)_WRAPPER_BLACKLIST))" \ + pkg_flags_blacklist="$(call ptx/escape,$($(1)_FLAGS_BLACKLIST))" \ \ pkg_cppflags="$(call ptx/escape,$($(1)_CPPFLAGS))" \ pkg_cflags="$(call ptx/escape,$($(1)_CFLAGS))" \ diff --git a/scripts/wrapper/libwrapper.sh b/scripts/wrapper/libwrapper.sh index 0a970638a859..a7cdbeac05dd 100644 --- a/scripts/wrapper/libwrapper.sh +++ b/scripts/wrapper/libwrapper.sh @@ -103,6 +103,12 @@ cc_check_args() { COMPILING=true ;; esac + case " ${pkg_flags_blacklist} " in + *" ${ARG} "*) + echo "wrapper: found blacklisted flag '${ARG}'" >&2 + exit 1 + ;; + esac done # Used e.g. by the kernel to get the compiler version. Adding # linker options confuses gcc because there is nothing to link. -- 2.29.2 _______________________________________________ ptxdist mailing list ptxdist@pengutronix.de To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de