(please CC on replies, I'm not on rpm-maint@)
The attached patch adds a 'v' near the end of the machine name if
the (ARM) system we're running on supports VFP. This allows building
and using VFP-optimised RPM packages for ARM systems that have a VFP
floating point unit.
So e.g. glibc-2.7-2.armv5tel.rpm is the regular (softfloat) glibc that
we have now, and glibc-2.7-2.armv5tevl.rpm would then be a glibc built
to use VFP instructions, installable only on systems that have HWCAP_VFP.
The idea behind this is that we want to support multiple different
flavors of the Fedora/ARM port. Right now we have just an armv5tel
softfloat flavor, but we'll probably end up with a VFP flavor soon,
and later on perhaps also an ARMv6 flavor, maybe a pure Thumb2 flavor
at some point, etc.
(I would really like not to have to parse /proc/cpuinfo, but I don't
see how to get at _dl_hwcap or AT_HWCAP -- as far as I see, ld.so uses
this info to determine its library search path but doesn't export the
info.)
Ideas?
Signed-off-by: Lennert Buytenhek <buytenh(a)marvell.com>
diff -up rpm-4.4.2.2/Makefile.am.orig rpm-4.4.2.2/Makefile.am
--- rpm-4.4.2.2/Makefile.am.orig 2007-12-23 20:06:21.000000000 +0100
+++ rpm-4.4.2.2/Makefile.am 2007-12-23 20:06:41.000000000 +0100
@@ -159,8 +159,11 @@ install-data-local:
$(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/armv4l ;\
$(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/armv4tl ;\
$(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/armv5tel ;\
+ $(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/armv5tevl ;\
$(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/armv5tejl ;\
- $(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/armv6l ;;\
+ $(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/armv5tejvl ;\
+ $(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/armv6l ;\
+ $(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/armv6vl ;;\
sparc*) $(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/sparc ;\
$(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/sparcv8 ;\
$(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/sparcv9 ;\
diff -up rpm-4.4.2.2/Makefile.in.orig rpm-4.4.2.2/Makefile.in
--- rpm-4.4.2.2/Makefile.in.orig 2007-12-23 20:06:17.000000000 +0100
+++ rpm-4.4.2.2/Makefile.in 2007-12-23 20:06:31.000000000 +0100
@@ -1212,8 +1212,11 @@ install-data-local:
$(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/armv4l ;\
$(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/armv4tl ;\
$(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/armv5tel ;\
+ $(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/armv5tevl ;\
$(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/armv5tejl ;\
- $(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/armv6l ;;\
+ $(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/armv5tejvl ;\
+ $(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/armv6l ;\
+ $(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/armv6vl ;;\
sparc*) $(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/sparc ;\
$(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/sparcv8 ;\
$(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/sparcv9 ;\
diff -up rpm-4.4.2.2/installplatform.orig rpm-4.4.2.2/installplatform
--- rpm-4.4.2.2/installplatform.orig 2007-12-23 20:05:36.000000000 +0100
+++ rpm-4.4.2.2/installplatform 2007-12-23 20:06:05.000000000 +0100
@@ -32,7 +32,7 @@ target="`$RPM --eval '%{_target}'|sed -e
case "$arch" in
i[3456]86|pentium[34]|athlon) SUBSTS='s_i386_i386_ s_i386_i486_ s_i386_i586_ s_i386_i686_ s_i386_pentium3_ s_i386_pentium4_ s_i386_athlon_' ;;
alpha*) SUBSTS='s_alpha_alpha_ s_alpha_alphaev5_ s_alpha_alphaev56_ s_alpha_alphapca56_ s_alpha_alphaev6_ s_alpha_alphaev67_' ;;
- arm*) SUBSTS='s_arm_armv3l_ s_arm_armv4l_ s_arm_armv4tl_ s_arm_armv5tel_ s_arm_armv5tejl_ s_arm_armv6l_' ;;
+ arm*) SUBSTS='s_arm_armv3l_ s_arm_armv4l_ s_arm_armv4tl_ s_arm_armv5tel_ s_arm_armv5tevl_ s_arm_armv5tejl_ s_arm_armv5tejvl_ s_arm_armv6l_ s_arm_armv6vl_' ;;
sparc*) SUBSTS='s_sparc\(64\|64v\|v9v\|v9\)_sparc_ s_sparc64_sparcv9_;s_sparc\([^v]\|$\)_sparcv9\1_ s_sparcv9_sparc64_;s_sparc\([^6]\|$\)_sparc64\1_' ;;
powerpc*|ppc*) SUBSTS='s_ppc64_ppc_ s_ppc\([^6ip]\|$\)_ppc64\1_ s_ppc\([^6ip]\|$\)_ppciseries_ s_ppc\([^6ip]\|$\)_ppcpseries_ s_ppc\([^6ip]\|$\)_ppc64iseries_ s_ppc\([^6ip]\|$\)_ppc64pseries_' ;;
s390*) SUBSTS='s_s390x_s390_ s_s390\([^x]\|$\)_s390x\1_' ;;
diff -up rpm-4.4.2.2/lib/rpmrc.c.orig rpm-4.4.2.2/lib/rpmrc.c
--- rpm-4.4.2.2/lib/rpmrc.c.orig 2007-12-23 19:47:04.000000000 +0100
+++ rpm-4.4.2.2/lib/rpmrc.c 2007-12-23 20:18:59.000000000 +0100
@@ -1084,6 +1084,34 @@ static int is_pentium4()
#endif
+#if defined(__linux__) && defined(__arm__) && defined(__ARM_EABI__)
+static int cpu_has_vfp(void)
+{
+ int has_vfp = 0;
+ FILE *fp;
+
+ fp = fopen("/proc/cpuinfo", "r");
+ if (fp != NULL) {
+ while (!feof(fp)) {
+ char linebuf[256];
+
+ if (fgets(linebuf, sizeof(linebuf), fp) == NULL)
+ break;
+
+ if (memcmp(linebuf, "Features", 8) == 0) {
+ if (strstr(linebuf, " vfp") != NULL)
+ has_vfp = 1;
+ break;
+ }
+ }
+
+ fclose(fp);
+ }
+
+ return has_vfp;
+}
+#endif
+
#if defined(__linux__) && defined(__powerpc__)
static jmp_buf mfspr_jmpbuf;
@@ -1293,6 +1321,18 @@ static void defaultMachine(/*@out@*/ con
}
# endif /* sparc*-linux */
+# if defined(__linux__) && defined(__arm__) && defined(__ARM_EABI__)
+ if (!memcmp(un.machine, "arm", 3)) {
+ int len = strlen(un.machine);
+
+ if (len < sizeof(un.machine) - 1 && cpu_has_vfp()) {
+ un.machine[len + 1] = 0;
+ un.machine[len] = un.machine[len - 1];
+ un.machine[len - 1] = 'v';
+ }
+ }
+# endif /* arm*-linux */
+
# if defined(__GNUC__) && defined(__alpha__)
{
unsigned long amask, implver;
diff -up rpm-4.4.2.2/macros.in.orig rpm-4.4.2.2/macros.in
--- rpm-4.4.2.2/macros.in.orig 2007-12-23 20:05:14.000000000 +0100
+++ rpm-4.4.2.2/macros.in 2007-12-23 20:11:13.000000000 +0100
@@ -1192,7 +1192,8 @@ done \
#------------------------------------------------------------------------------
# arch macro for all supported ARM processors
-%arm armv3l armv4b armv4l armv4tl armv5tel armv5tejl armv6l
+%arm armv3l armv4b armv4l armv4tl armv5tel armv5tevl armv5tejl armv5tejvl armv6l armv6vl
+%armvfp armv5tevl armv5tejvl armv6vl
#------------------------------------------------------------------------------
diff -up rpm-4.4.2.2/rpmrc.in.orig rpm-4.4.2.2/rpmrc.in
--- rpm-4.4.2.2/rpmrc.in.orig 2007-12-23 19:57:11.000000000 +0100
+++ rpm-4.4.2.2/rpmrc.in 2007-12-23 20:05:00.000000000 +0100
@@ -65,8 +65,11 @@ optflags: armv4b -O2 -g -march=armv4
optflags: armv4l -O2 -g -march=armv4
optflags: armv4tl -O2 -g -march=armv4t
optflags: armv5tel -O2 -g -march=armv5te
+optflags: armv5tevl -O2 -g -march=armv5te -mfpu=vfp -mfloat-abi=softfp
optflags: armv5tejl -O2 -g -march=armv5te
+optflags: armv5tejvl -O2 -g -march=armv5te -mfpu=vfp -mfloat-abi=softfp
optflags: armv6l -O2 -g -march=armv6
+optflags: armv6vl -O2 -g -march=armv6 -mfpu=vfp -mfloat-abi=softfp
optflags: atarist -O2 -g -fomit-frame-pointer
optflags: atariste -O2 -g -fomit-frame-pointer
@@ -133,8 +136,11 @@ arch_canon: armv3l: armv3l 12
arch_canon: armv4b: armv4b 12
arch_canon: armv4l: armv4l 12
arch_canon: armv5tel: armv5tel 12
+arch_canon: armv5tevl: armv5tevl 12
arch_canon: armv5tejl: armv5tejl 12
+arch_canon: armv5tejvl: armv5tejvl 12
arch_canon: armv6l: armv6l 12
+arch_canon: armv6vl: armv6vl 12
arch_canon: m68kmint: m68kmint 13
arch_canon: atarist: m68kmint 13
@@ -236,8 +242,11 @@ buildarchtranslate: armv4b: armv4b
buildarchtranslate: armv4l: armv4l
buildarchtranslate: armv4tl: armv4tl
buildarchtranslate: armv5tel: armv5tel
+buildarchtranslate: armv5tevl: armv5tevl
buildarchtranslate: armv5tejl: armv5tejl
+buildarchtranslate: armv5tejvl: armv5tejvl
buildarchtranslate: armv6l: armv6l
+buildarchtranslate: armv6vl: armv6vl
buildarchtranslate: atarist: m68kmint
buildarchtranslate: atariste: m68kmint
@@ -314,8 +323,13 @@ arch_compat: hppa1.0: parisc
arch_compat: parisc: noarch
arch_compat: armv4b: noarch
+arch_compat: armv6vl: armv6l
+arch_compat: armv6vl: armv5tejvl
arch_compat: armv6l: armv5tejl
+arch_compat: armv5tejvl: armv5tejl
+arch_compat: armv5tejvl: armv5tevl
arch_compat: armv5tejl: armv5tel
+arch_compat: armv5tevl: armv5tel
arch_compat: armv5tel: armv4tl
arch_compat: armv4tl: armv4l
arch_compat: armv4l: armv3l
@@ -412,8 +426,13 @@ buildarch_compat: mips: noarch
buildarch_compat: mipsel: noarch
buildarch_compat: armv4b: noarch
+buildarch_compat: armv6vl: armv6l
+buildarch_compat: armv6vl: armv5tejvl
buildarch_compat: armv6l: armv5tejl
+buildarch_compat: armv5tejvl: armv5tejl
+buildarch_compat: armv5tejvl: armv5tevl
buildarch_compat: armv5tejl: armv5tel
+buildarch_compat: armv5tevl: armv5tel
buildarch_compat: armv5tel: armv4tl
buildarch_compat: armv4tl: armv4l
buildarch_compat: armv4l: armv3l