uclibc-ng: improve detection of FPU, endianess and ABI (#458935)

This commit is contained in:
Alyssa Ross 2026-01-06 14:13:36 +00:00 committed by GitHub
commit a2b519e6c2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 39 additions and 12 deletions

View file

@ -440,6 +440,11 @@ rec {
isPE = { isPE = {
kernel.execFormat = execFormats.pe; kernel.execFormat = execFormats.pe;
}; };
isEabi = {
abi.eabi = true;
};
}; };
# given two patterns, return a pattern which is their logical AND. # given two patterns, return a pattern which is their logical AND.

View file

@ -662,15 +662,19 @@ rec {
# On ARM, this corresponds to ARMEABI. # On ARM, this corresponds to ARMEABI.
eabi = { eabi = {
float = "soft"; float = "soft";
eabi = true;
}; };
eabihf = { eabihf = {
float = "hard"; float = "hard";
eabi = true;
}; };
# Other architectures should use ELF in embedded situations. # Other architectures should use ELF in embedded situations.
elf = { }; elf = { };
androideabi = { }; androideabi = {
eabi = true;
};
android = { android = {
assertions = [ assertions = [
{ {
@ -684,9 +688,11 @@ rec {
gnueabi = { gnueabi = {
float = "soft"; float = "soft";
eabi = true;
}; };
gnueabihf = { gnueabihf = {
float = "hard"; float = "hard";
eabi = true;
}; };
gnu = { gnu = {
assertions = [ assertions = [
@ -730,17 +736,21 @@ rec {
musleabi = { musleabi = {
float = "soft"; float = "soft";
eabi = true;
}; };
musleabihf = { musleabihf = {
float = "hard"; float = "hard";
eabi = true;
}; };
musl = { }; musl = { };
uclibceabi = { uclibceabi = {
float = "soft"; float = "soft";
eabi = true;
}; };
uclibceabihf = { uclibceabihf = {
float = "hard"; float = "hard";
eabi = true;
}; };
uclibc = { }; uclibc = { };

View file

@ -1120,6 +1120,13 @@
githubId = 82811; githubId = 82811;
name = "Aldo Borrero"; name = "Aldo Borrero";
}; };
aleclearmind = {
email = "ale.nix@clearmind.me";
matrix = "@bake.monorail:matrix.org";
github = "aleclearmind";
githubId = 2545644;
name = "Alessandro Di Federico";
};
alejandrosame = { alejandrosame = {
email = "alejandrosanchzmedina@gmail.com"; email = "alejandrosanchzmedina@gmail.com";
matrix = "@alejandrosame:matrix.org"; matrix = "@alejandrosame:matrix.org";

View file

@ -26,16 +26,15 @@ let
echo "parseconfig: removing $NAME" echo "parseconfig: removing $NAME"
sed -i /^$NAME=/d .config sed -i /^$NAME=/d .config
#if test "$OPTION" != n; then echo "parseconfig: setting $NAME=$OPTION"
echo "parseconfig: setting $NAME=$OPTION" echo "$NAME=$OPTION" >> .config
echo "$NAME=$OPTION" >> .config
#fi
done done
set +x set +x
} }
''; '';
# UCLIBC_SUSV4_LEGACY defines 'tmpnam', needed for gcc libstdc++ builds. # UCLIBC_SUSV4_LEGACY defines 'tmpnam', needed for gcc libstdc++ builds.
# 'ftw' needed to build acl, a coreutils dependency
nixConfig = '' nixConfig = ''
RUNTIME_PREFIX "/" RUNTIME_PREFIX "/"
DEVEL_PREFIX "/" DEVEL_PREFIX "/"
@ -52,13 +51,20 @@ let
+ lib.optionalString (stdenv.hostPlatform.gcc.float or "" == "soft") '' + lib.optionalString (stdenv.hostPlatform.gcc.float or "" == "soft") ''
UCLIBC_HAS_FPU n UCLIBC_HAS_FPU n
'' ''
+ lib.optionalString (stdenv.hostPlatform.isAarch32 && isCross) '' + lib.optionalString stdenv.hostPlatform.isEabi ''
CONFIG_ARM_EABI y CONFIG_ARM_EABI y
''
+ lib.optionalString stdenv.hostPlatform.isLittleEndian ''
ARCH_WANTS_BIG_ENDIAN n ARCH_WANTS_BIG_ENDIAN n
ARCH_BIG_ENDIAN n ARCH_BIG_ENDIAN n
ARCH_WANTS_LITTLE_ENDIAN y ARCH_WANTS_LITTLE_ENDIAN y
ARCH_LITTLE_ENDIAN y ARCH_LITTLE_ENDIAN y
UCLIBC_HAS_FPU n ''
+ lib.optionalString stdenv.hostPlatform.isBigEndian ''
ARCH_WANTS_BIG_ENDIAN y
ARCH_BIG_ENDIAN y
ARCH_WANTS_LITTLE_ENDIAN n
ARCH_LITTLE_ENDIAN n
''; '';
in in
stdenv.mkDerivation (finalAttrs: { stdenv.mkDerivation (finalAttrs: {
@ -70,9 +76,8 @@ stdenv.mkDerivation (finalAttrs: {
hash = "sha256-X386r92yygj7KVvkVWHAGIQHED10Rs/SZLm4Iv7T7S0="; hash = "sha256-X386r92yygj7KVvkVWHAGIQHED10Rs/SZLm4Iv7T7S0=";
}; };
# 'ftw' needed to build acl, a coreutils dependency
configurePhase = '' configurePhase = ''
make defconfig make defconfig ARCH=${stdenv.hostPlatform.linuxArch}
${configParser} ${configParser}
cat << EOF | parseconfig cat << EOF | parseconfig
${nixConfig} ${nixConfig}
@ -92,7 +97,7 @@ stdenv.mkDerivation (finalAttrs: {
makeFlags = [ makeFlags = [
"ARCH=${stdenv.hostPlatform.linuxArch}" "ARCH=${stdenv.hostPlatform.linuxArch}"
"TARGET_ARCH=${stdenv.hostPlatform.linuxArch}" "TARGET_ARCH=${stdenv.hostPlatform.linuxArch}"
"VERBOSE=1" "V=1"
] ]
++ lib.optionals isCross [ ++ lib.optionals isCross [
"CROSS=${stdenv.cc.targetPrefix}" "CROSS=${stdenv.cc.targetPrefix}"
@ -144,7 +149,7 @@ stdenv.mkDerivation (finalAttrs: {
experimental and need more testing. experimental and need more testing.
''; '';
license = lib.licenses.lgpl2Plus; license = lib.licenses.lgpl2Plus;
maintainers = [ ]; maintainers = with lib.maintainers; [ aleclearmind ];
platforms = lib.platforms.linux; platforms = lib.platforms.linux;
badPlatforms = lib.platforms.aarch64; badPlatforms = lib.platforms.aarch64;
}; };

View file

@ -6975,7 +6975,7 @@ with pkgs;
else if libc == "bionic" then else if libc == "bionic" then
bionic bionic
else if libc == "uclibc" then else if libc == "uclibc" then
uclibc uclibc-ng
else if libc == "avrlibc" then else if libc == "avrlibc" then
avrlibc avrlibc
else if libc == "newlib" && stdenv.hostPlatform.isMsp430 then else if libc == "newlib" && stdenv.hostPlatform.isMsp430 then