Skip to content

Commit 3210db6

Browse files
committed
Move LTO flag stripping into the Lua module Makefile
Signed-off-by: Hanxi Zhang <hanxizh@amazon.com>
1 parent db7f331 commit 3210db6

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

src/Makefile

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -734,14 +734,9 @@ $(TLS_MODULE_NAME): $(SERVER_NAME)
734734
$(RDMA_MODULE_NAME): $(SERVER_NAME)
735735
$(QUIET_CC)$(CC) $(LDFLAGS) -o $@ rdma.c -shared -fPIC $(RDMA_MODULE_CFLAGS)
736736

737-
# Strip LTO flags from OPTIMIZATION for the static Lua module build.
738-
# When archiving into a .a, LTO bitcode objects cause linker failures
739-
# if the system's LLVM gold plugin version doesn't match clang's version.
740-
LUA_MODULE_OPTIMIZATION=$(subst -flto,,$(subst -ffat-lto-objects,,$(subst -flto=auto,,$(OPTIMIZATION))))
741-
742737
# engine_lua.so
743738
$(LUA_MODULE_NAME): .make-prerequisites
744-
$(MAKE) -C modules/lua OPTIMIZATION="$(LUA_MODULE_OPTIMIZATION)" BUILD_LUA="$(BUILD_LUA)"
739+
$(MAKE) -C modules/lua OPTIMIZATION="$(OPTIMIZATION)" BUILD_LUA="$(BUILD_LUA)"
745740

746741
# valkey-cli
747742
$(ENGINE_CLI_NAME): $(ENGINE_CLI_OBJ)

src/modules/lua/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ ifeq ($(BUILD_LUA),module)
99
else
1010
STATIC_LUA_FLAG=-DSTATIC_LUA=1
1111
LUA_TARGET=libvalkeylua.a
12+
# Strip LTO flags for the static build. When archiving into a .a,
13+
# LTO bitcode objects cause linker failures if the system linker
14+
# cannot read them.
15+
OPTIMIZATION:=$(subst -flto,,$(subst -ffat-lto-objects,,$(subst -flto=auto,,$(OPTIMIZATION))))
1216
endif
1317

1418
ifeq ($(uname_S),Darwin)

0 commit comments

Comments
 (0)