Re: [patch/rfc] gdb: clean up x86 cpuid implementations

Mike Frysinger
2013-05-06T20:30:27Z

[-- Attachment #1: Type: Text/Plain, Size: 1748 bytes --]

On Monday 06 May 2013 15:44:11 Eli Zaretskii wrote:
> From: Mike Frysinger <vapier@gentoo.org>
> > 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).
>
> Sorry, I don't follow: what workarounds, and why are they needed?

with i386 targets, ebx cannot be an output when building as PIC. if you build
gdb as a PIE, the build fails because some of the code in gdb does exactly
that.

if you look at the test header, you'll see various other workarounds for
different gcc versions and assemblers.

> And what's PIE got to do with the go32 target?

nothing. it just has its own open-coded implementation of cpuid which i
cleaned up to use the new common header.

> The current code in go32-nat.c was tested to work in all the
> environments supported by that target, without GPFaulting or
> triggering any other disasters. I don't think we have the resources
> to repeat all that testing with the new code, which tries to detect
> newer CPUs, and so could trigger SIGILL. So I'd like to leave
> go32-nat.c alone, if possible.

on the flip side, if the new common header was tested, go32-nat (and any other
DOS like target) wouldn't have to do anymore work, and would be easy to use
cpuid in more places.

but in the end, i don't care about dead things like DOS, so if people prefer
to leave the cruft in that one file, i can look the other way while still
cleaning up everything else.
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]