compilers: Allow prelinking with Apple Clang

pull/13603/head
L. E. Segovia 8 months ago committed by Jussi Pakkanen
parent a57c880368
commit 761e2470d4
  1. 4
      mesonbuild/compilers/mixins/apple.py
  2. 7
      unittests/linuxliketests.py

@ -55,3 +55,7 @@ class AppleCompilerMixin(Compiler):
if not link: if not link:
raise MesonException("Couldn't find libomp") raise MesonException("Couldn't find libomp")
return self.__BASE_OMP_FLAGS + link return self.__BASE_OMP_FLAGS + link
def get_prelink_args(self, prelink_name: str, obj_list: T.List[str]) -> T.List[str]:
# The objects are prelinked through the compiler, which injects -lSystem
return ['-nostdlib', '-r', '-o', prelink_name] + obj_list

@ -1684,9 +1684,7 @@ class LinuxlikeTests(BasePlatformTests):
# Prelinking currently only works on recently new GNU toolchains. # Prelinking currently only works on recently new GNU toolchains.
# Skip everything else. When support for other toolchains is added, # Skip everything else. When support for other toolchains is added,
# remove limitations as necessary. # remove limitations as necessary.
if is_osx(): if 'clang' in os.environ.get('CC', 'dummy') and not is_osx():
raise SkipTest('Prelinking not supported on Darwin.')
if 'clang' in os.environ.get('CC', 'dummy'):
raise SkipTest('Prelinking not supported with Clang.') raise SkipTest('Prelinking not supported with Clang.')
testdir = os.path.join(self.unit_test_dir, '86 prelinking') testdir = os.path.join(self.unit_test_dir, '86 prelinking')
env = get_fake_env(testdir, self.builddir, self.prefix) env = get_fake_env(testdir, self.builddir, self.prefix)
@ -1704,8 +1702,7 @@ class LinuxlikeTests(BasePlatformTests):
stderr=subprocess.DEVNULL, stderr=subprocess.DEVNULL,
encoding='utf-8', text=True, timeout=1) encoding='utf-8', text=True, timeout=1)
obj_files = p.stdout.strip().split('\n') obj_files = p.stdout.strip().split('\n')
self.assertEqual(len(obj_files), 1) self.assertTrue(any(o.endswith('-prelink.o') for o in obj_files))
self.assertTrue(obj_files[0].endswith('-prelink.o'))
def do_one_test_with_nativefile(self, testdir, args): def do_one_test_with_nativefile(self, testdir, args):
testdir = os.path.join(self.common_test_dir, testdir) testdir = os.path.join(self.common_test_dir, testdir)

Loading…
Cancel
Save