It turns out that glibc doesn't need its own copy of the cpu_feats, and it can just include parlib's. It may be that some code in glibc won't be able to include parlib files. If that's the case, and those files need cpu_feats, then we can revisit this.
This popped up as a problem when a file in glibc included both kernel-features. and parlib/cpu_feat.h. Rebuild glibc if you want. Signed-off-by: Barret Rhoden <[email protected]> --- .../sysdeps/akaros/kernel-features.h | 25 ++-------------------- .../glibc-2.19-akaros/sysdeps/akaros/x86_64/tls.h | 1 + 2 files changed, 3 insertions(+), 23 deletions(-) diff --git a/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/kernel-features.h b/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/kernel-features.h index b38c0321f3dc..ac364044b57d 100644 --- a/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/kernel-features.h +++ b/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/kernel-features.h @@ -1,25 +1,4 @@ -/* Copyright (c) 2016 Google Inc. - * Barret Rhoden <[email protected]> - * See LICENSE for details. - * - * Glibc uses this header to set a bunch of #defines to show what is supported - * on a particular kernel version. They set things like __ASSUME_AT_RANDOM. - * - * On Akaros, we'll eventually set those too. This is also a good place for - * exporting all of the cpu feature detection to glibc. - * - * Note that this file is only included within glibc itself; it won't appear in - * the sysroot. Use parlib/cpu_feat.h for that. */ +/* Glibc uses this header to set a bunch of #defines to show what is supported + * on a particular kernel version. They set things like __ASSUME_AT_RANDOM. */ #pragma once - -#include <ros/procinfo.h> - -static inline bool cpu_has_feat(int feature) -{ - size_t bits_per_long = sizeof(unsigned long) * 8; - unsigned long *cpu_feats = __proc_global_info.cpu_feats; - - return (cpu_feats[feature / bits_per_long] & - (1UL << (feature % bits_per_long))) != 0; -} diff --git a/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/x86_64/tls.h b/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/x86_64/tls.h index f2bb363e4e10..c96a54c5659a 100644 --- a/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/x86_64/tls.h +++ b/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/x86_64/tls.h @@ -32,6 +32,7 @@ #include <ros/procinfo.h> #include <ros/procdata.h> #include <ros/arch/mmu.h> +#include <parlib/cpu_feat.h> /* Replacement type for __m128 since this file is included by ld.so, which is compiled with -mno-sse. It must not change the alignment -- 2.7.0.rc3.207.g0ac5344 -- You received this message because you are subscribed to the Google Groups "Akaros" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. For more options, visit https://groups.google.com/d/optout.
