binutils@2.38 %gcc: add -fPIC -fcommon -Wl,-z,notext (#30345)

This commit is contained in:
eugeneswalker 2022-05-02 06:38:07 -07:00 committed by GitHub
parent 25206c86c4
commit e691d6df64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -156,23 +156,24 @@ def install_headers(self):
extradir) extradir)
def flag_handler(self, name, flags): def flag_handler(self, name, flags):
spec = self.spec
# Use a separate variable for injecting flags. This way, installing # Use a separate variable for injecting flags. This way, installing
# `binutils cflags='-O2'` will still work as expected. # `binutils cflags='-O2'` will still work as expected.
iflags = [] iflags = []
# To ignore the errors of narrowing conversions for # To ignore the errors of narrowing conversions for
# the Fujitsu compiler # the Fujitsu compiler
if name == 'cxxflags' and ( if name == 'cxxflags' and (
self.spec.satisfies('@:2.31.1') and spec.satisfies('@:2.31.1') and
self.compiler.name in ('fj', 'clang', 'apple-clang') self.compiler.name in ('fj', 'clang', 'apple-clang')
): ):
iflags.append('-Wno-narrowing') iflags.append('-Wno-narrowing')
elif name == 'cflags': elif name == 'cflags':
if self.spec.satisfies('@:2.34 %gcc@10:'): if spec.satisfies('@:2.34 %gcc@10:'):
iflags.append('-fcommon') iflags.append('-fcommon')
if self.spec.satisfies('%cce'): if spec.satisfies('%cce') or spec.satisfies('@2.38 %gcc'):
iflags.append('-fPIC -fcommon') iflags.extend([self.compiler.cc_pic_flag, '-fcommon'])
elif name == 'ldflags': elif name == 'ldflags':
if self.spec.satisfies('%cce'): if spec.satisfies('%cce') or spec.satisfies('@2.38 %gcc'):
iflags.append('-Wl,-z,notext') iflags.append('-Wl,-z,notext')
return (iflags, None, flags) return (iflags, None, flags)