prebuilt android cc: Edit wrapper to pass the right -m flags for armv7a
(cherry picked from commit 827ef09140
)
This commit is contained in:
parent
e3f6c6d18d
commit
6f40d18d44
@ -31,18 +31,21 @@ rec {
|
|||||||
|
|
||||||
armv5te-android-prebuilt = rec {
|
armv5te-android-prebuilt = rec {
|
||||||
config = "armv5tel-unknown-linux-androideabi";
|
config = "armv5tel-unknown-linux-androideabi";
|
||||||
|
sdkVer = "21";
|
||||||
platform = platforms.armv5te-android;
|
platform = platforms.armv5te-android;
|
||||||
useAndroidPrebuilt = true;
|
useAndroidPrebuilt = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
armv7a-android-prebuilt = rec {
|
armv7a-android-prebuilt = rec {
|
||||||
config = "armv7a-unknown-linux-androideabi";
|
config = "armv7a-unknown-linux-androideabi";
|
||||||
|
sdkVer = "21";
|
||||||
platform = platforms.armv7a-android;
|
platform = platforms.armv7a-android;
|
||||||
useAndroidPrebuilt = true;
|
useAndroidPrebuilt = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
aarch64-android-prebuilt = rec {
|
aarch64-android-prebuilt = rec {
|
||||||
config = "aarch64-unknown-linux-android";
|
config = "aarch64-unknown-linux-android";
|
||||||
|
sdkVer = "21";
|
||||||
platform = platforms.aarch64-multiplatform;
|
platform = platforms.aarch64-multiplatform;
|
||||||
useAndroidPrebuilt = true;
|
useAndroidPrebuilt = true;
|
||||||
};
|
};
|
||||||
|
@ -15,7 +15,12 @@ let
|
|||||||
"x86_64-unknown-linux-gnu" = {
|
"x86_64-unknown-linux-gnu" = {
|
||||||
double = "linux-x86_64";
|
double = "linux-x86_64";
|
||||||
};
|
};
|
||||||
"arm-unknown-linux-androideabi" = {
|
"armv5tel-unknown-linux-androideabi" = {
|
||||||
|
arch = "arm";
|
||||||
|
triple = "arm-linux-androideabi";
|
||||||
|
gccVer = "4.8";
|
||||||
|
};
|
||||||
|
"armv7a-unknown-linux-androideabi" = {
|
||||||
arch = "arm";
|
arch = "arm";
|
||||||
triple = "arm-linux-androideabi";
|
triple = "arm-linux-androideabi";
|
||||||
gccVer = "4.8";
|
gccVer = "4.8";
|
||||||
@ -59,9 +64,29 @@ rec {
|
|||||||
cc = binaries;
|
cc = binaries;
|
||||||
bintools = binutils;
|
bintools = binutils;
|
||||||
libc = targetAndroidndkPkgs.libraries;
|
libc = targetAndroidndkPkgs.libraries;
|
||||||
extraBuildCommands =
|
extraBuildCommands = lib.optionalString targetPlatform.isAarch32 (let
|
||||||
|
p = targetPlatform.platform.gcc or {};
|
||||||
|
float = p.float or (targetPlatform.parsed.abi.float or null);
|
||||||
|
flags = lib.concatLists [
|
||||||
|
(lib.optional (p ? arch) "-march=${p.arch}")
|
||||||
|
(lib.optional (p ? cpu) "-mcpu=${p.cpu}")
|
||||||
|
(lib.optional (p ? abi) "-mabi=${p.abi}")
|
||||||
|
(lib.optional (p ? fpu) "-mfpu=${p.fpu}")
|
||||||
|
(lib.optional (float != null) "-mfloat=${float}")
|
||||||
|
(lib.optional (p ? float-abi) "-mfloat-abi=${p.float-abi}")
|
||||||
|
(lib.optional (p ? mode) "-mmode=${p.mode}")
|
||||||
|
];
|
||||||
|
in ''
|
||||||
|
sed -E -i \
|
||||||
|
$out/bin/${targetPlatform.config}-cc \
|
||||||
|
$out/bin/${targetPlatform.config}-c++ \
|
||||||
|
$out/bin/${targetPlatform.config}-gcc \
|
||||||
|
$out/bin/${targetPlatform.config}-g++ \
|
||||||
|
-e '130i extraBefore+=(-Wl,--fix-cortex-a8)' \
|
||||||
|
-e 's|^(extraBefore=)\(\)$|\1(${builtins.toString flags})|'
|
||||||
|
'')
|
||||||
# GCC 4.9 is the first relase with "-fstack-protector"
|
# GCC 4.9 is the first relase with "-fstack-protector"
|
||||||
lib.optionalString (lib.versionOlder targetInfo.gccVer "4.9") ''
|
+ lib.optionalString (lib.versionOlder targetInfo.gccVer "4.9") ''
|
||||||
sed -E \
|
sed -E \
|
||||||
-i $out/nix-support/add-hardening.sh \
|
-i $out/nix-support/add-hardening.sh \
|
||||||
-e 's|(-fstack-protector)-strong|\1|g'
|
-e 's|(-fstack-protector)-strong|\1|g'
|
||||||
@ -76,7 +101,7 @@ rec {
|
|||||||
libraries = {
|
libraries = {
|
||||||
name = "bionic-prebuilt";
|
name = "bionic-prebuilt";
|
||||||
type = "derivation";
|
type = "derivation";
|
||||||
outPath = "${buildAndroidndk}/libexec/${buildAndroidndk.name}/platforms/android-21/arch-${hostInfo.arch}/usr/";
|
outPath = "${buildAndroidndk}/libexec/${buildAndroidndk.name}/platforms/android-${hostPlatform.sdkVer}/arch-${hostInfo.arch}/usr/";
|
||||||
drvPath = throw "fake derivation, build ${buildAndroidndk} to use";
|
drvPath = throw "fake derivation, build ${buildAndroidndk} to use";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user