mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Michael Olbrich <m.olbrich@pengutronix.de>
To: ptxdist@pengutronix.de, Lucas Stach <l.stach@pengutronix.de>
Cc: Michael Olbrich <m.olbrich@pengutronix.de>
Subject: [ptxdist] [PATCH 1/2] wrapper: add package variable to blacklist compiler flags
Date: Fri, 21 May 2021 09:28:39 +0200	[thread overview]
Message-ID: <20210521072841.2133655-2-m.olbrich@pengutronix.de> (raw)
In-Reply-To: <20210521072841.2133655-1-m.olbrich@pengutronix.de>

Another option to prevent unwanted implicit dependencies.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
---
 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.
 
+``<PKG>_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<lib>' to the blacklist makes it possible to prevent such a detection
+  and explicitly avoid the dependency.
+
 ``<PKG>_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


  reply	other threads:[~2021-05-21  7:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-04 20:35 [ptxdist] [PATCH] fio: select ZLIB Lucas Stach
2021-05-21  7:28 ` Michael Olbrich
2021-05-21  7:28   ` Michael Olbrich [this message]
2021-05-21  7:28   ` [ptxdist] [PATCH 2/2] fio: don't try to use zlib or aio Michael Olbrich
2021-05-21  8:19     ` Lucas Stach
2021-05-21 10:47       ` Michael Olbrich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210521072841.2133655-2-m.olbrich@pengutronix.de \
    --to=m.olbrich@pengutronix.de \
    --cc=l.stach@pengutronix.de \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox