|
Phil Knirsch |
e780ef |
diff -up rpm-4.9.1.3/lib/rpmrc.c.armhfp-logic rpm-4.9.1.3/lib/rpmrc.c
|
|
Phil Knirsch |
e780ef |
--- rpm-4.9.1.3/lib/rpmrc.c.armhfp-logic 2012-04-19 17:11:32.728750591 +0200
|
|
Phil Knirsch |
e780ef |
+++ rpm-4.9.1.3/lib/rpmrc.c 2012-04-19 17:11:32.754738455 +0200
|
|
Phil Knirsch |
e780ef |
@@ -743,6 +743,56 @@ static int is_sun4v()
|
|
|
72d4c0 |
}
|
|
|
72d4c0 |
#endif
|
|
|
72d4c0 |
|
|
|
72d4c0 |
+#if defined(__linux__) && defined(__arm__)
|
|
|
72d4c0 |
+static int has_neon()
|
|
|
72d4c0 |
+{
|
|
|
72d4c0 |
+ char buffer[4096], *p;
|
|
|
72d4c0 |
+ int fd = open("/proc/cpuinfo", O_RDONLY);
|
|
|
72d4c0 |
+ if (read(fd, &buffer, sizeof(buffer) - 1) == -1) {
|
|
|
72d4c0 |
+ rpmlog(RPMLOG_WARNING, _("read(/proc/cpuinfo) failed\n"));
|
|
|
72d4c0 |
+ close(fd);
|
|
|
72d4c0 |
+ return 0;
|
|
|
72d4c0 |
+ }
|
|
|
72d4c0 |
+ close(fd);
|
|
|
72d4c0 |
+
|
|
|
72d4c0 |
+ p = strstr(buffer, "Features");
|
|
|
72d4c0 |
+ p = strtok(p, "\n");
|
|
|
72d4c0 |
+ p = strstr(p, "neon");
|
|
|
72d4c0 |
+ p = strtok(p, " ");
|
|
|
72d4c0 |
+ if (p == NULL) {
|
|
|
72d4c0 |
+ rpmlog(RPMLOG_WARNING, _("/proc/cpuinfo has no 'Features' line\n"));
|
|
|
72d4c0 |
+ return 0;
|
|
|
72d4c0 |
+ } else if (strcmp(p, "neon") == 0) {
|
|
|
72d4c0 |
+ return 1;
|
|
|
72d4c0 |
+ }
|
|
|
72d4c0 |
+ return 0;
|
|
|
72d4c0 |
+}
|
|
|
72d4c0 |
+
|
|
|
72d4c0 |
+static int has_hfp()
|
|
|
72d4c0 |
+{
|
|
|
72d4c0 |
+ char buffer[4096], *p;
|
|
|
72d4c0 |
+ int fd = open("/proc/cpuinfo", O_RDONLY);
|
|
|
72d4c0 |
+ if (read(fd, &buffer, sizeof(buffer) - 1) == -1) {
|
|
|
72d4c0 |
+ rpmlog(RPMLOG_WARNING, _("read(/proc/cpuinfo) failed\n"));
|
|
|
72d4c0 |
+ close(fd);
|
|
|
72d4c0 |
+ return 0;
|
|
|
72d4c0 |
+ }
|
|
|
72d4c0 |
+ close(fd);
|
|
|
72d4c0 |
+
|
|
|
72d4c0 |
+ p = strstr(buffer, "Features");
|
|
|
72d4c0 |
+ p = strtok(p, "\n");
|
|
|
72d4c0 |
+ p = strstr(p, "vfpv3");
|
|
|
72d4c0 |
+ p = strtok(p, " ");
|
|
|
72d4c0 |
+ if (p == NULL) {
|
|
|
72d4c0 |
+ rpmlog(RPMLOG_WARNING, _("/proc/cpuinfo has no 'Features' line\n"));
|
|
|
72d4c0 |
+ return 0;
|
|
|
72d4c0 |
+ } else if (strcmp(p, "vfpv3") == 0) {
|
|
|
72d4c0 |
+ return 1;
|
|
|
72d4c0 |
+ }
|
|
|
72d4c0 |
+ return 0;
|
|
|
72d4c0 |
+}
|
|
|
72d4c0 |
+#endif
|
|
|
72d4c0 |
+
|
|
|
72d4c0 |
|
|
|
72d4c0 |
# if defined(__linux__) && defined(__i386__)
|
|
|
72d4c0 |
#include <setjmp.h>
|
|
Phil Knirsch |
e780ef |
@@ -1220,6 +1270,22 @@ static void defaultMachine(const char **
|
|
Phil Knirsch |
e780ef |
}
|
|
Phil Knirsch |
e780ef |
# endif /* ppc64*-linux */
|
|
|
72d4c0 |
|
|
|
72d4c0 |
+# if defined(__linux__) && defined(__arm__)
|
|
|
72d4c0 |
+ {
|
|
|
72d4c0 |
+ if (strcmp(un.machine, "armv7l") == 0 ) {
|
|
|
72d4c0 |
+ if (has_neon() && has_hfp())
|
|
|
72d4c0 |
+ strcpy(un.machine, "armv7hnl");
|
|
|
72d4c0 |
+ else if (has_hfp())
|
|
|
72d4c0 |
+ strcpy(un.machine, "armv7hl");
|
|
|
72d4c0 |
+ } else if (strcmp(un.machine, "armv6l") == 0 ) {
|
|
|
72d4c0 |
+ if (has_neon() && has_hfp())
|
|
|
72d4c0 |
+ strcpy(un.machine, "armv6hnl");
|
|
|
72d4c0 |
+ else if (has_hfp())
|
|
|
72d4c0 |
+ strcpy(un.machine, "armv6hl");
|
|
|
72d4c0 |
+ }
|
|
|
72d4c0 |
+ }
|
|
|
72d4c0 |
+# endif /* arm*-linux */
|
|
|
72d4c0 |
+
|
|
|
72d4c0 |
# if defined(__GNUC__) && defined(__alpha__)
|
|
|
72d4c0 |
{
|
|
|
72d4c0 |
unsigned long amask, implver;
|