8000 Disable LTO if -fno-lto is in *FLAGS environment. · matplotlib/matplotlib@7523485 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7523485

Browse files
committed
Disable LTO if -fno-lto is in *FLAGS environment.
1 parent d45dcef commit 7523485

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

setup.py

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,21 +105,40 @@ def add_optimization_flags(self):
105105
"""
106106

107107
env = os.environ.copy()
108-
if not setupext.config.getboolean('libs', 'enable_lto', fallback=True):
109-
return env
110108
if sys.platform == 'win32':
111109
return env
112-
110+
enable_lto = setupext.config.getboolean('libs', 'enable_lto',
111+
fallback=None)
112+
113+
if 'CFLAGS' in os.environ:
114+
if '-fno-lto' in os.environ['CFLAGS']:
115+
if enable_lto is True:
116+
raise ValueError('Configuration enable_lto=True, but '
117+
'CFLAGS contains -fno-lto')
118+
enable_lto = False
113119
cppflags = []
114120
if 'CPPFLAGS' in os.environ:
115121
cppflags.append(os.environ['CPPFLAGS'])
122+
if '-fno-lto' in os.environ['CPPFLAGS']:
123+
if enable_lto is True:
124+
raise ValueError('Configuration enable_lto=True, but '
125+
'CPPFLAGS contains -fno-lto')
126+
enable_lto = False
116127
cxxflags = []
117128
if 'CXXFLAGS' in os.environ:
118129
cxxflags.append(os.environ['CXXFLAGS'])
130+
if '-fno-lto' in os.environ['CXXFLAGS']:
131+
if enable_lto is True:
132+
raise ValueError('Configuration enable_lto=True, but '
133+
'CXXFLAGS contains -fno-lto')
134+
enable_lto = False
119135
ldflags = []
120136
if 'LDFLAGS' in os.environ:
121137
ldflags.append(os.environ['LDFLAGS'])
122138

139+
if enable_lto is False:
140+
return env
141+
123142
if has_flag(self.compiler, '-fvisibility=hidden'):
124143
for ext in self.extensions:
125144
ext.extra_compile_args.append('-fvisibility=hidden')

0 commit comments

Comments
 (0)
0