SolarisDynamicLinker: Check if linker supports -z type=pie
As suggested by dcbaker in
@@ -1100,7 +1100,13 @@ class SolarisDynamicLinker(PosixDynamicLinkerMixin, DynamicLinker):
def get_pie_args(self) -> T.List[str]:
# Available in Solaris 11.2 and later
+ pc, stdo, stde = mesonlib.Popen_safe(self.exelist + self._apply_prefix('-zhelp'))
+ for line in (stdo + stde).split('\n'):
+ if '-z type' in line:
+ if 'pie' in line:
return ['-z', 'type=pie']
+ break
+ return []
def get_asneeded_args(self) -> T.List[str]:
return self._apply_prefix(['-z', 'ignore'])
