On the S/390 and Itanium architectures, /proc/cpuinfo lists the CPU flags under "features" instead of "flags". On the PowerPC, "altivec supported" may be indicated under "cpu".
Signed-off-by: Zane Bitter zbitter@redhat.com --- src/lib/host_linux.c | 21 ++++++++++++++++++++- 1 files changed, 20 insertions(+), 1 deletions(-)
diff --git a/src/lib/host_linux.c b/src/lib/host_linux.c index 304592a..138aff4 100644 --- a/src/lib/host_linux.c +++ b/src/lib/host_linux.c @@ -102,7 +102,26 @@ host_os_get_cpu_flags(void) 0, PCRE_NOTEMPTY, found, sizeof(found) / sizeof(found[0]));
- if (match != expected || strncmp(cur + found[2], "flags", 5)) { + if (match != expected) { + continue; + } + + // PowerPC + if (strncmp(cur + found[2], "cpu ", 4)) { + static const char *altivec = "altivec"; + char *p = strstr(cur + found[4], altivec); + if (p && (p - cur) < found[5]) { + + if (!(flags = malloc(sizeof(altivec)))) { + goto done; + } + mh_string_copy(flags, altivec, sizeof(altivec)); + break; + } + } + + if (strncmp(cur + found[2], "flags", 5) && + strncmp(cur + found[2], "features", 8)) { continue; }
matahari@lists.fedorahosted.org