Fix the armhfp patch for armv6hl

The previous armhfp patches tried to cover armv6, but failed to do so properly
-- the hfp extension for v6 is called "vfp", not "vfpv3" and there's no "neon"
extension for it, this "armv6hnl" does not make sense at all.

Because of this, Pidora decided to patch around it so that their armv6hl
Raspberry Pi hardware is supported, breaking support for other ARMs along the
way...
This commit is contained in:
Lubomir Rintel 2014-06-18 22:38:37 +02:00
parent d1508b085d
commit 4a3c933f78
3 changed files with 64 additions and 27 deletions

View File

@ -1,7 +1,8 @@
diff -up rpm-4.11.1/lib/rpmrc.c.armhfp-logic rpm-4.11.1/lib/rpmrc.c
--- rpm-4.11.1/lib/rpmrc.c.armhfp-logic 2013-10-01 14:59:12.841041726 +0300
+++ rpm-4.11.1/lib/rpmrc.c 2013-10-01 14:59:12.856041684 +0300
@@ -733,6 +733,56 @@ static int is_sun4v()
diff --git a/lib/rpmrc.c b/lib/rpmrc.c
index 4ebefa7..920ceed 100644
--- a/lib/rpmrc.c
+++ b/lib/rpmrc.c
@@ -737,6 +737,80 @@ static int is_sun4v()
}
#endif
@ -30,7 +31,7 @@ diff -up rpm-4.11.1/lib/rpmrc.c.armhfp-logic rpm-4.11.1/lib/rpmrc.c
+ return 0;
+}
+
+static int has_hfp()
+static int has_vfpv3()
+{
+ char buffer[4096], *p;
+ int fd = open("/proc/cpuinfo", O_RDONLY);
@ -53,26 +54,48 @@ diff -up rpm-4.11.1/lib/rpmrc.c.armhfp-logic rpm-4.11.1/lib/rpmrc.c
+ }
+ return 0;
+}
+
+static int has_vfp()
+{
+ char buffer[4096], *p;
+ int fd = open("/proc/cpuinfo", O_RDONLY);
+ if (read(fd, &buffer, sizeof(buffer) - 1) == -1) {
+ rpmlog(RPMLOG_WARNING, _("read(/proc/cpuinfo) failed\n"));
+ close(fd);
+ return 0;
+ }
+ close(fd);
+
+ p = strstr(buffer, "Features");
+ p = strtok(p, "\n");
+ p = strstr(p, "vfp");
+ p = strtok(p, " ");
+ if (p == NULL) {
+ rpmlog(RPMLOG_WARNING, _("/proc/cpuinfo has no 'Features' line\n"));
+ return 0;
+ } else if (strcmp(p, "vfp") == 0) {
+ return 1;
+ }
+ return 0;
+}
+#endif
+
# if defined(__linux__) && defined(__i386__)
#include <setjmp.h>
@@ -1136,6 +1186,22 @@ static void defaultMachine(const char **
@@ -1147,6 +1221,20 @@ static void defaultMachine(const char ** arch,
# endif /* __ORDER_BIG_ENDIAN__ */
# endif /* ppc64*-linux */
+# if defined(__linux__) && defined(__arm__)
+ {
+ if (strcmp(un.machine, "armv7l") == 0 ) {
+ if (has_neon() && has_hfp())
+ if (has_neon() && has_vfpv3())
+ strcpy(un.machine, "armv7hnl");
+ else if (has_hfp())
+ else if (has_vfpv3())
+ strcpy(un.machine, "armv7hl");
+ } else if (strcmp(un.machine, "armv6l") == 0 ) {
+ if (has_neon() && has_hfp())
+ strcpy(un.machine, "armv6hnl");
+ else if (has_hfp())
+ if (has_vfp())
+ strcpy(un.machine, "armv6hl");
+ }
+ }

View File

@ -1,60 +1,71 @@
diff -uNr rpm-4.9.0-orig//macros.in rpm-4.9.0/macros.in
--- rpm-4.9.0-orig//macros.in 2011-08-05 12:23:04.000000000 -0500
+++ rpm-4.9.0/macros.in 2011-08-05 12:25:13.000000000 -0500
@@ -1032,7 +1032,7 @@
diff --git a/macros.in b/macros.in
index 5ae8c2b..1234409 100644
--- a/macros.in
+++ b/macros.in
@@ -999,7 +999,7 @@ done \
#------------------------------------------------------------------------------
# arch macro for all supported ARM processors
-%arm armv3l armv4b armv4l armv4tl armv5tel armv5tejl armv6l armv7l
+%arm armv3l armv4b armv4l armv4tl armv5tel armv5tejl armv6l armv7l armv7hl armv7hnl
+%arm armv3l armv4b armv4l armv4tl armv5tel armv5tejl armv6l armv6hl armv7l armv7hl armv7hnl
#------------------------------------------------------------------------------
# arch macro for all supported Sparc processors
diff -uNr rpm-4.9.0-orig//rpmrc.in rpm-4.9.0/rpmrc.in
--- rpm-4.9.0-orig//rpmrc.in 2011-08-05 12:23:04.000000000 -0500
+++ rpm-4.9.0/rpmrc.in 2011-08-05 12:26:34.000000000 -0500
@@ -66,6 +66,8 @@
diff --git a/rpmrc.in b/rpmrc.in
index 0427913..bd39204 100644
--- a/rpmrc.in
+++ b/rpmrc.in
@@ -67,7 +67,11 @@ optflags: armv4tl -O2 -g -march=armv4t
optflags: armv5tel -O2 -g -march=armv5te
optflags: armv5tejl -O2 -g -march=armv5te
optflags: armv6l -O2 -g -march=armv6
+optflags: armv6hl -O2 -g -march=armv6 -mfloat-abi=hard -mfpu=vfp
+
optflags: armv7l -O2 -g -march=armv7
+optflags: armv7hl -O2 -g -march=armv7-a -mfloat-abi=hard -mfpu=vfpv3-d16
+optflags: armv7hnl -O2 -g -march=armv7-a -mfloat-abi=hard -mfpu=neon
optflags: atarist -O2 -g -fomit-frame-pointer
optflags: atariste -O2 -g -fomit-frame-pointer
@@ -140,6 +142,8 @@
@@ -180,7 +184,10 @@ arch_canon: armv4l: armv4l 12
arch_canon: armv5tel: armv5tel 12
arch_canon: armv5tejl: armv5tejl 12
arch_canon: armv6l: armv6l 12
+arch_canon: armv6hl: armv6hl 12
arch_canon: armv7l: armv7l 12
+arch_canon: armv7hl: armv7hl 12
+arch_canon: armv7hnl: armv7hnl 12
arch_canon: m68kmint: m68kmint 13
arch_canon: atarist: m68kmint 13
@@ -248,6 +252,8 @@
@@ -293,7 +300,10 @@ buildarchtranslate: armv4tl: armv4tl
buildarchtranslate: armv5tel: armv5tel
buildarchtranslate: armv5tejl: armv5tejl
buildarchtranslate: armv6l: armv6l
+buildarchtranslate: armv6hl: armv6hl
buildarchtranslate: armv7l: armv7l
+buildarchtranslate: armv7hl: armv7hl
+buildarchtranslate: armv7hnl: armv7hnl
buildarchtranslate: atarist: m68kmint
buildarchtranslate: atariste: m68kmint
@@ -336,6 +342,8 @@
@@ -386,6 +396,9 @@ arch_compat: armv5tel: armv4tl
arch_compat: armv4tl: armv4l
arch_compat: armv4l: armv3l
arch_compat: armv3l: noarch
+arch_compat: armv7hnl: armv7hl
+arch_compat: armv7hl: noarch
+arch_compat: armv7hl: armv6hl
+arch_compat: armv6hl: noarch
arch_compat: atarist: m68kmint noarch
arch_compat: atariste: m68kmint noarch
@@ -441,6 +449,9 @@
@@ -497,6 +510,10 @@ buildarch_compat: armv4tl: armv4l
buildarch_compat: armv4l: armv3l
buildarch_compat: armv3l: noarch
+buildarch_compat: armv7hnl: armv7hl
+buildarch_compat: armv7hl: noarch
+buildarch_compat: armv7hl: armv6hl
+buildarch_compat: armv6hl: noarch
+
buildarch_compat: hppa2.0: hppa1.2
buildarch_compat: hppa1.2: hppa1.1

View File

@ -24,7 +24,7 @@
Summary: The RPM package management system
Name: rpm
Version: %{rpmver}
Release: %{?snapver:0.%{snapver}.}13%{?dist}
Release: %{?snapver:0.%{snapver}.}14%{?dist}
Group: System Environment/Base
Url: http://www.rpm.org/
Source0: http://rpm.org/releases/rpm-4.11.x/%{name}-%{srcver}.tar.bz2
@ -533,6 +533,9 @@ exit 0
%doc COPYING doc/librpm/html/*
%changelog
* Wed Jun 18 2014 Lubomir Rintel <lkundrak@v3.sk> - 4.11.2-14
- Fix the armhfp patch for armv6hl
* Tue Jun 10 2014 Panu Matilainen <pmatilai@redhat.com> - 4.11.2-13
- Rawhide broke our test-suite, disable for now to allow builds to be done