about summary refs log tree commit diff
path: root/sysdeps/x86_64/multiarch/init-arch.h
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2013-01-03 15:02:33 -0800
committerH.J. Lu <hjl.tools@gmail.com>2013-01-03 15:02:33 -0800
commit9b5a06c242e640d4af84a031e96ca47bcf595caf (patch)
tree0304299bad3c57a945fb33f077c31e32f37a8bc1 /sysdeps/x86_64/multiarch/init-arch.h
parent5d7dd1ca8436db8a1444310d3305ca141dc925ac (diff)
downloadglibc-hjl/pr14955.tar.gz
glibc-hjl/pr14955.tar.xz
glibc-hjl/pr14955.zip
Make __get_cpu_features hidden hjl/pr14955
Add static-init-arch.oS to libc_nonshared.a so that __get_cpu_features
can be used in other shared libraries.
Diffstat (limited to 'sysdeps/x86_64/multiarch/init-arch.h')
-rw-r--r--sysdeps/x86_64/multiarch/init-arch.h25
1 files changed, 12 insertions, 13 deletions
diff --git a/sysdeps/x86_64/multiarch/init-arch.h b/sysdeps/x86_64/multiarch/init-arch.h
index 0aece18de3..cba10cf3f1 100644
--- a/sysdeps/x86_64/multiarch/init-arch.h
+++ b/sysdeps/x86_64/multiarch/init-arch.h
@@ -109,19 +109,18 @@ extern struct cpu_features
 
 
 extern void __init_cpu_features (void) attribute_hidden;
-# define INIT_ARCH() \
-  do							\
-    if (__cpu_features.kind == arch_kind_unknown)	\
-      __init_cpu_features ();				\
-  while (0)
-
-/* Used from outside libc.so to get access to the CPU features structure.  */
-extern const struct cpu_features *__get_cpu_features (void)
-     __attribute__ ((const));
-
-# ifndef NOT_IN_libc
-#  define __get_cpu_features()	(&__cpu_features)
-# endif
+
+/* Implicitly call __init_cpu_features before accessing the CPU features
+   structure.  */
+
+extern __always_inline attribute_hidden
+const struct cpu_features *
+__get_cpu_features (void)
+{
+  if (__cpu_features.kind == arch_kind_unknown)
+    __init_cpu_features ();
+  return &__cpu_features;
+}
 
 # define HAS_CPU_FEATURE(idx, reg, bit) \
   ((__get_cpu_features ()->cpuid[idx].reg & (bit)) != 0)