Add removing of the -Wl,-Bsymbolic options in gcc-force-options script
authorMaria Guseva <m.guseva@samsung.com>
Fri, 5 May 2017 15:14:58 +0000 (18:14 +0300)
committerMaria Guseva <m.guseva@samsung.com>
Tue, 11 Jul 2017 02:46:03 +0000 (11:46 +0900)
packaging/gcc-force-options

index 34f49455f2b8a0ddd79b389ef39e42a02a642377..b68c3d2ec14e8aee817929f1caea8ad8fc2cc6bd 100755 (executable)
@@ -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