mirror of
https://github.com/golang/go
synced 2024-11-23 00:10:07 -07:00
cmd/dist: avoid using %ebx on i386.
Or gcc (-fPIC) will complain: cmd/dist/unix.c: In function ‘cansse2’ cmd/dist/unix.c:774: error: can't find a register in class ‘BREG’ while reloading ‘asm’ cmd/dist/unix.c:774: error: ‘asm’ operand has impossible constraints This affects bootstrapping on native Darwin/386 where all code is compiled with -fPIC. R=golang-dev, iant CC=golang-dev https://golang.org/cl/7394047
This commit is contained in:
parent
c5f5df4d98
commit
89ec3a610d
10
src/cmd/dist/unix.c
vendored
10
src/cmd/dist/unix.c
vendored
@ -770,7 +770,15 @@ sigillhand(int signum)
|
|||||||
static void
|
static void
|
||||||
__cpuid(int dst[4], int ax)
|
__cpuid(int dst[4], int ax)
|
||||||
{
|
{
|
||||||
#if defined(__i386__) || defined(__x86_64__)
|
#ifdef __i386__
|
||||||
|
// we need to avoid ebx on i386 (esp. when -fPIC).
|
||||||
|
asm volatile(
|
||||||
|
"mov %%ebx, %%edi\n\t"
|
||||||
|
"cpuid\n\t"
|
||||||
|
"xchgl %%ebx, %%edi"
|
||||||
|
: "=a" (dst[0]), "=D" (dst[1]), "=c" (dst[2]), "=d" (dst[3])
|
||||||
|
: "0" (ax));
|
||||||
|
#elif defined(__x86_64__)
|
||||||
asm volatile("cpuid"
|
asm volatile("cpuid"
|
||||||
: "=a" (dst[0]), "=b" (dst[1]), "=c" (dst[2]), "=d" (dst[3])
|
: "=a" (dst[0]), "=b" (dst[1]), "=c" (dst[2]), "=d" (dst[3])
|
||||||
: "0" (ax));
|
: "0" (ax));
|
||||||
|
Loading…
Reference in New Issue
Block a user