[PATCH v2] gdb: clean up x86 cpuid implementations

Pedro Alves palves@redhat.com
Tue May 7 14:19:00 GMT 2013


On 05/07/2013 03:08 PM, Pedro Alves wrote:
> On 05/07/2013 02:29 PM, Mike Frysinger wrote:
>>
>> Fortunately, that last header there is pretty damn good -- it handles
>> lots of edge cases, the code is nice & tight (uses gcc asm operands
>> rather than manual movs), and is already almost a general library type
>> header.
> 
> The top of the header says:
> 
> /* Helper file for i386 platform.  Runtime check for MMX/SSE/SSE2/AVX
>  * support. Copied from gcc 4.4.
> 
> I'd rather not fork the gcc file.  If we need to wrap its functions/macros
> for gdb's purpose, I'd rather do that in a separate file that
> #includes (a copy of) gcc's, verbatim, so we can pull updates from upstream
> easily.  In fact, diffing our copy against gcc's shows we're already
> out of date --- see below.  The bits removed are gdb-specific additions.
> 
> I wonder whether pushing the file down to libiberty, so both gcc
> and gdb could share it would be viable?

Actually, it seems like __get_cpuid is a gcc built-in nowadays, but I don't
when it was added.  We could make use of it, and only fallback to the header
copy if the host compiler doesn't have the builtin.

-- 
Pedro Alves



More information about the Gdb-patches mailing list