aboutsummaryrefslogtreecommitdiff
path: root/libiberty
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2013-06-19 22:29:36 +0000
committerMike Frysinger <vapier@gentoo.org>2013-06-19 22:29:36 +0000
commit4d157a3dbec7c227678793daba16f2972d1f85d5 (patch)
treedb60be68b6c6e76ceae802ed2430cba2fd47ca09 /libiberty
parent1ce4db08a4b344e9c7ff5bbe2bc0361656652cb4 (diff)
downloadgdb-4d157a3dbec7c227678793daba16f2972d1f85d5.zip
gdb-4d157a3dbec7c227678793daba16f2972d1f85d5.tar.gz
gdb-4d157a3dbec7c227678793daba16f2972d1f85d5.tar.bz2
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>
Diffstat (limited to 'libiberty')
0 files changed, 0 insertions, 0 deletions