aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2022-09-02 13:36:32 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2022-09-02 13:36:53 +0530
commit0e0dbf7e35f1e368090682bfd4818589d3c64d6e (patch)
tree0be0f67db2bf441b61043a2086fd7f31c47085e2
parent9498255cb255c0748490e3c208bd4021adbe706d (diff)
downloadmeson-0e0dbf7e35f1e368090682bfd4818589d3c64d6e.zip
meson-0e0dbf7e35f1e368090682bfd4818589d3c64d6e.tar.gz
meson-0e0dbf7e35f1e368090682bfd4818589d3c64d6e.tar.bz2
Revert PR "call ranlib -c after static linking on macos"
As per https://github.com/mesonbuild/meson/pull/10628#issuecomment-1230560772 the real fix will be in 0.64. This reverts commits: Revert "linkers: Add a representation for the Apple AR Linker" ee16f01b6abc06c474ab8a91e19fa75e1253e132. Revert "backends/ninja: run `ranlib -c $out` when using the apple ar" 77e589c4937cd77def8420f69756662d8b43cdba. Revert "tests: Test extern'd globals on MacOS with the Apple Archiver" bcb382b6403117513b0d7e77f01debb89fd54a45.
-rw-r--r--mesonbuild/backend/ninjabackend.py15
-rw-r--r--mesonbuild/compilers/detect.py3
-rw-r--r--mesonbuild/linkers/__init__.py2
-rw-r--r--mesonbuild/linkers/linkers.py7
-rw-r--r--test cases/osx/9 global variable ar/libfile.c9
-rw-r--r--test cases/osx/9 global variable ar/libfile2.c7
-rw-r--r--test cases/osx/9 global variable ar/meson.build6
-rw-r--r--test cases/osx/9 global variable ar/nativefile.ini2
-rw-r--r--test cases/osx/9 global variable ar/prog.c7
9 files changed, 3 insertions, 55 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index b294160..27ff0ad 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -42,7 +42,7 @@ from ..compilers import (
PGICCompiler,
VisualStudioLikeCompiler,
)
-from ..linkers import ArLinker, AppleArLinker, RSPFileSyntax
+from ..linkers import ArLinker, RSPFileSyntax
from ..mesonlib import (
File, LibType, MachineChoice, MesonException, OrderedSet, PerMachine,
ProgressBar, quote_arg
@@ -2028,7 +2028,7 @@ class NinjaBackend(backends.Backend):
if static_linker is None:
continue
rule = 'STATIC_LINKER{}'.format(self.get_rule_suffix(for_machine))
- cmdlist: T.List[T.Union[str, NinjaCommandArg]] = []
+ cmdlist = []
args = ['$in']
# FIXME: Must normalize file names with pathlib.Path before writing
# them out to fix this properly on Windows. See:
@@ -2042,17 +2042,6 @@ class NinjaBackend(backends.Backend):
cmdlist += static_linker.get_exelist()
cmdlist += ['$LINK_ARGS']
cmdlist += NinjaCommandArg.list(static_linker.get_output_args('$out'), Quoting.none)
- # The default ar on MacOS (at least through version 12), does not
- # add extern'd variables to the symbol table by default, and
- # requires that apple's ranlib be called with a special flag
- # instead after linking
- if isinstance(static_linker, AppleArLinker):
- # This is a bit of a hack, but we assume that that we won't need
- # an rspfile on MacOS, otherwise the arguments are passed to
- # ranlib, not to ar
- cmdlist.extend(args)
- args = []
- cmdlist.extend(['&&', 'ranlib', '-c', '$out'])
description = 'Linking static target $out'
if num_pools > 0:
pool = 'pool = link_pool'
diff --git a/mesonbuild/compilers/detect.py b/mesonbuild/compilers/detect.py
index 0db70d4..f4afa77 100644
--- a/mesonbuild/compilers/detect.py
+++ b/mesonbuild/compilers/detect.py
@@ -24,7 +24,6 @@ from ..linkers import (
guess_win_linker,
guess_nix_linker,
AIXArLinker,
- AppleArLinker,
ArLinker,
ArmarLinker,
ArmClangDynamicLinker,
@@ -345,7 +344,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 AppleArLinker(compiler.for_machine, linker)
+ return ArLinker(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
diff --git a/mesonbuild/linkers/__init__.py b/mesonbuild/linkers/__init__.py
index 23fc82b..3cc3fc4 100644
--- a/mesonbuild/linkers/__init__.py
+++ b/mesonbuild/linkers/__init__.py
@@ -24,7 +24,6 @@ from .linkers import (
VisualStudioLikeLinker,
VisualStudioLinker,
IntelVisualStudioLinker,
- AppleArLinker,
ArLinker,
ArmarLinker,
DLinker,
@@ -94,7 +93,6 @@ __all__ = [
'C2000Linker',
'TILinker',
'AIXArLinker',
- 'AppleArLinker',
'PGIStaticLinker',
'NvidiaHPC_StaticLinker',
diff --git a/mesonbuild/linkers/linkers.py b/mesonbuild/linkers/linkers.py
index e262eca..589e816 100644
--- a/mesonbuild/linkers/linkers.py
+++ b/mesonbuild/linkers/linkers.py
@@ -215,13 +215,6 @@ class ArLinker(ArLikeLinker):
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'
diff --git a/test cases/osx/9 global variable ar/libfile.c b/test cases/osx/9 global variable ar/libfile.c
deleted file mode 100644
index b258d7b..0000000
--- a/test cases/osx/9 global variable ar/libfile.c
+++ /dev/null
@@ -1,9 +0,0 @@
-// Source: https://lists.gnu.org/archive/html/libtool/2002-07/msg00025.html
-
-#include <stdio.h>
-
-extern int l2;
-void l1(void)
-{
- printf("l1 %d\n", l2);
-}
diff --git a/test cases/osx/9 global variable ar/libfile2.c b/test cases/osx/9 global variable ar/libfile2.c
deleted file mode 100644
index 1499c4d..0000000
--- a/test cases/osx/9 global variable ar/libfile2.c
+++ /dev/null
@@ -1,7 +0,0 @@
-// Source: https://lists.gnu.org/archive/html/libtool/2002-07/msg00025.html
-
-int l2;
-void l2_func(void)
-{
- l2 = 77;
-}
diff --git a/test cases/osx/9 global variable ar/meson.build b/test cases/osx/9 global variable ar/meson.build
deleted file mode 100644
index 313dd1b..0000000
--- a/test cases/osx/9 global variable ar/meson.build
+++ /dev/null
@@ -1,6 +0,0 @@
-# Source: https://lists.gnu.org/archive/html/libtool/2002-07/msg00025.html
-
-project('global variable test', 'c')
-
-lib = static_library('mylib', 'libfile.c', 'libfile2.c')
-test('global variable', executable('prog', 'prog.c', link_with: lib))
diff --git a/test cases/osx/9 global variable ar/nativefile.ini b/test cases/osx/9 global variable ar/nativefile.ini
deleted file mode 100644
index 4fb5e7f..0000000
--- a/test cases/osx/9 global variable ar/nativefile.ini
+++ /dev/null
@@ -1,2 +0,0 @@
-[binaries]
-ar = 'ar'
diff --git a/test cases/osx/9 global variable ar/prog.c b/test cases/osx/9 global variable ar/prog.c
deleted file mode 100644
index 4665016..0000000
--- a/test cases/osx/9 global variable ar/prog.c
+++ /dev/null
@@ -1,7 +0,0 @@
-// Source: https://lists.gnu.org/archive/html/libtool/2002-07/msg00025.html
-
-extern void l1(void);
-int main(void)
-{
- l1();
-}