aix: detect and support the AIX dynamic linker

pull/7581/head
Peter Harris 5 years ago
parent 45a12d28b9
commit abe72d5c84
  1. 9
      mesonbuild/environment.py
  2. 32
      mesonbuild/linkers.py

@ -61,6 +61,7 @@ from .linkers import (
PGIDynamicLinker,
PGIStaticLinker,
SolarisDynamicLinker,
AIXDynamicLinker,
XilinkDynamicLinker,
CudaLinker,
VisualStudioLikeLinkerMixin,
@ -1092,6 +1093,14 @@ class Environment:
linker = SolarisDynamicLinker(
compiler, for_machine, comp_class.LINKER_PREFIX, override,
version=v)
elif 'ld: 0706-012 The -- flag is not recognized' in e:
if isinstance(comp_class.LINKER_PREFIX, str):
_, _, e = Popen_safe(compiler + [comp_class.LINKER_PREFIX + '-V'] + extra_args)
else:
_, _, e = Popen_safe(compiler + comp_class.LINKER_PREFIX + ['-V'] + extra_args)
linker = AIXDynamicLinker(
compiler, for_machine, comp_class.LINKER_PREFIX, override,
version=search_version(e))
else:
raise EnvironmentException('Unable to determine dynamic linker')
return linker

@ -1141,6 +1141,38 @@ class SolarisDynamicLinker(PosixDynamicLinkerMixin, DynamicLinker):
return self._apply_prefix('-soname,{}{}.{}{}'.format(prefix, shlib_name, suffix, sostr))
class AIXDynamicLinker(PosixDynamicLinkerMixin, DynamicLinker):
"""Sys-V derived linker used on AIX"""
def __init__(self, *args, **kwargs):
super().__init__('ld.aix', *args, **kwargs)
def get_always_args(self) -> T.List[str]:
return self._apply_prefix(['-bsvr4', '-bnoipath', '-bbigtoc']) + super().get_always_args()
def no_undefined_args(self) -> T.List[str]:
return self._apply_prefix(['-z', 'defs'])
def get_allow_undefined_args(self) -> T.List[str]:
return self._apply_prefix(['-z', 'nodefs'])
def build_rpath_args(self, env: 'Environment', build_dir: str, from_dir: str,
rpath_paths: str, build_rpath: str,
install_rpath: str) -> T.Tuple[T.List[str], T.Set[bytes]]:
all_paths = mesonlib.OrderedSet(['/opt/freeware/lib']) # for libgcc_s.a
for p in rpath_paths:
all_paths.add(os.path.join(build_dir, p))
if build_rpath != '':
all_paths.add(build_rpath)
if install_rpath != '':
all_paths.add(install_rpath)
return (self._apply_prefix([x for p in all_paths for x in ('-R', p)]), set())
def thread_flags(self, env: 'Environment') -> T.List[str]:
return ['-pthread']
class OptlinkDynamicLinker(VisualStudioLikeLinkerMixin, DynamicLinker):
"""Digital Mars dynamic linker for windows."""

Loading…
Cancel
Save