Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

osx-arm64 target #23

Merged
merged 51 commits into from Oct 14, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
a3232f5
osx-arm64 target
isuruf Aug 7, 2020
a01dde9
fix cross_platform
isuruf Aug 7, 2020
d9f5aad
fix linter
isuruf Aug 7, 2020
3aa271b
MNT: Re-rendered with conda-build 3.19.2, conda-smithy 3.7.6, and con…
Aug 7, 2020
9d2eff2
Don't build ld64 meta package when cross compiling
isuruf Aug 7, 2020
f325659
Fix linux build
isuruf Aug 7, 2020
48d9bd3
verbose
isuruf Aug 7, 2020
e5d37bc
MNT: Re-rendered with conda-build 3.19.2, conda-smithy 3.7.7.dev9, an…
isuruf Aug 8, 2020
5326faf
use llvm tools for arm64
isuruf Aug 8, 2020
4126804
Merge branch 'master' of github.com:conda-forge/cctools-and-ld64-feed…
isuruf Aug 8, 2020
7412e6b
Add ld links
isuruf Aug 8, 2020
2befe80
Use llvm 11.0.0.rc1
isuruf Aug 8, 2020
75206ed
MNT: Re-rendered with conda-build 3.19.2, conda-smithy 3.7.7.dev9, an…
isuruf Aug 8, 2020
231adbd
[ci skip] [skip ci] [cf admin skip] ***NO_CI*** admin migration CFEP1…
Aug 9, 2020
f13df95
MNT: Re-rendered with conda-build 3.19.2, conda-smithy 3.7.7.post.dev…
isuruf Aug 9, 2020
6987bb6
Change the host from macos11 to darwin20
isuruf Aug 11, 2020
754cb2b
MNT: Re-rendered with conda-build 3.19.2, conda-smithy 3.7.9, and con…
isuruf Aug 11, 2020
cc9cd16
make build number 5
isuruf Aug 12, 2020
884bf9b
llvm-ar and ranlib doesn't support triplets
isuruf Aug 12, 2020
954fa01
Fix test
isuruf Aug 12, 2020
c80a736
Fix LTO on linux
isuruf Aug 14, 2020
e671b78
Merge remote-tracking branch 'origin/lto_linux' into osx-arm64
isuruf Aug 14, 2020
c477cc5
Don't use strip from llvm
isuruf Aug 14, 2020
ffdc1a3
Merge remote-tracking branch 'upstream/rc' into HEAD
isuruf Aug 14, 2020
a28f0c9
Build for new tapi
isuruf Aug 15, 2020
ed11fbe
Use the linker on arm64 too
isuruf Aug 15, 2020
cc69b4e
use assembler from cctools
isuruf Sep 4, 2020
c8f387b
don't exit
isuruf Sep 4, 2020
f511e93
Don't need GNU as
isuruf Sep 4, 2020
34101f0
add comment
isuruf Sep 4, 2020
452d5ef
update patch
isuruf Oct 1, 2020
75ea590
need ldid
isuruf Oct 1, 2020
6f13a19
Use full path to ldid
isuruf Oct 2, 2020
95dbd19
bump build number
isuruf Oct 2, 2020
275110d
Update to latest master
isuruf Oct 4, 2020
0bb93fe
update to latest master
isuruf Oct 4, 2020
6030dc4
update to latest master again
isuruf Oct 5, 2020
268baaf
Create gh93.patch
beckermr Oct 7, 2020
18b8103
Update meta.yaml
beckermr Oct 7, 2020
23ed700
Delete gh93.patch
beckermr Oct 7, 2020
f74fc8d
update to latest commit
beckermr Oct 7, 2020
d147c63
MNT: Re-rendered with conda-build 3.20.3, conda-smithy 3.8.2, and con…
isuruf Oct 14, 2020
82a86f3
Update to 11.0.0 and upload to main
isuruf Oct 14, 2020
e971e14
flexible
isuruf Oct 14, 2020
98f35cb
bump build number
isuruf Oct 14, 2020
9148040
osx-64 -> osx-*
isuruf Oct 14, 2020
755fb4d
channels
isuruf Oct 14, 2020
6c514bb
MNT: Re-rendered with conda-build 3.20.3, conda-smithy 3.8.2, and con…
isuruf Oct 14, 2020
21f67d4
test on native only
isuruf Oct 14, 2020
6362e00
MNT: Re-rendered with conda-build 3.20.3, conda-smithy 3.8.2, and con…
isuruf Oct 14, 2020
a674923
remove use_llvm_tools option
isuruf Oct 14, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 22 additions & 8 deletions recipe/patches/0001-codesign-all-arm64-binaries.patch
@@ -1,25 +1,39 @@
From e4605b27c51769c93202d9f9e0f11715cb390b3d Mon Sep 17 00:00:00 2001
From 0a2270ff6adaab8dd47a8c8e5e5dd16f19a38cf1 Mon Sep 17 00:00:00 2001
From: Isuru Fernando <isuruf@gmail.com>
Date: Wed, 30 Sep 2020 19:43:53 -0500
Subject: [PATCH 1/2] codesign all arm64 binaries
Date: Fri, 2 Oct 2020 17:03:07 -0500
Subject: [PATCH] codesign after linker is done

---
cctools/ld64/src/ld/ld.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
cctools/ld64/src/ld/ld.cpp | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/cctools/ld64/src/ld/ld.cpp b/cctools/ld64/src/ld/ld.cpp
index 05ff299..cb2d698 100644
index 05ff299..cf4bb78 100644
--- a/cctools/ld64/src/ld/ld.cpp
+++ b/cctools/ld64/src/ld/ld.cpp
@@ -1434,7 +1434,7 @@ int main(int argc, const char* argv[])
@@ -1434,8 +1434,20 @@ int main(int argc, const char* argv[])
fprintf(stderr, "processed %3u dylib files\n", inputFiles._totalDylibsLoaded);
fprintf(stderr, "wrote output file totaling %15s bytes\n", commatize(out.fileSize(), temp));
}
- if ( getenv("IOS_SIGN_CODE_WHEN_BUILD") || getenv("IOS_FAKE_CODE_SIGN") ) { // ld64-port (keep IOS_SIGN_CODE_WHEN_BUILD for compatibility with the 'iOS toolchain based on clang for linux' project)
- std::string ldid = std::string("ldid -S ") + std::string(options.outputFilePath());
+ if ( getenv("IOS_SIGN_CODE_WHEN_BUILD") || getenv("IOS_FAKE_CODE_SIGN") || strcmp(archName, "arm64") == 0) { // ld64-port (keep IOS_SIGN_CODE_WHEN_BUILD for compatibility with the 'iOS toolchain based on clang for linux' project)
std::string ldid = std::string("ldid -S ") + std::string(options.outputFilePath());
+ unsigned bufsize = MAXPATHLEN;
+ char *p, *prefix, buf[MAXPATHLEN], resolved_name[PATH_MAX];
+ p = buf;
+ int i = _NSGetExecutablePath(p, &bufsize);
+ if(i == -1){
+ p = new char[bufsize];
+ _NSGetExecutablePath(p, &bufsize);
+ }
+ prefix = realpath(p, resolved_name);
+ p = rindex(prefix, '/');
+ if(p != NULL)
+ p[1] = '\0';
+ std::string ldid = std::string(prefix) + std::string("ldid -S ") + std::string(options.outputFilePath());
system(ldid.c_str());
}
// <rdar://problem/6780050> Would like linker warning to be build error.
--
2.28.0

77 changes: 48 additions & 29 deletions recipe/patches/0002-run-ldid-after-install_name_tool.patch
@@ -1,57 +1,76 @@
From a489b296b895216167ed6b44833731d448b7b5db Mon Sep 17 00:00:00 2001
From fea8e31e4029cb1914042c1cf72db3f941928614 Mon Sep 17 00:00:00 2001
From: Isuru Fernando <isuruf@gmail.com>
Date: Wed, 30 Sep 2020 21:01:34 -0500
Subject: [PATCH 2/2] run ldid after install_name_tool
Date: Fri, 2 Oct 2020 16:02:19 -0500
Subject: [PATCH] Run ldid after install_name_tool

---
cctools/misc/install_name_tool.c | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
cctools/misc/install_name_tool.c | 38 +++++++++++++++++++++++++++++++-
1 file changed, 37 insertions(+), 1 deletion(-)

diff --git a/cctools/misc/install_name_tool.c b/cctools/misc/install_name_tool.c
index 34d063d..e976ede 100644
index 34d063d..f4d34e1 100644
--- a/cctools/misc/install_name_tool.c
+++ b/cctools/misc/install_name_tool.c
@@ -131,6 +131,8 @@ char **envp)
@@ -31,6 +31,7 @@
#include "stuff/rnd.h"
#include "stuff/allocate.h"
#include "stuff/write64.h"
+#include <sys/param.h>

/* used by error routines as the name of the program */
char *progname = NULL;
@@ -131,6 +132,9 @@ char **envp)
uint32_t narchs;
char *input;
char *output;
+ char *ldidcommand;
+ int isarm64;
+ char *ldidcommand; // cctools-port
+ int isarm64, bufsize; // cctools-port
+ char *p, *prefix, buf[MAXPATHLEN], resolved_name[PATH_MAX]; // cctools-port

output = NULL;
progname = argv[0];
@@ -312,11 +314,33 @@ char **envp)
@@ -312,11 +316,43 @@ char **envp)
if(errors)
exit(EXIT_FAILURE);

+ isarm64 = 0;
+ for (i = 0; i < narchs; i++) {
+ if (archs[i].object->mh != NULL) {
+ if (archs[i].object->mh->cputype == CPU_TYPE_ARM64) {
+ isarm64 = 1;
+ }
+ } else {
+ if (archs[i].object->mh64->cputype == CPU_TYPE_ARM64) {
+ isarm64 = 1;
+ }
+ isarm64 = 0; /* cctools-port */
+ for (i = 0; i < narchs; i++) {
+ if (archs[i].object->mh != NULL) {
+ if (archs[i].object->mh->cputype == CPU_TYPE_ARM64) {
+ isarm64 = 1;
+ }
+ } else {
+ if (archs[i].object->mh64->cputype == CPU_TYPE_ARM64) {
+ isarm64 = 1;
+ }
+ }
+ }
+ } /* cctools-port */
+
if(output != NULL)
writeout(archs, narchs, output, 0777, TRUE, FALSE, FALSE, FALSE,
NULL);
- else
+ else {
write_on_input(archs, narchs, input);
+ output = input;
+ }
+ output = input;
+ }
+
+ if (isarm64 == 1) {
+ ldidcommand = allocate(strlen(output) + 9);
+ memcpy(ldidcommand, "ldid -S ", 8);
+ memcpy(ldidcommand + 8, input, strlen(output) + 1);
+ system(ldidcommand);
+ }
+ if (isarm64 == 1) { /* cctools-port */
+ bufsize = MAXPATHLEN;
+ p = buf;
+ i = _NSGetExecutablePath(p, &bufsize);
+ if(i == -1){
+ p = allocate(bufsize);
beckermr marked this conversation as resolved.
Show resolved Hide resolved
+ _NSGetExecutablePath(p, &bufsize);
+ }
+ prefix = realpath(p, resolved_name);
+ p = rindex(prefix, '/');
+ if(p != NULL)
+ p[1] = '\0';
+ ldidcommand = makestr(prefix, "ldid -S ", output, NULL);
+ system(ldidcommand);
+ free(ldidcommand);
+ } /* cctools-port */

if(errors)
return(EXIT_FAILURE);
Expand Down