Skip to content

Commit 103e22e

Browse files
authored
enable LTO as default
1 parent 7dd3b9e commit 103e22e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tools/copy-libs.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ LD_SCRIPT_DIRS=""
6565

6666
PIO_CC_FLAGS=""
6767
PIO_C_FLAGS=""
68-
PIO_CXX_FLAGS=""
68+
PIO_CXX_FLAGS="-flto=auto "
6969
PIO_AS_FLAGS=""
70-
PIO_LD_FLAGS=""
70+
PIO_LD_FLAGS="-flto "
7171
PIO_LD_FUNCS=""
7272
PIO_LD_SCRIPTS=""
7373

@@ -121,7 +121,7 @@ str=`printf '%b' "$str"` #unescape the string
121121
set -- $str
122122
for item in "${@:2:${#@}-5}"; do
123123
prefix="${item:0:2}"
124-
if [[ "$prefix" != "-I" && "$prefix" != "-D" && "$item" != "-Wall" && "$item" != "-Werror=all" && "$item" != "-Wextra" && "$prefix" != "-O" ]]; then
124+
if [[ "$prefix" != "-I" && "$prefix" != "-D" && "$item" != "-Wall" && "$item" != "-Werror=all" && "$item" != "-Wextra" && "$item" != "-fno-lto" && "$prefix" != "-O" ]]; then
125125
if [[ "${item:0:23}" != "-mfix-esp32-psram-cache" && "${item:0:18}" != "-fmacro-prefix-map" && "${item:0:20}" != "-fdiagnostics-color=" && "${item:0:19}" != "-fdebug-prefix-map=" ]]; then
126126
AS_FLAGS+="$item "
127127
if [[ $C_FLAGS == *"$item"* ]]; then
@@ -140,7 +140,7 @@ str=`printf '%b' "$str"` #unescape the string
140140
set -- $str
141141
for item in "${@:2:${#@}-5}"; do
142142
prefix="${item:0:2}"
143-
if [[ "$prefix" != "-I" && "$prefix" != "-D" && "$item" != "-Wall" && "$item" != "-Werror=all" && "$item" != "-Wextra" && "$prefix" != "-O" ]]; then
143+
if [[ "$prefix" != "-I" && "$prefix" != "-D" && "$item" != "-Wall" && "$item" != "-Werror=all" && "$item" != "-Wextra" && "$item" != "-fno-lto" && "$prefix" != "-O" ]]; then
144144
if [[ "${item:0:23}" != "-mfix-esp32-psram-cache" && "${item:0:18}" != "-fmacro-prefix-map" && "${item:0:20}" != "-fdiagnostics-color=" && "${item:0:19}" != "-fdebug-prefix-map=" ]]; then
145145
CPP_FLAGS+="$item "
146146
if [[ $PIO_CC_FLAGS != *"$item"* ]]; then
@@ -211,7 +211,7 @@ for item; do
211211
add_next=0
212212
is_script=0
213213
is_dir=0
214-
elif [[ "${item:0:23}" != "-mfix-esp32-psram-cache" && "${item:0:18}" != "-fmacro-prefix-map" && "${item:0:19}" != "-fdebug-prefix-map=" && "${item:0:17}" != "-Wl,--start-group" && "${item:0:15}" != "-Wl,--end-group" ]]; then
214+
elif [[ "${item:0:23}" != "-mfix-esp32-psram-cache" && "${item:0:18}" != "-fmacro-prefix-map" && "${item:0:19}" != "-fdebug-prefix-map=" && "${item:0:8}" != "-fno-lto" && "${item:0:17}" != "-Wl,--start-group" && "${item:0:15}" != "-Wl,--end-group" ]]; then
215215
LD_FLAGS+="$item "
216216
PIO_LD_FLAGS+="$item "
217217
fi

0 commit comments

Comments
 (0)