binutils-gdb/gdb/testsuite
Mike Frysinger 4d157a3dbe gdb: clean up x86 cpuid implementations
We've currently got 3 files doing open coded implementations of cpuid.
Each has its own set of workarounds and varying levels of how well
they're written and are generally hardcoded to specific cpuid functions.
If you try to build the latest gdb as a PIE on an i386 system, the build
will fail because one of them lacks PIC workarounds (wrt ebx).

Specifically, we have:
common/linux-btrace.c:
	two copies of cpuid asm w/specific args, one has no workarounds
	while the other implicitly does to avoid memcpy
go32-nat.c:
	two copies of cpuid asm w/specific args, one has workarounds to
	avoid memcpy
gdb/testsuite/gdb.arch/i386-cpuid.h:
	one general cpuid asm w/many workarounds copied from older gcc

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.  It's also the basis of what is now the public cpuid.h that is
shipped with gcc-4.3+.

So what I've done is pull that test header out and into gdb/common/
(not sure if there's a better place), synced to the version found in
gcc-4.8.0, put a wrapper API around it, and then cut over all the
existing call points to this new header.

Since the func already has support for "is cpuid supported on this proc",
it makes it trivial to push the i386/x86_64 ifdefs down into this wrapper
API too.  Now it can be safely used for all targets and gcc will elide
the unused code for us.

I've verified the gdb.arch testsuite still passes, and this code compiles
for an armv7a host as well as x86_64.  The go32-nat code has been left
ifdef-ed out until someone can test & verify the new stuff works (and if
it doesn't, figure out how to make the new code work).

URL: https://bugs.gentoo.org/467806
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-06-19 22:29:36 +00:00
..
boards Remove superfluous semicolons from testsuite throughout. 2013-06-07 17:31:09 +00:00
config Remove superfluous semicolons from testsuite throughout. 2013-06-07 17:31:09 +00:00
gdb.ada Fix formating in copyright headers. 2013-06-07 14:39:33 +00:00
gdb.arch gdb: clean up x86 cpuid implementations 2013-06-19 22:29:36 +00:00
gdb.asm Remove superfluous semicolons from testsuite throughout. 2013-06-07 17:31:09 +00:00
gdb.base * gdb.base/subst.exp: Delete default rules before further 2013-06-19 20:37:26 +00:00
gdb.btrace record-btrace: fix assertion when enabling recording after re-run 2013-03-26 07:15:09 +00:00
gdb.cell
gdb.cp Remove superfluous semicolons from testsuite throughout. 2013-06-07 17:31:09 +00:00
gdb.disasm Remove superfluous semicolons from testsuite throughout. 2013-06-07 17:31:09 +00:00
gdb.dwarf2 Fix PR symtab/15391 2013-06-18 18:11:19 +00:00
gdb.fortran
gdb.gdb fix python-selftest.exp failure with gdbserver 2013-06-18 14:12:09 +00:00
gdb.go
gdb.hp Remove superfluous semicolons from testsuite throughout. 2013-06-07 17:31:09 +00:00
gdb.java Fix formating in copyright headers. 2013-06-07 14:39:33 +00:00
gdb.linespec gdb/ 2013-05-07 17:04:29 +00:00
gdb.mi Remove superfluous semicolons from testsuite throughout. 2013-06-07 17:31:09 +00:00
gdb.modula2
gdb.multi
gdb.objc
gdb.opencl
gdb.opt
gdb.pascal Remove superfluous semicolons from testsuite throughout. 2013-06-07 17:31:09 +00:00
gdb.python Remove superfluous semicolons from testsuite throughout. 2013-06-07 17:31:09 +00:00
gdb.reverse * gdb.reverse/shr.h: New file. 2013-05-06 22:07:13 +00:00
gdb.server gdb/testsuite/ 2013-04-09 15:26:44 +00:00
gdb.stabs
gdb.threads Remove superfluous semicolons from testsuite throughout. 2013-06-07 17:31:09 +00:00
gdb.trace Remove superfluous semicolons from testsuite throughout. 2013-06-07 17:31:09 +00:00
gdb.xml 2013-05-06 Sandra Loosemore <sandra@codesourcery.com> 2013-05-07 01:12:41 +00:00
lib Fix PR symtab/15391 2013-06-18 18:11:19 +00:00
aclocal.m4
ChangeLog gdb: clean up x86 cpuid implementations 2013-06-19 22:29:36 +00:00
configure Add tests for the new record-btrace target. 2013-03-11 08:59:00 +00:00
configure.ac Add tests for the new record-btrace target. 2013-03-11 08:59:00 +00:00
dg-extract-results.sh Merge dg-extract-results.sh from gcc upstream (svn 195224). 2013-01-17 14:31:11 +00:00
Makefile.in Add tests for the new record-btrace target. 2013-03-11 08:59:00 +00:00
TODO