Skip to content

Commit

Permalink
linkers: skip -export_dynamic flag before MacOS 10.7
Browse files Browse the repository at this point in the history
The flag was only introduced in ld 224.1, as mentioned in the initial PR
#13291.

Resolves #13543

(cherry picked from commit 7280639)
  • Loading branch information
wolfgangwalther authored and eli-schwartz committed Sep 16, 2024
1 parent 4da5bc9 commit 1a529a2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion mesonbuild/linkers/linkers.py
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,9 @@ def get_thinlto_cache_args(self, path: str) -> T.List[str]:
return ["-Wl,-cache_path_lto," + path]

def export_dynamic_args(self, env: 'Environment') -> T.List[str]:
return self._apply_prefix('-export_dynamic')
if mesonlib.version_compare(self.version, '>=224.1'):
return self._apply_prefix('-export_dynamic')
return []


class LLVMLD64DynamicLinker(AppleDynamicLinker):
Expand Down
4 changes: 3 additions & 1 deletion unittests/darwintests.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
import subprocess
import re
import os
import platform
import unittest

from mesonbuild.mesonlib import (
MachineChoice, is_osx
MachineChoice, is_osx, version_compare
)
from mesonbuild.compilers import (
detect_c_compiler
Expand Down Expand Up @@ -81,6 +82,7 @@ def test_apple_bitcode_modules(self):
self.build()
self.run_tests()

@unittest.skipIf(version_compare(platform.mac_ver()[0], '<10.7'), '-export_dynamic was added in 10.7')
def test_apple_lto_export_dynamic(self):
'''
Tests that -Wl,-export_dynamic is correctly added, when export_dynamic: true is set.
Expand Down

0 comments on commit 1a529a2

Please sign in to comment.