From 4faa8d0238777055ec49e002c3f0300f4d014c38 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Mon, 11 Mar 2019 20:08:14 -0400 Subject: [PATCH] cctools: add patch for apfs --- pkgs/os-specific/darwin/cctools/apfs.patch | 22 ++++++++++++++++++++++ pkgs/os-specific/darwin/cctools/port.nix | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 pkgs/os-specific/darwin/cctools/apfs.patch diff --git a/pkgs/os-specific/darwin/cctools/apfs.patch b/pkgs/os-specific/darwin/cctools/apfs.patch new file mode 100644 index 00000000000..8c6b3c0d273 --- /dev/null +++ b/pkgs/os-specific/darwin/cctools/apfs.patch @@ -0,0 +1,22 @@ +diff --git a/cctools/ld64/src/ld/OutputFile.cpp b/cctools/ld64/src/ld/OutputFile.cpp +index 8859882..158c7d2 100644 +--- a/cctools/ld64/src/ld/OutputFile.cpp ++++ b/cctools/ld64/src/ld/OutputFile.cpp +@@ -2786,7 +2786,7 @@ void OutputFile::writeOutputFile(ld::Internal& state) + #ifdef __APPLE__ // ld64-port + struct statfs fsInfo; + if ( statfs(_options.outputFilePath(), &fsInfo) != -1 ) { +- if ( strcmp(fsInfo.f_fstypename, "hfs") == 0) { ++ if ( (strcmp(fsInfo.f_fstypename, "hfs") == 0) || (strcmp(fsInfo.f_fstypename, "apfs") == 0) ) { + (void)unlink(_options.outputFilePath()); + outputIsMappableFile = true; + } +@@ -2814,7 +2814,7 @@ void OutputFile::writeOutputFile(ld::Internal& state) + #ifdef __APPLE__ // ld64-port + struct statfs fsInfo; + if ( statfs(dirPath, &fsInfo) != -1 ) { +- if ( strcmp(fsInfo.f_fstypename, "hfs") == 0) { ++ if ( (strcmp(fsInfo.f_fstypename, "hfs") == 0) || (strcmp(fsInfo.f_fstypename, "apfs") == 0) ) { + outputIsMappableFile = true; + } + } diff --git a/pkgs/os-specific/darwin/cctools/port.nix b/pkgs/os-specific/darwin/cctools/port.nix index fcab00163a6..43a9495c3ab 100644 --- a/pkgs/os-specific/darwin/cctools/port.nix +++ b/pkgs/os-specific/darwin/cctools/port.nix @@ -35,7 +35,7 @@ let ++ stdenv.lib.optionals stdenv.isDarwin [ libcxxabi libobjc ] ++ stdenv.lib.optional enableTapiSupport libtapi; - patches = [ ./ld-rpath-nonfinal.patch ./ld-ignore-rpath-link.patch ]; + patches = [ ./ld-rpath-nonfinal.patch ./ld-ignore-rpath-link.patch ./apfs.patch ]; __propagatedImpureHostDeps = [ # As far as I can tell, otool from cctools is the only thing that depends on these two, and we should fix them