From 35b65d464756d1dbce34925df41b8c4f4e531ccb Mon Sep 17 00:00:00 2001 From: Zhuowei Zhang Date: Sat, 4 Jul 2020 14:01:27 -0400 Subject: [PATCH 1/2] AsMain/makefile: support cross-compiling from x86_64 Mac To support cross-compilation from x86_64: - explicitly specify arch to be arm64 - Use xcrun to find the SDK path to the active Xcode --- AsMain/makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AsMain/makefile b/AsMain/makefile index ef9d976..75cc48b 100644 --- a/AsMain/makefile +++ b/AsMain/makefile @@ -1,5 +1,5 @@ HelloWorld: HelloWorld.o - ld -o HelloWorld HelloWorld.o -lSystem + ld -arch arm64 -syslibroot $(shell xcrun -sdk macosx --show-sdk-path) -o HelloWorld HelloWorld.o -lSystem HelloWorld.o: main.s - as -o HelloWorld.o main.s + as -arch arm64 -o HelloWorld.o main.s From 7ffccb41e5ae6177f888a9ff30b4a8c2194e172e Mon Sep 17 00:00:00 2001 From: Zhuowei Zhang Date: Sat, 4 Jul 2020 14:14:38 -0400 Subject: [PATCH 2/2] AsMain: hack: mark as an iOS application for testing on iOS I don't have a DTK, so I tested this by sideloading it to an iPad: - add this patch - make - Create a new Xcode project named HelloWorld - in Build Phases->Compile Sources, delete everthing - drag HelloWorld into the project - Clean build folder, build. - Make sure the app that's build has the right HelloWorld file. - Clean build folder, run. Xcode displays "Hello World!" in the console. --- AsMain/makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AsMain/makefile b/AsMain/makefile index 75cc48b..c4ad167 100644 --- a/AsMain/makefile +++ b/AsMain/makefile @@ -1,5 +1,5 @@ HelloWorld: HelloWorld.o - ld -arch arm64 -syslibroot $(shell xcrun -sdk macosx --show-sdk-path) -o HelloWorld HelloWorld.o -lSystem + ld -arch arm64 -platform_version ios 12.0 12.0 -syslibroot $(shell xcrun -sdk macosx --show-sdk-path) -o HelloWorld HelloWorld.o -lSystem HelloWorld.o: main.s as -arch arm64 -o HelloWorld.o main.s