public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgcc/55712] New: cpuinfo.c doesn't compile for x86-64 with medium memory model
@ 2012-12-16  9:30 leif at rdos dot net
  2012-12-23 22:38 ` [Bug libgcc/55712] " leif at rdos dot net
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: leif at rdos dot net @ 2012-12-16  9:30 UTC (permalink / raw)
  To: gcc-bugs


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: unassigned@gcc.gnu.org
        ReportedBy: leif@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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libgcc/55712] cpuinfo.c doesn't compile for x86-64 with medium memory model
  2012-12-16  9:30 [Bug libgcc/55712] New: cpuinfo.c doesn't compile for x86-64 with medium memory model leif at rdos dot net
@ 2012-12-23 22:38 ` leif at rdos dot net
  2012-12-23 22:47 ` leif at rdos dot net
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: leif at rdos dot net @ 2012-12-23 22:38 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55712

--- Comment #1 from Leif Ekblad <leif at rdos dot net> 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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libgcc/55712] cpuinfo.c doesn't compile for x86-64 with medium memory model
  2012-12-16  9:30 [Bug libgcc/55712] New: cpuinfo.c doesn't compile for x86-64 with medium memory model leif at rdos dot net
  2012-12-23 22:38 ` [Bug libgcc/55712] " leif at rdos dot net
@ 2012-12-23 22:47 ` leif at rdos dot net
  2012-12-23 22:50 ` leif at rdos dot net
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: leif at rdos dot net @ 2012-12-23 22:47 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55712

--- Comment #2 from Leif Ekblad <leif at rdos dot net> 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.000000000 +0200
>--- gcc-work/gcc/config/i386/cpuid.h	2012-12-23 23:06:08.000000000 +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 0x8000000 to return highest supported value for


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libgcc/55712] cpuinfo.c doesn't compile for x86-64 with medium memory model
  2012-12-16  9:30 [Bug libgcc/55712] New: cpuinfo.c doesn't compile for x86-64 with medium memory model leif at rdos dot net
  2012-12-23 22:38 ` [Bug libgcc/55712] " leif at rdos dot net
  2012-12-23 22:47 ` leif at rdos dot net
@ 2012-12-23 22:50 ` leif at rdos dot net
  2012-12-23 22:51 ` leif at rdos dot net
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: leif at rdos dot net @ 2012-12-23 22:50 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55712

Leif Ekblad <leif at rdos dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #29038|0                           |1
        is obsolete|                            |

--- Comment #3 from Leif Ekblad <leif at rdos dot net> 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.000000000 +0200
>--- gcc-work/gcc/config/i386/cpuid.h	2012-12-23 23:06:08.000000000 +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 0x8000000 to return highest supported value for


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libgcc/55712] cpuinfo.c doesn't compile for x86-64 with medium memory model
  2012-12-16  9:30 [Bug libgcc/55712] New: cpuinfo.c doesn't compile for x86-64 with medium memory model leif at rdos dot net
                   ` (2 preceding siblings ...)
  2012-12-23 22:50 ` leif at rdos dot net
@ 2012-12-23 22:51 ` leif at rdos dot net
  2012-12-24 15:43 ` [Bug target/55712] " ubizjak at gmail dot com
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: leif at rdos dot net @ 2012-12-23 22:51 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55712

--- Comment #4 from Leif Ekblad <leif at rdos dot net> 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.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/55712] cpuinfo.c doesn't compile for x86-64 with medium memory model
  2012-12-16  9:30 [Bug libgcc/55712] New: cpuinfo.c doesn't compile for x86-64 with medium memory model leif at rdos dot net
                   ` (3 preceding siblings ...)
  2012-12-23 22:51 ` leif at rdos dot net
@ 2012-12-24 15:43 ` ubizjak at gmail dot com
  2012-12-24 17:53 ` leif at rdos dot net
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: ubizjak at gmail dot com @ 2012-12-24 15:43 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55712

Uros Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
                URL|                            |http://gcc.gnu.org/ml/gcc-p
                   |                            |atches/2012-12/msg01391.htm
                   |                            |l
           Keywords|ra                          |
   Last reconfirmed|                            |2012-12-24
          Component|libgcc                      |target
         AssignedTo|unassigned at gcc dot       |ubizjak at gmail dot com
                   |gnu.org                     |
     Ever Confirmed|0                           |1
   Target Milestone|---                         |4.8.0

--- Comment #5 from Uros Bizjak <ubizjak at gmail dot com> 2012-12-24 15:43:02 UTC ---
Please try patch at [1]

[1] http://gcc.gnu.org/ml/gcc-patches/2012-12/msg01391.html


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/55712] cpuinfo.c doesn't compile for x86-64 with medium memory model
  2012-12-16  9:30 [Bug libgcc/55712] New: cpuinfo.c doesn't compile for x86-64 with medium memory model leif at rdos dot net
                   ` (4 preceding siblings ...)
  2012-12-24 15:43 ` [Bug target/55712] " ubizjak at gmail dot com
@ 2012-12-24 17:53 ` leif at rdos dot net
  2012-12-27  8:12 ` ubizjak at gmail dot com
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: leif at rdos dot net @ 2012-12-24 17:53 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55712

--- Comment #6 from Leif Ekblad <leif at rdos dot net> 2012-12-24 17:53:00 UTC ---
Confirmed to work with medium memory model (x86_64-pc-rdos).


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/55712] cpuinfo.c doesn't compile for x86-64 with medium memory model
  2012-12-16  9:30 [Bug libgcc/55712] New: cpuinfo.c doesn't compile for x86-64 with medium memory model leif at rdos dot net
                   ` (5 preceding siblings ...)
  2012-12-24 17:53 ` leif at rdos dot net
@ 2012-12-27  8:12 ` ubizjak at gmail dot com
  2013-01-03 17:17 ` uros at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: ubizjak at gmail dot com @ 2012-12-27  8:12 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55712

Uros Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #29039|0                           |1
        is obsolete|                            |

--- Comment #7 from Uros Bizjak <ubizjak at gmail dot com> 2012-12-27 08:11:40 UTC ---
Created attachment 29053
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29053
Patch that preserves %rbx over cpuid insn

Alternative patch that avoids changing %rbx PIC register.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/55712] cpuinfo.c doesn't compile for x86-64 with medium memory model
  2012-12-16  9:30 [Bug libgcc/55712] New: cpuinfo.c doesn't compile for x86-64 with medium memory model leif at rdos dot net
                   ` (6 preceding siblings ...)
  2012-12-27  8:12 ` ubizjak at gmail dot com
@ 2013-01-03 17:17 ` uros at gcc dot gnu.org
  2013-01-06  8:46 ` uros at gcc dot gnu.org
  2013-01-06  9:16 ` ubizjak at gmail dot com
  9 siblings, 0 replies; 11+ messages in thread
From: uros at gcc dot gnu.org @ 2013-01-03 17:17 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55712

--- Comment #8 from uros at gcc dot gnu.org 2013-01-03 17:16:30 UTC ---
Author: uros
Date: Thu Jan  3 17:16:08 2013
New Revision: 194862

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194862
Log:
    PR target/55712
    * config/i386/i386-c.c (ix86_target_macros_internal): Depending on
    selected code model, define __code_mode_small__, __code_model_medium__,
    __code_model_large__, __code_model_32__ or __code_model_kernel__.
    * config/i386/cpuid.h (__cpuid, __cpuid_count) [__i386__]: Prefix
    xchg temporary register with %k.  Declare temporary register as
    early clobbered.
    [__x86_64__]: For medium and large code models, preserve %rbx register.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/i386/cpuid.h
    trunk/gcc/config/i386/i386-c.c


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/55712] cpuinfo.c doesn't compile for x86-64 with medium memory model
  2012-12-16  9:30 [Bug libgcc/55712] New: cpuinfo.c doesn't compile for x86-64 with medium memory model leif at rdos dot net
                   ` (7 preceding siblings ...)
  2013-01-03 17:17 ` uros at gcc dot gnu.org
@ 2013-01-06  8:46 ` uros at gcc dot gnu.org
  2013-01-06  9:16 ` ubizjak at gmail dot com
  9 siblings, 0 replies; 11+ messages in thread
From: uros at gcc dot gnu.org @ 2013-01-06  8:46 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55712

--- Comment #9 from uros at gcc dot gnu.org 2013-01-06 08:45:48 UTC ---
Author: uros
Date: Sun Jan  6 08:45:43 2013
New Revision: 194937

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194937
Log:
    Backport from mainline
    2013-01-03  Uros Bizjak  <ubizjak@gmail.com>

    PR target/55712
    * config/i386/i386-c.c (ix86_target_macros_internal): Depending on
    selected code model, define __code_mode_small__, __code_model_medium__,
    __code_model_large__, __code_model_32__ or __code_model_kernel__.
    * config/i386/cpuid.h (__cpuid, __cpuid_count) [__i386__]: Prefix
    xchg temporary register with %k.  Declare temporary register as
    early clobbered.
    [__x86_64__]: For medium and large code models, preserve %rbx register.


Modified:
    branches/gcc-4_7-branch/gcc/ChangeLog
    branches/gcc-4_7-branch/gcc/config/i386/cpuid.h
    branches/gcc-4_7-branch/gcc/config/i386/i386-c.c


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/55712] cpuinfo.c doesn't compile for x86-64 with medium memory model
  2012-12-16  9:30 [Bug libgcc/55712] New: cpuinfo.c doesn't compile for x86-64 with medium memory model leif at rdos dot net
                   ` (8 preceding siblings ...)
  2013-01-06  8:46 ` uros at gcc dot gnu.org
@ 2013-01-06  9:16 ` ubizjak at gmail dot com
  9 siblings, 0 replies; 11+ messages in thread
From: ubizjak at gmail dot com @ 2013-01-06  9:16 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55712

Uros Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
                URL|http://gcc.gnu.org/ml/gcc-p |http://gcc.gnu.org/ml/gcc-p
                   |atches/2012-12/msg01391.htm |atches/2012-12/msg01484.htm
                   |l                           |l
         Resolution|                            |FIXED
   Target Milestone|4.8.0                       |4.7.3

--- Comment #10 from Uros Bizjak <ubizjak at gmail dot com> 2013-01-06 09:15:43 UTC ---
Fixed.


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2013-01-06  9:16 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-16  9:30 [Bug libgcc/55712] New: cpuinfo.c doesn't compile for x86-64 with medium memory model leif at rdos dot net
2012-12-23 22:38 ` [Bug libgcc/55712] " leif at rdos dot net
2012-12-23 22:47 ` leif at rdos dot net
2012-12-23 22:50 ` leif at rdos dot net
2012-12-23 22:51 ` leif at rdos dot net
2012-12-24 15:43 ` [Bug target/55712] " ubizjak at gmail dot com
2012-12-24 17:53 ` leif at rdos dot net
2012-12-27  8:12 ` ubizjak at gmail dot com
2013-01-03 17:17 ` uros at gcc dot gnu.org
2013-01-06  8:46 ` uros at gcc dot gnu.org
2013-01-06  9:16 ` ubizjak at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).