[Bug libgcc/55712] New: cpuinfo.c doesn't compile for x86-64 with medium memory model
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55712 Bug #: 55712 Summary: cpuinfo.c doesn't compile for x86-64 with medium memory model Classification: Unclassified Product: gcc Version: 4.7.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libgcc AssignedTo: unassig...@gcc.gnu.org ReportedBy: l...@rdos.net Building libgcc with a cross-compiler for x86-64, with -fpic and -mcmodel=medium switches fails. Error messages: ../../gcc-work/libgcc/. -I../../../gcc-work/libgcc/../gcc -I../../../gcc-work/libgcc/../include -DHAVE_CC_TLS -o cpuinfo.o -MT cpuinfo.o -MD -MP -MF cpuinfo.dep -c ../../../gcc-work/libgcc/config/i386/cpuinfo.c -fvisibility=hidden -DHIDE_EXPORTS In file included from ../../../gcc-work/libgcc/config/i386/cpuinfo.c:21:0: ../../../gcc-work/libgcc/config/i386/cpuinfo.c: In function 'get_available_features': ../../../gcc-work/libgcc/config/i386/cpuinfo.c:236:7: error: inconsistent operand constraints in an 'asm' __cpuid_count (7, 0, eax, ebx, ecx, edx); ^ ../../../gcc-work/libgcc/static-object.mk:17: recipe for target `cpuinfo.o' failed make[1]: *** [cpuinfo.o] Error 1 make[1]: Lämnar katalogen "/usr/src/build-gcc-noheader/rdos/libgcc" Makefile:10619: recipe for target `all-target-libgcc' failed make: *** [all-target-libgcc] Error 2
[Bug libgcc/55712] cpuinfo.c doesn't compile for x86-64 with medium memory model
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55712 --- Comment #1 from Leif Ekblad 2012-12-23 22:38:31 UTC --- Created attachment 29038 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29038 Save rbx and use another file for ebx parameter to cpuid
[Bug libgcc/55712] cpuinfo.c doesn't compile for x86-64 with medium memory model
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55712 --- Comment #2 from Leif Ekblad 2012-12-23 22:47:13 UTC --- Comment on attachment 29038 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29038 Save rbx and use another file for ebx parameter to cpuid >diff -crNB gcc-4.8-20121216/gcc/config/i386/cpuid.h >gcc-work/gcc/config/i386/cpuid.h >*** gcc-4.8-20121216/gcc/config/i386/cpuid.h 2012-10-26 11:45:46.0 >+0200 >--- gcc-work/gcc/config/i386/cpuid.h 2012-12-23 23:06:08.0 +0100 >*** >*** 166,171 >--- 166,189 > : "0" (level), "2" (count)) > #endif > #else >+ >+ #if defined(__x86_64__) && defined(__PIC__) >+ #define __cpuid(level, a, b, c, d) \ >+ __asm__ ("pushq %%rbx\n\t"\ >+ "cpuid\n\t" \ >+ "movl %%ebx, %1\n\t" \ >+ "popq %%rbx\n\t" \ >+ : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \ >+ : "0" (level)) >+ >+ #define __cpuid_count(level, count, a, b, c, d) \ >+ __asm__ ("pushq %%rbx\n\t"\ >+ "cpuid\n\t" \ >+ "movl %%ebx, %1\n\t" \ >+ "popq %%rbx\n\t" \ >+ : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \ >+ : "0" (level), "2" (count)) >+ #else > #define __cpuid(level, a, b, c, d) \ >__asm__ ("cpuid\n\t" \ > : "=a" (a), "=b" (b), "=c" (c), "=d" (d) \ >*** >*** 176,181 >--- 194,200 > : "=a" (a), "=b" (b), "=c" (c), "=d" (d) \ > : "0" (level), "2" (count)) > #endif >+ #endif > > /* Return highest supported input value for cpuid instruction. ext can > be either 0x0 or 0x800 to return highest supported value for
[Bug libgcc/55712] cpuinfo.c doesn't compile for x86-64 with medium memory model
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55712 Leif Ekblad changed: What|Removed |Added Attachment #29038|0 |1 is obsolete|| --- Comment #3 from Leif Ekblad 2012-12-23 22:49:53 UTC --- Comment on attachment 29038 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29038 Save rbx and use another file for ebx parameter to cpuid >diff -crNB gcc-4.8-20121216/gcc/config/i386/cpuid.h >gcc-work/gcc/config/i386/cpuid.h >*** gcc-4.8-20121216/gcc/config/i386/cpuid.h 2012-10-26 11:45:46.0 >+0200 >--- gcc-work/gcc/config/i386/cpuid.h 2012-12-23 23:06:08.0 +0100 >*** >*** 166,171 >--- 166,189 > : "0" (level), "2" (count)) > #endif > #else >+ >+ #if defined(__x86_64__) && defined(__PIC__) >+ #define __cpuid(level, a, b, c, d) \ >+ __asm__ ("pushq %%rbx\n\t"\ >+ "cpuid\n\t" \ >+ "movl %%ebx, %1\n\t" \ >+ "popq %%rbx\n\t" \ >+ : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \ >+ : "0" (level)) >+ >+ #define __cpuid_count(level, count, a, b, c, d) \ >+ __asm__ ("pushq %%rbx\n\t"\ >+ "cpuid\n\t" \ >+ "movl %%ebx, %1\n\t" \ >+ "popq %%rbx\n\t" \ >+ : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \ >+ : "0" (level), "2" (count)) >+ #else > #define __cpuid(level, a, b, c, d) \ >__asm__ ("cpuid\n\t" \ > : "=a" (a), "=b" (b), "=c" (c), "=d" (d) \ >*** >*** 176,181 >--- 194,200 > : "=a" (a), "=b" (b), "=c" (c), "=d" (d) \ > : "0" (level), "2" (count)) > #endif >+ #endif > > /* Return highest supported input value for cpuid instruction. ext can > be either 0x0 or 0x800 to return highest supported value for
[Bug libgcc/55712] cpuinfo.c doesn't compile for x86-64 with medium memory model
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55712 --- Comment #4 from Leif Ekblad 2012-12-23 22:50:51 UTC --- Created attachment 29039 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29039 Patch that uses other register than rbx for cpuid.
[Bug target/55712] cpuinfo.c doesn't compile for x86-64 with medium memory model
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55712 --- Comment #6 from Leif Ekblad 2012-12-24 17:53:00 UTC --- Confirmed to work with medium memory model (x86_64-pc-rdos).