mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-05 14:06:27 -05:00
build: switch to using lld for macOS builds
Adjust the security check for: ld64.lld: warning: Option `-allow_stack_execute' is not yet implemented. ld64.lld: error: -fixup_chains is incompatible with -no_pie and to account for the embedding of LLVMs version number.
This commit is contained in:
parent
c6a6b2d6fd
commit
4a0536c5d9
4 changed files with 12 additions and 17 deletions
|
@ -240,7 +240,7 @@ def check_MACHO_sdk(binary) -> bool:
|
|||
return False
|
||||
|
||||
def check_MACHO_ld64(binary) -> bool:
|
||||
if binary.build_version.tools[0].version == [711, 0, 0]:
|
||||
if binary.build_version.tools[0].version == [17, 0, 6]:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
|
|
@ -120,21 +120,15 @@ class TestSecurityChecks(unittest.TestCase):
|
|||
arch = get_arch(cc, source, executable)
|
||||
|
||||
if arch == lief.ARCHITECTURES.X86:
|
||||
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-no_pie','-Wl,-flat_namespace','-Wl,-allow_stack_execute','-fno-stack-protector', '-Wl,-no_fixup_chains']),
|
||||
(1, executable+': failed NOUNDEFS Canary FIXUP_CHAINS PIE NX CONTROL_FLOW'))
|
||||
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-no_pie','-Wl,-flat_namespace','-Wl,-allow_stack_execute','-fno-stack-protector', '-Wl,-fixup_chains']),
|
||||
(1, executable+': failed NOUNDEFS Canary PIE NX CONTROL_FLOW'))
|
||||
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-no_pie','-Wl,-flat_namespace','-Wl,-allow_stack_execute','-fstack-protector-all', '-Wl,-fixup_chains']),
|
||||
(1, executable+': failed NOUNDEFS PIE NX CONTROL_FLOW'))
|
||||
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-no_pie','-Wl,-flat_namespace','-fstack-protector-all', '-Wl,-fixup_chains']),
|
||||
(1, executable+': failed NOUNDEFS PIE CONTROL_FLOW'))
|
||||
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-no_pie','-fstack-protector-all', '-Wl,-fixup_chains']),
|
||||
(1, executable+': failed PIE CONTROL_FLOW'))
|
||||
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-no_pie','-fstack-protector-all', '-Wl,-fixup_chains']),
|
||||
(1, executable+': failed PIE CONTROL_FLOW'))
|
||||
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-no_pie','-fstack-protector-all', '-fcf-protection=full', '-Wl,-fixup_chains']),
|
||||
(1, executable+': failed PIE'))
|
||||
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-pie','-fstack-protector-all', '-fcf-protection=full', '-Wl,-fixup_chains']),
|
||||
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-no_pie','-Wl,-flat_namespace','-fno-stack-protector', '-Wl,-no_fixup_chains']),
|
||||
(1, executable+': failed NOUNDEFS Canary FIXUP_CHAINS PIE CONTROL_FLOW'))
|
||||
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-flat_namespace','-fno-stack-protector', '-Wl,-fixup_chains']),
|
||||
(1, executable+': failed NOUNDEFS Canary CONTROL_FLOW'))
|
||||
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-flat_namespace','-fstack-protector-all', '-Wl,-fixup_chains']),
|
||||
(1, executable+': failed NOUNDEFS CONTROL_FLOW'))
|
||||
self.assertEqual(call_security_check(cc, source, executable, ['-fstack-protector-all', '-Wl,-fixup_chains']),
|
||||
(1, executable+': failed CONTROL_FLOW'))
|
||||
self.assertEqual(call_security_check(cc, source, executable, ['-fstack-protector-all', '-fcf-protection=full', '-Wl,-fixup_chains']),
|
||||
(0, ''))
|
||||
else:
|
||||
# arm64 darwin doesn't support non-PIE binaries, control flow or executable stacks
|
||||
|
|
|
@ -115,7 +115,7 @@ darwin_LDFLAGS=-Wl,-platform_version,macos,$(OSX_MIN_VERSION),$(OSX_SDK_VERSION)
|
|||
ifneq ($(build_os),darwin)
|
||||
darwin_CFLAGS += -mlinker-version=$(LD64_VERSION)
|
||||
darwin_CXXFLAGS += -mlinker-version=$(LD64_VERSION)
|
||||
darwin_LDFLAGS += -Wl,-no_adhoc_codesign
|
||||
darwin_LDFLAGS += -Wl,-no_adhoc_codesign -fuse-ld=lld
|
||||
endif
|
||||
|
||||
darwin_release_CFLAGS=-O2
|
||||
|
|
|
@ -13,6 +13,7 @@ QMAKE_MAC_SDK.macosx.Path = $${MAC_SDK_PATH}
|
|||
QMAKE_MAC_SDK.macosx.platform_name = macosx
|
||||
QMAKE_MAC_SDK.macosx.SDKVersion = $${MAC_SDK_VERSION}
|
||||
QMAKE_MAC_SDK.macosx.PlatformPath = /phony
|
||||
QMAKE_CXXFLAGS += -fuse-ld=lld
|
||||
!host_build: QMAKE_CFLAGS += -target $${MAC_TARGET}
|
||||
!host_build: QMAKE_OBJECTIVE_CFLAGS += $$QMAKE_CFLAGS
|
||||
!host_build: QMAKE_CXXFLAGS += -target $${MAC_TARGET}
|
||||
|
|
Loading…
Add table
Reference in a new issue