Skip to content

configure: sanitizer builds (--enable-asan/tsan/ubsan) are built with LTO; --enable-debug is not #4861

Closed

Description

@ThalesBarretto

What

--enable-asan, --enable-tsan and --enable-ubsan all build with -flto:

$ ./configure --enable-asan --without-tcmalloc
  Sanitizer enabled    : asan
  Building with LTO    : yes
$ grep '^GF_CFLAGS' libglusterfs/src/Makefile
  GF_CFLAGS = ... -fsanitize=address -fno-omit-frame-pointer ... -flto

--enable-debug is exempted from LTO on purpose (0ed6489bd2, "configure: disable
LTO when building with debug", #1967). The sanitizer builds are diagnostic builds of
the same kind and were simply never covered: a sanitizer build stays out of LTO only
when --enable-debug happens to be given as well.

Why

The LTO gate keys only on BUILD_DEBUG:

configure.ac: AS_IF([ test "x$BUILD_DEBUG" = "xno" && test "x$enable_lto" != "xno" ], [ ... -flto ... ])

The sanitizer options set SANITIZER (asan/tsan/ubsan) but never BUILD_DEBUG, so
the gate still enables LTO for them.

Why it matters

A sanitizer build exists to be read, not shipped. LTO adds a whole-program
optimisation pass and a slow link step to a build that is already slow, and one more
variable to a report that should be read literally. Keeping the sanitizer knob and the
LTO knob orthogonal is the decision #1967 already took for --enable-debug.

Fix

Also require SANITIZER = none in the gate (one line; accompanying PR). Verified on
devel 2326b1da07 with gcc 16.2.1: with the fix --enable-asan, --enable-tsan and
--enable-ubsan each report Building with LTO : no, while a plain ./configure is
unchanged (Building with LTO : yes).

Activity

  1. added a commit that references this issue on Oct 20, 2026
    dedbd9c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions