# 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