3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #195013 from rrbutani/fix/lldb-x86-darwin-llvm-13-and-14

This commit is contained in:
Bernardo Meurer 2022-10-10 11:44:46 -03:00 committed by GitHub
commit 95120325a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 57 additions and 4 deletions

View file

@ -0,0 +1,12 @@
diff --git a/source/Host/macosx/objcxx/HostInfoMacOSX.mm b/source/Host/macosx/objcxx/HostInfoMacOSX.mm
--- a/source/Host/macosx/objcxx/HostInfoMacOSX.mm
+++ b/source/Host/macosx/objcxx/HostInfoMacOSX.mm
@@ -233,7 +233,7 @@ void HostInfoMacOSX::ComputeHostArchitectureSupport(ArchSpec &arch_32,
len = sizeof(is_64_bit_capable);
::sysctlbyname("hw.cpu64bit_capable", &is_64_bit_capable, &len, NULL, 0);
- if (cputype == CPU_TYPE_ARM64 && cpusubtype == CPU_SUBTYPE_ARM64E) {
+ if (cputype == CPU_TYPE_ARM64 && cpusubtype == ((cpu_subtype_t) 2)) { // CPU_SUBTYPE_ARM64E is not available in the macOS 10.12 headers
// The arm64e architecture is a preview. Pretend the host architecture
// is arm64.
cpusubtype = CPU_SUBTYPE_ARM64_ALL;

View file

@ -20,6 +20,7 @@
, Cocoa
, lit
, makeWrapper
, darwin
, enableManpages ? false
}:
@ -38,7 +39,22 @@ stdenv.mkDerivation (rec {
substitute '${./resource-dir.patch}' "$out" --subst-var clangLibDir
'')
./gnu-install-dirs.patch
];
]
# This is a stopgap solution if/until the macOS SDK used for x86_64 is
# updated.
#
# The older 10.12 SDK used on x86_64 as of this writing has a `mach/machine.h`
# header that does not define `CPU_SUBTYPE_ARM64E` so we replace the one use
# of this preprocessor symbol in `lldb` with its expansion.
#
# See here for some context:
# https://github.com/NixOS/nixpkgs/pull/194634#issuecomment-1272129132
++ lib.optional (
stdenv.targetPlatform.isDarwin
&& !stdenv.targetPlatform.isAarch64
&& (lib.versionOlder darwin.apple_sdk.sdk.version "11.0")
) ./cpu_subtype_arm64e_replacement.patch;
outputs = [ "out" "lib" "dev" ];
@ -102,7 +118,6 @@ stdenv.mkDerivation (rec {
'';
meta = llvm_meta // {
broken = stdenv.isDarwin;
homepage = "https://lldb.llvm.org/";
description = "A next-generation high-performance debugger";
longDescription = ''

View file

@ -0,0 +1,12 @@
diff --git a/source/Host/macosx/objcxx/HostInfoMacOSX.mm b/source/Host/macosx/objcxx/HostInfoMacOSX.mm
--- a/source/Host/macosx/objcxx/HostInfoMacOSX.mm
+++ b/source/Host/macosx/objcxx/HostInfoMacOSX.mm
@@ -233,7 +233,7 @@ void HostInfoMacOSX::ComputeHostArchitectureSupport(ArchSpec &arch_32,
len = sizeof(is_64_bit_capable);
::sysctlbyname("hw.cpu64bit_capable", &is_64_bit_capable, &len, NULL, 0);
- if (cputype == CPU_TYPE_ARM64 && cpusubtype == CPU_SUBTYPE_ARM64E) {
+ if (cputype == CPU_TYPE_ARM64 && cpusubtype == ((cpu_subtype_t) 2)) { // CPU_SUBTYPE_ARM64E is not available in the macOS 10.12 headers
// The arm64e architecture is a preview. Pretend the host architecture
// is arm64.
cpusubtype = CPU_SUBTYPE_ARM64_ALL;

View file

@ -20,6 +20,7 @@
, Cocoa
, lit
, makeWrapper
, darwin
, enableManpages ? false
, lua5_3
}:
@ -44,7 +45,21 @@ stdenv.mkDerivation (rec {
substitute '${./resource-dir.patch}' "$out" --subst-var clangLibDir
'')
./gnu-install-dirs.patch
];
]
# This is a stopgap solution if/until the macOS SDK used for x86_64 is
# updated.
#
# The older 10.12 SDK used on x86_64 as of this writing has a `mach/machine.h`
# header that does not define `CPU_SUBTYPE_ARM64E` so we replace the one use
# of this preprocessor symbol in `lldb` with its expansion.
#
# See here for some context:
# https://github.com/NixOS/nixpkgs/pull/194634#issuecomment-1272129132
++ lib.optional (
stdenv.targetPlatform.isDarwin
&& !stdenv.targetPlatform.isAarch64
&& (lib.versionOlder darwin.apple_sdk.sdk.version "11.0")
) ./cpu_subtype_arm64e_replacement.patch;
outputs = [ "out" "lib" "dev" ];
@ -116,7 +131,6 @@ stdenv.mkDerivation (rec {
larger LLVM Project, such as the Clang expression parser and LLVM
disassembler.
'';
broken = stdenv.isDarwin; # error: use of undeclared identifier 'CPU_SUBTYPE_ARM64E'
};
} // lib.optionalAttrs enableManpages {
pname = "lldb-manpages";