Skip to content

Commit 761e247

Browse files
amysparkjpakkane
authored andcommitted
compilers: Allow prelinking with Apple Clang
1 parent a57c880 commit 761e247

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

Diff for: mesonbuild/compilers/mixins/apple.py

+4
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,7 @@ def openmp_link_flags(self, env: Environment) -> T.List[str]:
5555
if not link:
5656
raise MesonException("Couldn't find libomp")
5757
return self.__BASE_OMP_FLAGS + link
58+
59+
def get_prelink_args(self, prelink_name: str, obj_list: T.List[str]) -> T.List[str]:
60+
# The objects are prelinked through the compiler, which injects -lSystem
61+
return ['-nostdlib', '-r', '-o', prelink_name] + obj_list

Diff for: unittests/linuxliketests.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -1684,9 +1684,7 @@ def test_prelinking(self):
16841684
# Prelinking currently only works on recently new GNU toolchains.
16851685
# Skip everything else. When support for other toolchains is added,
16861686
# remove limitations as necessary.
1687-
if is_osx():
1688-
raise SkipTest('Prelinking not supported on Darwin.')
1689-
if 'clang' in os.environ.get('CC', 'dummy'):
1687+
if 'clang' in os.environ.get('CC', 'dummy') and not is_osx():
16901688
raise SkipTest('Prelinking not supported with Clang.')
16911689
testdir = os.path.join(self.unit_test_dir, '86 prelinking')
16921690
env = get_fake_env(testdir, self.builddir, self.prefix)
@@ -1704,8 +1702,7 @@ def test_prelinking(self):
17041702
stderr=subprocess.DEVNULL,
17051703
encoding='utf-8', text=True, timeout=1)
17061704
obj_files = p.stdout.strip().split('\n')
1707-
self.assertEqual(len(obj_files), 1)
1708-
self.assertTrue(obj_files[0].endswith('-prelink.o'))
1705+
self.assertTrue(any(o.endswith('-prelink.o') for o in obj_files))
17091706

17101707
def do_one_test_with_nativefile(self, testdir, args):
17111708
testdir = os.path.join(self.common_test_dir, testdir)

0 commit comments

Comments
 (0)