toolchain-external: instrument wrapper to warn about unsafe paths
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Wed, 10 Dec 2014 22:53:46 +0000 (23:53 +0100)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Wed, 10 Dec 2014 23:05:52 +0000 (00:05 +0100)
commit5aa205eba4063ddf17a2e11420eea2a8aa7536a5
tree9d42668018a33c4068cbe69ccdf5fec38a3a259b
parentb39a4bd486f9ddbb0b909abab238d6c32f4b5a0b
toolchain-external: instrument wrapper to warn about unsafe paths

The CodeSourcery toolchains have a very interesting feature: they warn
the user when an unsafe header or library path is used, i.e a path
that will lead host headers or libraries to leak into the build.

This commit adds a similar functionality into our external toolchain
wrapper, so that it can be used with all external toolchains, and can
also be tuned as needed. By default, the external toolchain wrapper
now gives warnings such as:

  arm-linux-gcc: WARNING: unsafe header/library path used in cross-compilation: '-I /usr/foo'
  arm-linux-gcc: WARNING: unsafe header/library path used in cross-compilation: '-L /usr/bleh'

but the compilation continues successfully. One can then easily grep
in his build log to search for occurences of this message.

Optionally, if BR_COMPILER_PARANOID_UNSAFE_PATH is defined in the
environment to a non empty value, the external wrapper will instead
error out and abort the compilation.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Romain Naour <romain.naour@openwide.fr>
Tested-by: Romain Naour <romain.naour@openwide.fr>
toolchain/toolchain-external/ext-toolchain-wrapper.c