From 99c6dabf690901849849801168d427bb2dfe0eae Mon Sep 17 00:00:00 2001 From: Maria Guseva Date: Fri, 5 May 2017 18:14:58 +0300 Subject: [PATCH] Add removing of the -Wl,-Bsymbolic options in gcc-force-options script --- packaging/gcc-force-options | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packaging/gcc-force-options b/packaging/gcc-force-options index 34f4945..b68c3d2 100755 --- a/packaging/gcc-force-options +++ b/packaging/gcc-force-options @@ -47,10 +47,16 @@ if echo "$PREFLAGS "\$@" $POSTFLAGS" | grep -q -- "-fsanitize=undefined" && echo # Don't instrument kernel modules # Don't instrument with "-nostdlib" linking elif ! echo "\$@" | grep -q -e __KERNEL__ -e \-nostdlib; then + ARGS="\$@" + if echo "$PREFLAGS \$ARGS $POSTFLAGS" | grep -q -- 'libsancov_cb.a\\|-lsancov_cb'; then + # Remove -Bsymbolic flags to use weak symbols in libsancov_cb.a + echo "Warning: -Bsymbolic linkage flags will be removed, see gcc-force-options for details" >&2 + ARGS=\$(echo "\$@" | sed 's/-Wl,-Bsymbolic\\(-functions\\)\\?\\b//g') + fi # Use readlink in order to follow symlinks if any - \$(readlink -f \$0)-real $PREFLAGS "\$@" $POSTFLAGS + \$(readlink -f \$0)-real $PREFLAGS \$ARGS $POSTFLAGS else - \$(readlink -f \$0)-real "\$@" + \$(readlink -f \$0)-real \$ARGS fi EOF chmod +x $TMP -- 2.34.1