Skip to content

Commit

Permalink
configure: Add separate --enable-lto knob
Browse files Browse the repository at this point in the history
  • Loading branch information
tavianator committed Feb 13, 2025
1 parent 000d4a2 commit 03f2e4d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion build/flags.mk
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ _GCOV := ${TRUTHY,${GCOV}}
_LINT := ${TRUTHY,${LINT}}
_RELEASE := ${TRUTHY,${RELEASE}}

LTO ?= ${RELEASE}
_LTO := ${TRUTHY,${LTO}}

ASAN_CFLAGS,y := -fsanitize=address
LSAN_CFLAGS,y := -fsanitize=leak
MSAN_CFLAGS,y := -fsanitize=memory -fsanitize-memory-track-origins
Expand Down Expand Up @@ -62,11 +65,14 @@ _CPPFLAGS += ${LINT_CPPFLAGS,${_LINT}}
_CFLAGS += ${LINT_CFLAGS,${_LINT}}

RELEASE_CPPFLAGS,y := -DNDEBUG
RELEASE_CFLAGS,y := -O3 -flto=auto
RELEASE_CFLAGS,y := -O3

_CPPFLAGS += ${RELEASE_CPPFLAGS,${_RELEASE}}
_CFLAGS += ${RELEASE_CFLAGS,${_RELEASE}}

LTO_CFLAGS,y := -flto=auto
_CFLAGS += ${LTO_CFLAGS,${_LTO}}

# Configurable flags
CFLAGS ?= -g -Wall

Expand Down
4 changes: 2 additions & 2 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ for arg; do

--enable-*|--disable-*)
case "$name" in
release|asan|lsan|msan|tsan|ubsan|lint|gcov)
release|lto|asan|lsan|msan|tsan|ubsan|lint|gcov)
set -- "$@" "$NAME=$yn"
;;
*)
Expand Down Expand Up @@ -197,7 +197,7 @@ for arg; do
;;

# Warn about MAKE variables that have documented configure flags
RELEASE=*|ASAN=*|LSAN=*|MSAN=*|TSAN=*|UBSAN=*|LINT=*|GCOV=*)
RELEASE=*|LTO=*|ASAN=*|LSAN=*|MSAN=*|TSAN=*|UBSAN=*|LINT=*|GCOV=*)
name=$(printf '%s' "$NAME" | tr 'A-Z_' 'a-z-')
warn '"%s" is deprecated; use --enable-%s' "$arg" "$name"
set -- "$@" "$arg"
Expand Down

0 comments on commit 03f2e4d

Please sign in to comment.