public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/63228] New: -m16 doesn't work if gcc is compiled for x32
@ 2014-09-11 18:25 mikulas at artax dot karlin.mff.cuni.cz
  2014-09-11 19:53 ` [Bug target/63228] " hjl.tools at gmail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: mikulas at artax dot karlin.mff.cuni.cz @ 2014-09-11 18:25 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63228

            Bug ID: 63228
           Summary: -m16 doesn't work if gcc is compiled for x32
           Product: gcc
           Version: 4.9.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mikulas at artax dot karlin.mff.cuni.cz
              Host: x86_64-linux-gnux32
            Target: x86_64-linux-gnux32
             Build: x86_64-linux-gnux32

When gcc is configured and compiled for x32 mode (x86_64-linux-gnux32 triplet),
the flag -m16 doesn't work. The bug was reproduced on gcc-4.9.1-13 from Debian
Ports x32 distribution (https://wiki.debian.org/X32Port)

Attempting to compile or assemble anything with "gcc -m16 -march=i386" results
in this error message:
error: CPU you selected does not support x86-64 instruction set
(this error causes linux kernel 3.16.2 compilation failure)

If you remove "-march=i386", the file is compiled, but it can't be assembled,
because gcc generates incorrect assembler as if it was x86_64 target. For
example, compiling a file test.c containing "int bla(void) { return 3; }" with
"gcc -c -m16 test.c", results in these error messages:
/tmp/cc89iTZG.s: Assembler messages:
/tmp/cc89iTZG.s:9: Error: bad register name `%rbp'
/tmp/cc89iTZG.s:15: Error: bad register name `%rbp'

When gcc is configured for x86_64 mode (x86_64-unknown-linux-gnu), -m16 works
correctly.


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

* [Bug target/63228] -m16 doesn't work if gcc is compiled for x32
  2014-09-11 18:25 [Bug target/63228] New: -m16 doesn't work if gcc is compiled for x32 mikulas at artax dot karlin.mff.cuni.cz
@ 2014-09-11 19:53 ` hjl.tools at gmail dot com
  2014-09-11 22:18 ` hjl at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: hjl.tools at gmail dot com @ 2014-09-11 19:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63228

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-09-11
                 CC|                            |hjl.tools at gmail dot com
   Target Milestone|---                         |4.9.2
     Ever confirmed|0                           |1

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
A patch is posted at

https://gcc.gnu.org/ml/gcc-patches/2014-09/msg00987.html


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

* [Bug target/63228] -m16 doesn't work if gcc is compiled for x32
  2014-09-11 18:25 [Bug target/63228] New: -m16 doesn't work if gcc is compiled for x32 mikulas at artax dot karlin.mff.cuni.cz
  2014-09-11 19:53 ` [Bug target/63228] " hjl.tools at gmail dot com
@ 2014-09-11 22:18 ` hjl at gcc dot gnu.org
  2014-09-11 22:28 ` hjl at gcc dot gnu.org
  2014-09-11 22:29 ` hjl.tools at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: hjl at gcc dot gnu.org @ 2014-09-11 22:18 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63228

--- Comment #2 from hjl at gcc dot gnu.org <hjl at gcc dot gnu.org> ---
Author: hjl
Date: Thu Sep 11 22:18:06 2014
New Revision: 215194

URL: https://gcc.gnu.org/viewcvs?rev=215194&root=gcc&view=rev
Log:
Also turn off OPTION_MASK_ABI_X32 for -m16

    PR target/63228
    * config/i386/i386.c (ix86_option_override_internal): Also turn
    off OPTION_MASK_ABI_X32 for -m16.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/i386/i386.c


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

* [Bug target/63228] -m16 doesn't work if gcc is compiled for x32
  2014-09-11 18:25 [Bug target/63228] New: -m16 doesn't work if gcc is compiled for x32 mikulas at artax dot karlin.mff.cuni.cz
  2014-09-11 19:53 ` [Bug target/63228] " hjl.tools at gmail dot com
  2014-09-11 22:18 ` hjl at gcc dot gnu.org
@ 2014-09-11 22:28 ` hjl at gcc dot gnu.org
  2014-09-11 22:29 ` hjl.tools at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: hjl at gcc dot gnu.org @ 2014-09-11 22:28 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63228

--- Comment #3 from hjl at gcc dot gnu.org <hjl at gcc dot gnu.org> ---
Author: hjl
Date: Thu Sep 11 22:28:16 2014
New Revision: 215195

URL: https://gcc.gnu.org/viewcvs?rev=215195&root=gcc&view=rev
Log:
Also turn off OPTION_MASK_ABI_X32 for -m16

    Backport from mainline
    PR target/63228
    * config/i386/i386.c (ix86_option_override_internal): Also turn
    off OPTION_MASK_ABI_X32 for -m16.

Modified:
    branches/gcc-4_9-branch/gcc/ChangeLog
    branches/gcc-4_9-branch/gcc/config/i386/i386.c


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

* [Bug target/63228] -m16 doesn't work if gcc is compiled for x32
  2014-09-11 18:25 [Bug target/63228] New: -m16 doesn't work if gcc is compiled for x32 mikulas at artax dot karlin.mff.cuni.cz
                   ` (2 preceding siblings ...)
  2014-09-11 22:28 ` hjl at gcc dot gnu.org
@ 2014-09-11 22:29 ` hjl.tools at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: hjl.tools at gmail dot com @ 2014-09-11 22:29 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63228

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from H.J. Lu <hjl.tools at gmail dot com> ---
Fixed.


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

end of thread, other threads:[~2014-09-11 22:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-11 18:25 [Bug target/63228] New: -m16 doesn't work if gcc is compiled for x32 mikulas at artax dot karlin.mff.cuni.cz
2014-09-11 19:53 ` [Bug target/63228] " hjl.tools at gmail dot com
2014-09-11 22:18 ` hjl at gcc dot gnu.org
2014-09-11 22:28 ` hjl at gcc dot gnu.org
2014-09-11 22:29 ` hjl.tools 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).