Skip to content

Commit

Permalink
rebase patches
Browse files Browse the repository at this point in the history
  • Loading branch information
h-vetinari committed Feb 1, 2024
1 parent 3cdf57a commit ba54ee0
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 85 deletions.
2 changes: 0 additions & 2 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ source:
- patches/0003-Restore-using-__builtin_available-for-macos.patch
# Taken from https://github.com/tpoechtrager/cctools-port/pull/118
- patches/0004-Turn-off-outputIsMappableFile-when-building-to-osx-a.patch
# Taken from https://github.com/tpoechtrager/cctools-port/pull/133
- patches/0005-don-t-try-to-include-__assert-for-NDEBUG-builds.patch

build:
number: 0
Expand Down
11 changes: 4 additions & 7 deletions recipe/patches/0001-Don-t-link-with-libc-abi.patch
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
From 24e7cf07daaed3a5fb4be60486d31660ee8dcf7c Mon Sep 17 00:00:00 2001
From 7247cc4028d1ac4b371eaf471eb0d687e1529290 Mon Sep 17 00:00:00 2001
From: Isuru Fernando <isuruf@gmail.com>
Date: Tue, 26 Nov 2019 03:13:34 -0600
Subject: [PATCH 1/5] Don't link with libc++abi
Subject: [PATCH 1/4] Don't link with libc++abi

---
cctools/configure.ac | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/cctools/configure.ac b/cctools/configure.ac
index 2cf4b8a..8b429d1 100644
index ad18301..bea7958 100644
--- a/cctools/configure.ac
+++ b/cctools/configure.ac
@@ -264,12 +264,10 @@ AC_CHECK_FUNC([write64],[AC_DEFINE(HAVE_WRITE64, 1)])
@@ -255,12 +255,10 @@ AC_CHECK_FUNC([write64],[AC_DEFINE(HAVE_WRITE64, 1)])

### Check for __cxa_demangle in various C++ ABI libs ###

Expand All @@ -25,6 +25,3 @@ index 2cf4b8a..8b429d1 100644
])

AC_SUBST(CXXABI_LIB)
--
2.38.1.windows.1

Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
From 319ada49d0fa9a1af360fc59c6bd9f91a5a0cd0d Mon Sep 17 00:00:00 2001
From 3a7ebebe7e6a82cce5c58ad7816e175d67791a56 Mon Sep 17 00:00:00 2001
From: Isuru Fernando <isuruf@gmail.com>
Date: Mon, 16 Sep 2019 05:17:30 +0000
Subject: [PATCH 2/5] ld64: add conda specific env vars to modify lib search
Subject: [PATCH 2/4] ld64: add conda specific env vars to modify lib search
paths

---
cctools/ld64/src/ld/Options.cpp | 35 ++++++++++++++++++++++++++++-----
1 file changed, 30 insertions(+), 5 deletions(-)

diff --git a/cctools/ld64/src/ld/Options.cpp b/cctools/ld64/src/ld/Options.cpp
index 3bb8324..c0c0e05 100644
index 00500fa..c377e42 100644
--- a/cctools/ld64/src/ld/Options.cpp
+++ b/cctools/ld64/src/ld/Options.cpp
@@ -4237,12 +4237,28 @@ bool Options::shouldUseBuildVersion(ld::Platform plat, uint32_t minOSvers) const
@@ -4372,12 +4372,28 @@ bool Options::shouldUseBuildVersion(ld::Platform plat, uint32_t minOSvers) const

void Options::buildSearchPaths(int argc, const char* argv[])
{
Expand Down Expand Up @@ -42,7 +42,7 @@ index 3bb8324..c0c0e05 100644
// scan through argv looking for -L, -F, -Z, and -syslibroot options
for(int i=0; i < argc; ++i) {
if ( (argv[i][0] == '-') && (argv[i][1] == 'L') ) {
@@ -4274,7 +4290,7 @@ void Options::buildSearchPaths(int argc, const char* argv[])
@@ -4409,7 +4425,7 @@ void Options::buildSearchPaths(int argc, const char* argv[])
frameworkPaths.push_back(frameworkSearchDir);
}
else if ( strcmp(argv[i], "-Z") == 0 )
Expand All @@ -51,8 +51,8 @@ index 3bb8324..c0c0e05 100644
else if ( strcmp(argv[i], "-v") == 0 ) {
fVerbose = true;
extern const char ldVersionString[];
@@ -4383,6 +4399,10 @@ void Options::buildSearchPaths(int argc, const char* argv[])
++i;
@@ -4522,6 +4538,10 @@ void Options::buildSearchPaths(int argc, const char* argv[])
platform = info->platform;
}
}
+
Expand All @@ -62,7 +62,7 @@ index 3bb8324..c0c0e05 100644
int standardLibraryPathsStartIndex = libraryPaths.size();
int standardFrameworkPathsStartIndex = frameworkPaths.size();
if ( addStandardLibraryDirectories ) {
@@ -4392,8 +4412,12 @@ void Options::buildSearchPaths(int argc, const char* argv[])
@@ -4531,8 +4551,12 @@ void Options::buildSearchPaths(int argc, const char* argv[])
frameworkPaths.push_back("/System/DriverKit/System/Library/Frameworks/");
}
else {
Expand All @@ -76,7 +76,7 @@ index 3bb8324..c0c0e05 100644

frameworkPaths.push_back("/Library/Frameworks/");
frameworkPaths.push_back("/System/Library/Frameworks/");
@@ -4409,7 +4433,8 @@ void Options::buildSearchPaths(int argc, const char* argv[])
@@ -4548,7 +4572,8 @@ void Options::buildSearchPaths(int argc, const char* argv[])
}

// now merge sdk and library paths to make real search paths
Expand All @@ -86,7 +86,7 @@ index 3bb8324..c0c0e05 100644
int libIndex = 0;
for (std::vector<const char*>::iterator it = libraryPaths.begin(); it != libraryPaths.end(); ++it, ++libIndex) {
const char* libDir = *it;
@@ -4454,7 +4479,7 @@ void Options::buildSearchPaths(int argc, const char* argv[])
@@ -4593,7 +4618,7 @@ void Options::buildSearchPaths(int argc, const char* argv[])
else
fLibrarySearchPaths.push_back(libDir);
}
Expand All @@ -95,6 +95,3 @@ index 3bb8324..c0c0e05 100644
warning("directory not found for option '-L%s'", libDir);
}
}
--
2.38.1.windows.1

Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
From cc31db916dac03d41729aa7107292bb857143293 Mon Sep 17 00:00:00 2001
From 53a7b232324cac8f9e2a81bdc0af25f359912340 Mon Sep 17 00:00:00 2001
From: Isuru Fernando <isuruf@gmail.com>
Date: Thu, 3 Feb 2022 21:28:42 -0600
Subject: [PATCH 3/5] Restore using __builtin_available for macos
Subject: [PATCH 3/4] Restore using __builtin_available for macos

---
cctools/libstuff/writeout.c | 12 ++++++------
cctools/misc/libtool.c | 12 ++++++------
2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/cctools/libstuff/writeout.c b/cctools/libstuff/writeout.c
index 1377657..2013ee6 100644
index 763539d..00c1486 100644
--- a/cctools/libstuff/writeout.c
+++ b/cctools/libstuff/writeout.c
@@ -145,27 +145,27 @@ uint32_t *throttle)
@@ -149,27 +149,27 @@ uint32_t *throttle)

#ifndef __OPENSTEP__
/* cctools-port: replaced __builtin_available */
Expand Down Expand Up @@ -47,10 +47,10 @@ index 1377657..2013ee6 100644
/*
* The environment variable ZERO_AR_DATE is used here and other
diff --git a/cctools/misc/libtool.c b/cctools/misc/libtool.c
index 22c824d..17dc6dd 100644
index 3ab43a1..e098206 100644
--- a/cctools/misc/libtool.c
+++ b/cctools/misc/libtool.c
@@ -1382,9 +1382,9 @@ char **envp)
@@ -1389,9 +1389,9 @@ char **envp)
if (cmd_flags.D == FALSE && zero_ar_date == FALSE) {
#ifndef __OPENSTEP__
/* cctools-port: replaced __builtin_available */
Expand All @@ -62,7 +62,7 @@ index 22c824d..17dc6dd 100644
#ifdef HAVE_CLOCK_GETTIME
if (clock_gettime(CLOCK_REALTIME, &toc_timespec)) {
system_fatal("clock_gettime failed");
@@ -1392,9 +1392,9 @@ char **envp)
@@ -1399,9 +1399,9 @@ char **envp)
}
toc_time = toc_timespec.tv_sec;
#endif /* HAVE_CLOCK_GETTIME */
Expand All @@ -74,7 +74,7 @@ index 22c824d..17dc6dd 100644
#ifndef HAVE_CLOCK_GETTIME
if (gettimeofday(&toc_timeval, NULL)) {
system_fatal("gettimeofday failed");
@@ -1402,9 +1402,9 @@ char **envp)
@@ -1409,9 +1409,9 @@ char **envp)
}
toc_time = toc_timeval.tv_sec;
#endif /* !HAVE_CLOCK_GETTIME */
Expand All @@ -86,6 +86,3 @@ index 22c824d..17dc6dd 100644
#else
toc_time = time(NULL);
#endif /* !defined(__OPENSTEP__) */
--
2.38.1.windows.1

Original file line number Diff line number Diff line change
@@ -1,34 +1,31 @@
From 5d6c783218d987da96ac96ede628970122eab0b1 Mon Sep 17 00:00:00 2001
From 4bc8b0d61a4787ef302ddfc0ab6bc46b7804869d Mon Sep 17 00:00:00 2001
From: Eli Rykoff <erykoff@stanford.edu>
Date: Thu, 24 Feb 2022 21:16:24 -0800
Subject: [PATCH 4/5] Turn off outputIsMappableFile when building to osx-arm64
Subject: [PATCH 4/4] Turn off outputIsMappableFile when building to osx-arm64

---
cctools/ld64/src/ld/OutputFile.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/cctools/ld64/src/ld/OutputFile.cpp b/cctools/ld64/src/ld/OutputFile.cpp
index c6b4270..6cd1591 100644
index 36772bb..d79cd8a 100644
--- a/cctools/ld64/src/ld/OutputFile.cpp
+++ b/cctools/ld64/src/ld/OutputFile.cpp
@@ -3805,7 +3805,7 @@ void OutputFile::writeOutputFile(ld::Internal& state)
// <rdar://problem/12264302> Don't use mmap on non-hfs volumes
@@ -3844,7 +3844,7 @@ void OutputFile::writeOutputFile(ld::Internal& state)
#ifdef __APPLE__ // ld64-port
// <rdar://problem/12264302> Don't use mmap on non-hfs volumes
struct statfs fsInfo;
- if ( statfs(_options.outputFilePath(), &fsInfo) != -1 ) {
+ if ( (_options.architecture() != CPU_TYPE_ARM64) && (statfs(_options.outputFilePath(), &fsInfo) != -1) ) {
if ( (strcmp(fsInfo.f_fstypename, "hfs") == 0) || (strcmp(fsInfo.f_fstypename, "apfs") == 0) ) {
(void)unlink(_options.outputFilePath());
outputIsMappableFile = true;
@@ -3835,7 +3835,7 @@ void OutputFile::writeOutputFile(ld::Internal& state)
end[1] = '\0';
+ if ( (_options.architecture() != CPU_TYPE_ARM64) && (statfs(_options.outputFilePath(), &fsInfo) != -1) ) {
// <rdar://problem/72136053>
(void)unlink(_options.outputFilePath());

@@ -3878,7 +3878,7 @@ void OutputFile::writeOutputFile(ld::Internal& state)
strcpy(dirPath, "./"); // if no slashes path, then writing to cwd
#ifdef __APPLE__ // ld64-port
struct statfs fsInfo;
- if ( statfs(dirPath, &fsInfo) != -1 ) {
+ if ( (_options.architecture() != CPU_TYPE_ARM64) && (statfs(dirPath, &fsInfo) != -1) ) {
if ( (strcmp(fsInfo.f_fstypename, "hfs") == 0) || (strcmp(fsInfo.f_fstypename, "apfs") == 0) ) {
outputIsMappableFile = true;
}
--
2.38.1.windows.1

struct statfs fsInfo;
- if ( statfs(dirPath, &fsInfo) != -1 ) {
+ if ( (_options.architecture() != CPU_TYPE_ARM64) && (statfs(dirPath, &fsInfo) != -1) ) {
if ( (strcmp(fsInfo.f_fstypename, "hfs") == 0) || (strcmp(fsInfo.f_fstypename, "apfs") == 0) ) {
outputIsMappableFile = true;
}

This file was deleted.

0 comments on commit ba54ee0

Please sign in to comment.