lkml.org 
[lkml]   [2010]   [May]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [tip:x86/fpu] x86: Add new static_cpu_has() function using alternatives
On 05/18/2010 01:10 PM, Eric Dumazet wrote:
>
> Might be time to change Documentation/Changes about gcc requirements ...
>
> # make
> CHK include/linux/version.h
> CHK include/generated/utsrelease.h
> CALL scripts/checksyscalls.sh
> CHK include/generated/compile.h
> CC arch/x86/kernel/process_32.o
> /usr/src/linux-2.6/arch/x86/include/asm/cpufeature.h: In function
> `prepare_to_copy':
> /usr/src/linux-2.6/arch/x86/include/asm/cpufeature.h:315: warning: asm
> operand 1 probably doesn't match constraints
> /usr/src/linux-2.6/arch/x86/include/asm/cpufeature.h:315: error:
> impossible constraint in `asm'
> /usr/src/linux-2.6/arch/x86/include/asm/cpufeature.h:313: warning:
> 'flag' might be used uninitialized in this function
> make[2]: *** [arch/x86/kernel/process_32.o] Error 1
> make[1]: *** [arch/x86/kernel] Error 2
> make: *** [arch/x86] Error 2
> # gcc -v
> Reading specs from /usr/lib/gcc/i386-redhat-linux/3.4.6/specs
> Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
> --infodir=/usr/share/info --enable-shared --enable-threads=posix
> --disable-checking --with-system-zlib --enable-__cxa_atexit
> --disable-libunwind-exceptions --enable-java-awt=gtk
> --host=i386-redhat-linux
> Thread model: posix
> gcc version 3.4.6 20060404 (Red Hat 3.4.6-10)
>

Here is the fallback patch if you want to test it.

-hpa
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
index dca9c54..4681459 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -332,6 +332,7 @@ static __always_inline __pure bool __static_cpu_has(u8 bit)
#endif
}

+#if __GNUC__ >= 4
#define static_cpu_has(bit) \
( \
__builtin_constant_p(boot_cpu_has(bit)) ? \
@@ -340,6 +341,12 @@ static __always_inline __pure bool __static_cpu_has(u8 bit)
__static_cpu_has(bit) : \
boot_cpu_has(bit) \
)
+#else
+/*
+ * gcc 3.x is too stupid to do the static test; fall back to dynamic.
+ */
+#define static_cpu_has(bit) boot_cpu_has(bit)
+#endif

#endif /* defined(__KERNEL__) && !defined(__ASSEMBLY__) */
\
 
 \ /
  Last update: 2010-05-18 23:01    [from the cache]
©2003-2011 Jasper Spaans