[RFC,10/11] configure: Add --disable-demangle

Message ID 20230206222513.1773039-11-iii@linux.ibm.com
State Superseded
Headers
Series Add Memory Sanitizer support |

Commit Message

Ilya Leoshkevich Feb. 6, 2023, 10:25 p.m. UTC
  __cxa_demangle is normally implemented in the C++ runtime library,
instrumenting which for MSan is a hassle. Add a knob for disabling it.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
 configure.ac | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
  

Comments

Mark Wielaard Feb. 8, 2023, 6:14 p.m. UTC | #1
Hi Ilya,

On Mon, 2023-02-06 at 23:25 +0100, Ilya Leoshkevich via Elfutils-devel
wrote:
> __cxa_demangle is normally implemented in the C++ runtime library,
> instrumenting which for MSan is a hassle. Add a knob for disabling it.
> 
> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
> ---
>  configure.ac | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 7dc9be63..6a5c38af 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -466,11 +466,17 @@ CFLAGS="$CFLAGS -D_GNU_SOURCE"
>  AC_FUNC_STRERROR_R()
>  CFLAGS="$old_CFLAGS"
>  
> +AC_ARG_ENABLE([demangler],
> +AS_HELP_STRING([--disable-demangle],
> +               [Disable libstdc++ demangle support]))

Typo [--disable-demangler] (missing r).
Also we want to enable demangler support by default if the enable
option isn't given, so you need to add [], [enable_demangler=yes] at
the end.

AC_ARG_ENABLE (feature, help-string, [action-if-given], [action-if-not-
given])

So the action-if-not-given is to enable the feature.

Note that otherwise the summary at the end will have nothing for:

    libstdc++ demangle support         : 

Should be either yes or no, even when --enable-demangler or --disable-
demangler isn't given.

Cheers,

Mark

> +AS_IF([test "x$enable_demangler" == xyes],
>  AC_CHECK_LIB([stdc++], [__cxa_demangle], [dnl
>  AC_DEFINE([USE_DEMANGLE], [1], [Defined if demangling is enabled])])
>  AM_CONDITIONAL(DEMANGLE, test "x$ac_cv_lib_stdcpp___cxa_demangle" = "xyes")
>  AS_IF([test "x$ac_cv_lib_stdcpp___cxa_demangle" = "xyes"],
> -      [enable_demangler=yes],[enable_demangler=no])
> +      [enable_demangler=yes],[enable_demangler=no]),
> +AM_CONDITIONAL(DEMANGLE, false))
>  
>  AC_ARG_ENABLE([textrelcheck],
>  AS_HELP_STRING([--disable-textrelcheck],
  

Patch

diff --git a/configure.ac b/configure.ac
index 7dc9be63..6a5c38af 100644
--- a/configure.ac
+++ b/configure.ac
@@ -466,11 +466,17 @@  CFLAGS="$CFLAGS -D_GNU_SOURCE"
 AC_FUNC_STRERROR_R()
 CFLAGS="$old_CFLAGS"
 
+AC_ARG_ENABLE([demangler],
+AS_HELP_STRING([--disable-demangle],
+               [Disable libstdc++ demangle support]))
+
+AS_IF([test "x$enable_demangler" == xyes],
 AC_CHECK_LIB([stdc++], [__cxa_demangle], [dnl
 AC_DEFINE([USE_DEMANGLE], [1], [Defined if demangling is enabled])])
 AM_CONDITIONAL(DEMANGLE, test "x$ac_cv_lib_stdcpp___cxa_demangle" = "xyes")
 AS_IF([test "x$ac_cv_lib_stdcpp___cxa_demangle" = "xyes"],
-      [enable_demangler=yes],[enable_demangler=no])
+      [enable_demangler=yes],[enable_demangler=no]),
+AM_CONDITIONAL(DEMANGLE, false))
 
 AC_ARG_ENABLE([textrelcheck],
 AS_HELP_STRING([--disable-textrelcheck],