rustc/debian/patches/u-detect-mips-cpu.patch
2017-01-04 16:06:31 +01:00

51 lines
1.4 KiB
Diff

Description: Detect mips CPUs in ./configure
This basically recreates the logic that already exists in bootstrap.py
Endianness test from https://stackoverflow.com/questions/26859098/testing-endianness-of-system-with-the-unix-shell
Author: Ximin Luo <infinity0@debian.org>
Bug: https://github.com/rust-lang/rust/pull/38650
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/configure
+++ b/configure
@@ -388,6 +388,7 @@
CFG_OSTYPE=$(uname -s)
CFG_CPUTYPE=$(uname -m)
+ENDIAN=$(printf '\1' | od -dAn)
if [ $CFG_OSTYPE = Darwin -a $CFG_CPUTYPE = i386 ]
then
@@ -541,6 +542,17 @@
CFG_CPUTYPE=x86_64
;;
+ mips | mips64)
+ if [ "$CFG_CPUTYPE" = "mips64" ]; then
+ CFG_OSTYPE="${CFG_OSTYPE}abi64"
+ fi
+ if [ "$ENDIAN" -eq 1 ]; then
+ CFG_CPUTYPE="${CFG_CPUTYPE}el"
+ elif [ "$ENDIAN" -ne 256 ]; then
+ err "unknown endianness: $ENDIAN (expecting 1 for little or 256 for big)"
+ fi
+ ;;
+
BePC)
CFG_CPUTYPE=i686
;;
--- a/src/test/run-pass/conditional-compile-arch.rs
+++ b/src/test/run-pass/conditional-compile-arch.rs
@@ -22,6 +22,12 @@
#[cfg(target_arch = "aarch64")]
pub fn main() { }
+#[cfg(target_arch = "mips")]
+pub fn main() { }
+
+#[cfg(target_arch = "mips64")]
+pub fn main() { }
+
#[cfg(target_arch = "powerpc64")]
pub fn main() { }