|
Lubomir Rintel |
4a3c93 |
diff --git a/lib/rpmrc.c b/lib/rpmrc.c
|
|
Lubomir Rintel |
4a3c93 |
index 4ebefa7..920ceed 100644
|
|
Lubomir Rintel |
4a3c93 |
--- a/lib/rpmrc.c
|
|
Lubomir Rintel |
4a3c93 |
+++ b/lib/rpmrc.c
|
|
Lubomir Rintel |
4a3c93 |
@@ -737,6 +737,80 @@ 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 |
+
|
|
Lubomir Rintel |
4a3c93 |
+static int has_vfpv3()
|
|
|
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 |
+}
|
|
Lubomir Rintel |
4a3c93 |
+
|
|
Lubomir Rintel |
4a3c93 |
+static int has_vfp()
|
|
Lubomir Rintel |
4a3c93 |
+{
|
|
Lubomir Rintel |
4a3c93 |
+ char buffer[4096], *p;
|
|
Lubomir Rintel |
4a3c93 |
+ int fd = open("/proc/cpuinfo", O_RDONLY);
|
|
Lubomir Rintel |
4a3c93 |
+ if (read(fd, &buffer, sizeof(buffer) - 1) == -1) {
|
|
Lubomir Rintel |
4a3c93 |
+ rpmlog(RPMLOG_WARNING, _("read(/proc/cpuinfo) failed\n"));
|
|
Lubomir Rintel |
4a3c93 |
+ close(fd);
|
|
Lubomir Rintel |
4a3c93 |
+ return 0;
|
|
Lubomir Rintel |
4a3c93 |
+ }
|
|
Lubomir Rintel |
4a3c93 |
+ close(fd);
|
|
Lubomir Rintel |
4a3c93 |
+
|
|
Lubomir Rintel |
4a3c93 |
+ p = strstr(buffer, "Features");
|
|
Lubomir Rintel |
4a3c93 |
+ p = strtok(p, "\n");
|
|
Lubomir Rintel |
4a3c93 |
+ p = strstr(p, "vfp");
|
|
Lubomir Rintel |
4a3c93 |
+ p = strtok(p, " ");
|
|
Lubomir Rintel |
4a3c93 |
+ if (p == NULL) {
|
|
Lubomir Rintel |
4a3c93 |
+ rpmlog(RPMLOG_WARNING, _("/proc/cpuinfo has no 'Features' line\n"));
|
|
Lubomir Rintel |
4a3c93 |
+ return 0;
|
|
Lubomir Rintel |
4a3c93 |
+ } else if (strcmp(p, "vfp") == 0) {
|
|
Lubomir Rintel |
4a3c93 |
+ return 1;
|
|
Lubomir Rintel |
4a3c93 |
+ }
|
|
Lubomir Rintel |
4a3c93 |
+ return 0;
|
|
Lubomir Rintel |
4a3c93 |
+}
|
|
|
72d4c0 |
+#endif
|
|
|
72d4c0 |
+
|
|
|
72d4c0 |
|
|
|
72d4c0 |
# if defined(__linux__) && defined(__i386__)
|
|
|
72d4c0 |
#include <setjmp.h>
|
|
Lubomir Rintel |
4a3c93 |
@@ -1147,6 +1221,20 @@ static void defaultMachine(const char ** arch,
|
|
Panu Matilainen |
0bacf1 |
# endif /* __ORDER_BIG_ENDIAN__ */
|
|
Phil Knirsch |
e780ef |
# endif /* ppc64*-linux */
|
|
|
72d4c0 |
|
|
|
72d4c0 |
+# if defined(__linux__) && defined(__arm__)
|
|
|
72d4c0 |
+ {
|
|
|
72d4c0 |
+ if (strcmp(un.machine, "armv7l") == 0 ) {
|
|
Lubomir Rintel |
4a3c93 |
+ if (has_neon() && has_vfpv3())
|
|
|
72d4c0 |
+ strcpy(un.machine, "armv7hnl");
|
|
Lubomir Rintel |
4a3c93 |
+ else if (has_vfpv3())
|
|
|
72d4c0 |
+ strcpy(un.machine, "armv7hl");
|
|
|
72d4c0 |
+ } else if (strcmp(un.machine, "armv6l") == 0 ) {
|
|
Lubomir Rintel |
4a3c93 |
+ if (has_vfp())
|
|
|
72d4c0 |
+ strcpy(un.machine, "armv6hl");
|
|
|
72d4c0 |
+ }
|
|
|
72d4c0 |
+ }
|
|
|
72d4c0 |
+# endif /* arm*-linux */
|
|
|
72d4c0 |
+
|
|
|
72d4c0 |
# if defined(__GNUC__) && defined(__alpha__)
|
|
|
72d4c0 |
{
|
|
|
72d4c0 |
unsigned long amask, implver;
|