Skip to content

Commit 8f27d44

Browse files
authored
Merge pull request #516 from redis/angelyanev-enable-lto-RED-191923
Enable LTO when build with modules. LTO is set for RediSearch and it is enabled by default.
2 parents 2d55883 + 3641366 commit 8f27d44

4 files changed

Lines changed: 18 additions & 2 deletions

File tree

alpine/Dockerfile

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

alpine/Dockerfile.j2

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ RUN set -eux; \
6565
libgcc \
6666
libtool \
6767
llvm21-dev \
68+
lld21 \
6869
ncurses-dev \
6970
openssh \
7071
openssl \
@@ -126,6 +127,7 @@ RUN set -eux; \
126127
export PATH="/usr/lib/llvm21/bin:$PATH"; \
127128
export BUILD_TLS=yes; \
128129
if [ "$BUILD_WITH_MODULES" = "yes" ]; then \
130+
export LTO=1; \
129131

130132
{%- if custom_build %}
131133

debian/Dockerfile

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

debian/Dockerfile.j2

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ RUN set -eux; \
4949
*) echo >&2 "Modules are NOT supported! unsupported architecture: '$arch'"; export BUILD_WITH_MODULES=no ;; \
5050
esac; \
5151
if [ "$BUILD_WITH_MODULES" = "yes" ]; then \
52+
echo 'deb http://deb.debian.org/debian trixie-backports main' > /etc/apt/sources.list.d/backports.list; \
5253
apt-get update; \
5354
apt-get install -y --no-install-recommends \
5455
git \
@@ -59,13 +60,15 @@ RUN set -eux; \
5960
python3-dev \
6061
unzip \
6162
rsync \
62-
clang \
6363
automake \
6464
autoconf \
6565
libtool \
6666
g++; \
67+
apt-get install -y --no-install-recommends -t trixie-backports clang-21 lld-21 llvm-21; \
68+
export PATH="/usr/lib/llvm-21/bin:$PATH"; \
6769
fi; \
6870
\
71+
rm -f /etc/apt/sources.list.d/backports.list; \
6972
rm -rf /var/lib/apt/lists/*; \
7073
\
7174
wget -O redis.tar.gz "$REDIS_DOWNLOAD_URL"; \
@@ -124,6 +127,9 @@ RUN set -eux; \
124127
grep -F "cd jemalloc && ./configure $extraJemallocConfigureFlags " /usr/src/redis/deps/Makefile; \
125128
\
126129
export BUILD_TLS=yes; \
130+
if [ "$BUILD_WITH_MODULES" = "yes" ]; then \
131+
export LTO=1; \
132+
fi; \
127133
make -C /usr/src/redis -j "$(nproc)" all; \
128134
make -C /usr/src/redis install; \
129135
make -C /usr/src/redis distclean; \

0 commit comments

Comments
 (0)