446cf2
commit fb4c32aef64500c65c7fc95ca06d7e17d467be45
446cf2
Author: H.J. Lu <hjl.tools@gmail.com>
446cf2
Date:   Mon Aug 6 06:25:28 2018 -0700
446cf2
446cf2
    x86: Move STATE_SAVE_OFFSET/STATE_SAVE_MASK to sysdep.h
446cf2
    
446cf2
    Move STATE_SAVE_OFFSET and STATE_SAVE_MASK to sysdep.h to make
446cf2
    sysdeps/x86/cpu-features.h a C header file.
446cf2
    
446cf2
            * sysdeps/x86/cpu-features.h (STATE_SAVE_OFFSET): Removed.
446cf2
            (STATE_SAVE_MASK): Likewise.
446cf2
            Don't check __ASSEMBLER__ to include <cpu-features-offsets.h>.
446cf2
            * sysdeps/x86/sysdep.h (STATE_SAVE_OFFSET): New.
446cf2
            (STATE_SAVE_MASK): Likewise.
446cf2
            * sysdeps/x86_64/dl-trampoline.S: Include <cpu-features-offsets.h>
446cf2
            instead of <cpu-features.h>.
446cf2
446cf2
diff --git a/sysdeps/x86/cpu-features.h b/sysdeps/x86/cpu-features.h
446cf2
index 4c6d08c709eea204..d342664c64ab7aa1 100644
446cf2
--- a/sysdeps/x86/cpu-features.h
446cf2
+++ b/sysdeps/x86/cpu-features.h
446cf2
@@ -92,18 +92,6 @@
446cf2
 /* The current maximum size of the feature integer bit array.  */
446cf2
 #define FEATURE_INDEX_MAX 1
446cf2
 
446cf2
-/* Offset for fxsave/xsave area used by _dl_runtime_resolve.  Also need
446cf2
-   space to preserve RCX, RDX, RSI, RDI, R8, R9 and RAX.  It must be
446cf2
-   aligned to 16 bytes for fxsave and 64 bytes for xsave.  */
446cf2
-#define STATE_SAVE_OFFSET (8 * 7 + 8)
446cf2
-
446cf2
-/* Save SSE, AVX, AVX512, mask and bound registers.  */
446cf2
-#define STATE_SAVE_MASK \
446cf2
-  ((1 << 1) | (1 << 2) | (1 << 3) | (1 << 5) | (1 << 6) | (1 << 7))
446cf2
-
446cf2
-#ifdef	__ASSEMBLER__
446cf2
-# include <cpu-features-offsets.h>
446cf2
-#else	/* __ASSEMBLER__ */
446cf2
 enum
446cf2
   {
446cf2
     COMMON_CPUID_INDEX_1 = 0,
446cf2
@@ -267,8 +255,6 @@ extern const struct cpu_features *__get_cpu_features (void)
446cf2
 # define index_arch_XSAVEC_Usable	FEATURE_INDEX_1
446cf2
 # define index_arch_Prefer_FSRM		FEATURE_INDEX_1
446cf2
 
446cf2
-#endif	/* !__ASSEMBLER__ */
446cf2
-
446cf2
 #ifdef __x86_64__
446cf2
 # define HAS_CPUID 1
446cf2
 #elif defined __i586__ || defined __pentium__
446cf2
diff --git a/sysdeps/x86/sysdep.h b/sysdeps/x86/sysdep.h
446cf2
index 8776ad8374e056d3..f41f4ebd425cfbaf 100644
446cf2
--- a/sysdeps/x86/sysdep.h
446cf2
+++ b/sysdeps/x86/sysdep.h
446cf2
@@ -48,6 +48,15 @@ enum cf_protection_level
446cf2
 # define SHSTK_ENABLED	0
446cf2
 #endif
446cf2
 
446cf2
+/* Offset for fxsave/xsave area used by _dl_runtime_resolve.  Also need
446cf2
+   space to preserve RCX, RDX, RSI, RDI, R8, R9 and RAX.  It must be
446cf2
+   aligned to 16 bytes for fxsave and 64 bytes for xsave.  */
446cf2
+#define STATE_SAVE_OFFSET (8 * 7 + 8)
446cf2
+
446cf2
+/* Save SSE, AVX, AVX512, mask and bound registers.  */
446cf2
+#define STATE_SAVE_MASK \
446cf2
+  ((1 << 1) | (1 << 2) | (1 << 3) | (1 << 5) | (1 << 6) | (1 << 7))
446cf2
+
446cf2
 #ifdef	__ASSEMBLER__
446cf2
 
446cf2
 /* Syntactic details of assembler.  */
446cf2
diff --git a/sysdeps/x86_64/dl-trampoline.S b/sysdeps/x86_64/dl-trampoline.S
446cf2
index ef1425cbb909529a..fd918510fe155733 100644
446cf2
--- a/sysdeps/x86_64/dl-trampoline.S
446cf2
+++ b/sysdeps/x86_64/dl-trampoline.S
446cf2
@@ -18,7 +18,7 @@
446cf2
 
446cf2
 #include <config.h>
446cf2
 #include <sysdep.h>
446cf2
-#include <cpu-features.h>
446cf2
+#include <cpu-features-offsets.h>
446cf2
 #include <link-defines.h>
446cf2
 
446cf2
 #ifndef DL_STACK_ALIGNMENT