diff options
author | Michael Olbrich <m.olbrich@pengutronix.de> | 2021-05-21 09:21:57 +0200 |
---|---|---|
committer | Michael Olbrich <m.olbrich@pengutronix.de> | 2021-05-21 09:22:48 +0200 |
commit | 146417b9204c3fb0e0ba64a27affad52b491a82d (patch) | |
tree | 07baf604f437f8458c0f1151512a2292a825a933 | |
parent | a3236ba179741eaa4d33e712d4850e7e4af58c24 (diff) | |
download | ptxdist-146417b9204c3fb0e0ba64a27affad52b491a82d.tar.gz ptxdist-146417b9204c3fb0e0ba64a27affad52b491a82d.tar.xz |
wrapper: add package variable to blacklist compiler flags
Another option to prevent unwanted implicit dependencies.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
-rw-r--r-- | doc/ref_make_variables.rst | 8 | ||||
-rw-r--r-- | rules/post/ptxd_make_world_common.make | 1 | ||||
-rw-r--r-- | scripts/wrapper/libwrapper.sh | 6 |
3 files changed, 15 insertions, 0 deletions
diff --git a/doc/ref_make_variables.rst b/doc/ref_make_variables.rst index b770b1b49..674acdcea 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 172f4c329..e5cf50214 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 0a970638a..a7cdbeac0 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. |