From fbdd944eb1b7f53faaf48d56936eda616ef9989e Mon Sep 17 00:00:00 2001
From: Jeremy Soller <jackpot51@gmail.com>
Date: Tue, 20 Dec 2016 11:25:19 -0700
Subject: [PATCH] Fixes for arm target

---
 Makefile               | 19 ++++++++++++++-----
 arm-unknown-none.json  |  2 +-
 arm-unknown-redox.json |  2 +-
 3 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index 3a466d169..ae6cbe1b7 100644
--- a/Makefile
+++ b/Makefile
@@ -160,10 +160,18 @@ pull:
 QEMU=SDL_VIDEO_X11_DGAMOUSE=0 qemu-system-$(ARCH)
 QEMUFLAGS=-serial mon:stdio -d cpu_reset -d guest_errors
 ifeq ($(ARCH),arm)
-	LD=$(ARCH)-none-eabi-ld
 	QEMUFLAGS+=-cpu arm1176 -machine integratorcp
 	QEMUFLAGS+=-nographic
 
+	CC=$(ARCH)-none-eabi-gcc
+	CXX=$(ARCH)-none-eabi-g++
+	LD=$(ARCH)-none-eabi-ld
+
+	KRUSTCFLAGS+=-C linker=$(CC)
+	KCARGOFLAGS+=-C linker=$(CC)
+	RUSTCFLAGS+=-C linker=$(CC)
+	CARGOFLAGS+=-C linker=$(CC)
+
 %.list: %
 	$(ARCH)-none-eabi-objdump -C -D $< > $@
 
@@ -201,10 +209,6 @@ else
 		FUMOUNT=sudo umount
 		LD=$(ARCH)-elf-ld
 		LDFLAGS=--gc-sections
-		KRUSTCFLAGS+=-C linker=$(CC)
-		KCARGOFLAGS+=-C linker=$(CC)
-		RUSTCFLAGS+=-C linker=$(CC)
-		CARGOFLAGS+=-C linker=$(CC)
 		VB_AUDIO=coreaudio
 		VBM="/Applications/VirtualBox.app/Contents/MacOS/VBoxManage"
 	else
@@ -221,6 +225,11 @@ else
 		VBM=VBoxManage
 	endif
 
+	KRUSTCFLAGS+=-C linker=$(CC)
+	KCARGOFLAGS+=-C linker=$(CC)
+	RUSTCFLAGS+=-C linker=$(CC)
+	CARGOFLAGS+=-C linker=$(CC)
+
 %.list: %
 	objdump -C -M intel -D $< > $@
 
diff --git a/arm-unknown-none.json b/arm-unknown-none.json
index bf1f6bdc7..292fa6434 100644
--- a/arm-unknown-none.json
+++ b/arm-unknown-none.json
@@ -8,7 +8,7 @@
     "env": "",
     "vendor": "unknown",
     "target-family": "redox",
-    "pre-link-args": ["-m32", "-nostdlib", "-static"],
+    "pre-link-args": ["-nostdlib", "-static"],
     "features": "+soft-float",
     "dynamic-linking": false,
     "executables": false,
diff --git a/arm-unknown-redox.json b/arm-unknown-redox.json
index b902f3441..6089ab188 100644
--- a/arm-unknown-redox.json
+++ b/arm-unknown-redox.json
@@ -8,7 +8,7 @@
     "env": "",
     "vendor": "unknown",
     "target-family": "redox",
-    "pre-link-args": ["-m32", "-nostdlib", "-static"],
+    "pre-link-args": ["-nostdlib", "-static"],
     "features": "+soft-float",
     "dynamic-linking": false,
     "executables": true,
-- 
GitLab