Skip to content

Commit 3e3a7da

Browse files
authored
pythongh-90108: Disable LTO on _freeze_module and _testembed (python#109581)
LTO optimization is nice to make Python faster, but _freeze_module and _testembed performance is not important. Using LTO to build these two programs make a whole Python build way slower, especially combined with a sanitizer (like ASAN).
1 parent 5a740cd commit 3e3a7da

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Makefile.pre.in

+2-2
Original file line numberDiff line numberDiff line change
@@ -1062,7 +1062,7 @@ regen-re: $(BUILDPYTHON)
10621062
$(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/build/generate_re_casefix.py $(srcdir)/Lib/re/_casefix.py
10631063

10641064
Programs/_testembed: Programs/_testembed.o $(LINK_PYTHON_DEPS)
1065-
$(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/_testembed.o $(LINK_PYTHON_OBJS) $(LIBS) $(MODLIBS) $(SYSLIBS)
1065+
$(LINKCC) $(PY_LDFLAGS_NOLTO) $(LINKFORSHARED) -o $@ Programs/_testembed.o $(LINK_PYTHON_OBJS) $(LIBS) $(MODLIBS) $(SYSLIBS)
10661066

10671067
############################################################################
10681068
# "Bootstrap Python" used to run deepfreeze.py
@@ -1163,7 +1163,7 @@ Programs/_freeze_module.o: Programs/_freeze_module.c Makefile
11631163
Modules/getpath_noop.o: $(srcdir)/Modules/getpath_noop.c Makefile
11641164

11651165
Programs/_freeze_module: Programs/_freeze_module.o Modules/getpath_noop.o $(LIBRARY_OBJS_OMIT_FROZEN)
1166-
$(LINKCC) $(PY_CORE_LDFLAGS) -o $@ Programs/_freeze_module.o Modules/getpath_noop.o $(LIBRARY_OBJS_OMIT_FROZEN) $(LIBS) $(MODLIBS) $(SYSLIBS)
1166+
$(LINKCC) $(PY_LDFLAGS_NOLTO) -o $@ Programs/_freeze_module.o Modules/getpath_noop.o $(LIBRARY_OBJS_OMIT_FROZEN) $(LIBS) $(MODLIBS) $(SYSLIBS)
11671167

11681168
# We manually freeze getpath.py rather than through freeze_modules
11691169
Python/frozen_modules/getpath.h: Modules/getpath.py $(FREEZE_MODULE_BOOTSTRAP_DEPS)

0 commit comments

Comments
 (0)