Skip to content

Commit

Permalink
linkers: Add a representation for the Apple AR Linker
Browse files Browse the repository at this point in the history
Which is old and annoying and doesn't expose global symbols by default,
so we need a work around.

see: #10587
see: https://lists.gnu.org/archive/html/libtool/2002-07/msg00025.html
  • Loading branch information
dcbaker authored and nirbheek committed Aug 8, 2022
1 parent fadf7cc commit ee16f01
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mesonbuild/compilers/detect.py
Expand Up @@ -24,6 +24,7 @@
guess_win_linker,
guess_nix_linker,
AIXArLinker,
AppleArLinker,
ArLinker,
ArmarLinker,
ArmClangDynamicLinker,
Expand Down Expand Up @@ -344,7 +345,7 @@ def detect_static_linker(env: 'Environment', compiler: Compiler) -> StaticLinker
if p.returncode == 0:
return ArLinker(compiler.for_machine, linker)
if p.returncode == 1 and err.startswith('usage'): # OSX
return ArLinker(compiler.for_machine, linker)
return AppleArLinker(compiler.for_machine, linker)
if p.returncode == 1 and err.startswith('Usage'): # AIX
return AIXArLinker(linker)
if p.returncode == 1 and err.startswith('ar: bad option: --'): # Solaris
Expand Down
2 changes: 2 additions & 0 deletions mesonbuild/linkers/__init__.py
Expand Up @@ -24,6 +24,7 @@
VisualStudioLikeLinker,
VisualStudioLinker,
IntelVisualStudioLinker,
AppleArLinker,
ArLinker,
ArmarLinker,
DLinker,
Expand Down Expand Up @@ -93,6 +94,7 @@
'C2000Linker',
'TILinker',
'AIXArLinker',
'AppleArLinker',
'PGIStaticLinker',
'NvidiaHPC_StaticLinker',

Expand Down
7 changes: 7 additions & 0 deletions mesonbuild/linkers/linkers.py
Expand Up @@ -215,6 +215,13 @@ def get_std_link_args(self, env: 'Environment', is_thin: bool) -> T.List[str]:
return self.std_args


class AppleArLinker(ArLinker):

# mostly this is used to determine that we need to call ranlib

id = 'applear'


class ArmarLinker(ArLikeLinker):
id = 'armar'

Expand Down

0 comments on commit ee16f01

Please sign in to comment.