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)
def flag_handler(self, name, flags):
spec = self.spec
# Use a separate variable for injecting flags. This way, installing
# `binutils cflags='-O2'` will still work as expected.
iflags = []
# To ignore the errors of narrowing conversions for
# the Fujitsu compiler
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')
):
iflags.append('-Wno-narrowing')
elif name == 'cflags':
if self.spec.satisfies('@:2.34 %gcc@10:'):
if spec.satisfies('@:2.34 %gcc@10:'):
iflags.append('-fcommon')
if self.spec.satisfies('%cce'):
iflags.append('-fPIC -fcommon')
if spec.satisfies('%cce') or spec.satisfies('@2.38 %gcc'):
iflags.extend([self.compiler.cc_pic_flag, '-fcommon'])
elif name == 'ldflags':
if self.spec.satisfies('%cce'):
if spec.satisfies('%cce') or spec.satisfies('@2.38 %gcc'):
iflags.append('-Wl,-z,notext')
return (iflags, None, flags)