Skip to content

Commit d86ccb1

Browse files
committed
use thin lto (~2x faster than full lto)
1 parent b5e37d0 commit d86ccb1

4 files changed

Lines changed: 22 additions & 20 deletions

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@
99
/.idea
1010
/dist
1111
craft.yml
12-
.claude/
12+
/.claude/
13+
/.docker-home/

Dockerfile.rhel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ RUN if [[ "${ALMA_VERSION}" == "9" || "${ALMA_VERSION}" == "10" ]]; then \
4343
else \
4444
dnf -y install python39 && \
4545
curl -L https://github.com/skvadrik/re2c/releases/download/4.3/re2c-4.3.tar.xz | tar xJ && \
46-
cd re2c-4.3 && ./configure && make -j2 && make install && cd .. && rm -rf re2c-4.3; \
46+
cd re2c-4.3 && ./configure && make -j"$(nproc)" && make install && cd .. && rm -rf re2c-4.3; \
4747
fi
4848

4949
RUN if [[ "${ALMA_VERSION}" == "8" || "${ALMA_VERSION}" == "9" ]]; then \

composer.lock

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

config/templates/craft.yml.twig

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
{%- set cflags =
1414
'-fPIC -O3 -pipe -fno-plt -fno-semantic-interposition -fstack-clash-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -ffunction-sections -fdata-sections' ~ arch_flags
1515
-%}
16-
{%- set cflags = (using_gcc ? '' : '-flto ') ~ cflags -%}
16+
{%- set cflags = (using_gcc ? '' : '-flto=thin ') ~ cflags -%}
1717
{%- set is_rhel = os in ['7', '8', '9', '10'] and type == 'rpm' -%}
1818
{%- if using_gcc and is_rhel -%}
1919
{%- if os == '7' or os == '8' -%}
@@ -99,10 +99,10 @@ extra-env:
9999
SPC_CMD_VAR_PHP_EMBED_TYPE: 'shared'
100100
SPC_MICRO_PATCHES:
101101
SPC_DEFAULT_C_FLAGS: "{{ cflags }}"
102-
SPC_DEFAULT_CXX_FLAGS: "{{ cflags }} -fasynchronous-unwind-tables{{ using_gcc ? '' : ' -fwhole-program-vtables -fstrict-vtable-pointers -fvirtual-function-elimination' }}"
103-
SPC_DEFAULT_LD_FLAGS: "-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -Wl,-z,noexecstack -Wl,--gc-sections {{ using_gcc and is_rhel ? specs_ldflags : '' }}{{ not using_gcc ? ' -flto' : '' }}"
104-
SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS: "{{ cflags }} -g -fPIE{{ using_gcc ? '' : ' -flto'}}"
105-
SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS: "-Wl,--build-id=sha1 -pie -release {{ release_suffix }}{{ using_gcc ? '' : ' -flto'}}"
102+
SPC_DEFAULT_CXX_FLAGS: "{{ cflags }} -fasynchronous-unwind-tables"
103+
SPC_DEFAULT_LD_FLAGS: "-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -Wl,-z,noexecstack -Wl,--gc-sections {{ using_gcc and is_rhel ? specs_ldflags : '' }}{{ not using_gcc ? ' -flto=thin' : '' }}"
104+
SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS: "{{ cflags }} -g -fPIE{{ using_gcc ? '' : ' -flto=thin'}}"
105+
SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS: "-Wl,--build-id=sha1 -pie -release {{ release_suffix }}{{ using_gcc ? '' : ' -flto=thin'}}"
106106
SPC_CMD_PREFIX_PHP_CONFIGURE: "./configure --prefix= --with-valgrind=no --disable-shared --enable-static --disable-all --disable-cgi --disable-phpdbg --disable-debug --with-pic --enable-rtld-now --enable-re2c-cgoto --disable-rpath"
107107
SPC_CMD_VAR_FRANKENPHP_XCADDY_MODULES: "--with github.com/dunglas/frankenphp/caddy --with github.com/dunglas/mercure/caddy --with github.com/dunglas/vulcain/caddy --with github.com/dunglas/caddy-cbrotli --with github.com/baldinof/caddy-supervisor"
108108
PHP_BUILD_PROVIDER: "Static PHP <https://static-php.dev> #StandWithUkraine"

0 commit comments

Comments
 (0)