diff mbox

PATCH: PR target/63228: -m16 doesn't work if gcc is compiled for x32

Message ID 20140911195216.GA27037@intel.com
State New
Headers show

Commit Message

H.J. Lu Sept. 11, 2014, 7:52 p.m. UTC
ix86_option_override_internal turns off OPTION_MASK_ABI_X32 for -m64
when TARGET_BI_ARCH == 2.  But it fails to do so for -m16.  This patch
also turns off OPTION_MASK_ABI_X32 for -m16.  OK for trunk and 4.9
branch after testing on Linux/x86-64 with -mx32?

Thanks.

H.J.
--
2014-09-11  H.J. Lu  <hongjiu.lu@intel.com>

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

Comments

Uros Bizjak Sept. 11, 2014, 8:26 p.m. UTC | #1
On Thu, Sep 11, 2014 at 9:52 PM, H.J. Lu <hongjiu.lu@intel.com> wrote:
> ix86_option_override_internal turns off OPTION_MASK_ABI_X32 for -m64
> when TARGET_BI_ARCH == 2.  But it fails to do so for -m16.  This patch
> also turns off OPTION_MASK_ABI_X32 for -m16.  OK for trunk and 4.9
> branch after testing on Linux/x86-64 with -mx32?
>
> Thanks.
>
> H.J.
> --
> 2014-09-11  H.J. Lu  <hongjiu.lu@intel.com>
>
>         PR target/63228
>         * config/i386/i386.c (ix86_option_override_internal): Also turn
>         off OPTION_MASK_ABI_X32 for -m16.

OK.

Thanks,
Uros.
diff mbox

Patch

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 8f45e52..cb308c9 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -3346,8 +3346,9 @@  ix86_option_override_internal (bool main_args_p,
       /* When TARGET_BI_ARCH == 2, by default, OPTION_MASK_ABI_X32 is
 	 on and OPTION_MASK_ABI_64 is off.  We turn off
 	 OPTION_MASK_ABI_X32 if OPTION_MASK_ABI_64 is turned on by
-	 -m64.  */
-      if (TARGET_LP64_P (opts->x_ix86_isa_flags))
+	 -m64 or OPTION_MASK_CODE16 is turned on by -m16.  */
+      if (TARGET_LP64_P (opts->x_ix86_isa_flags)
+	  || TARGET_16BIT_P (opts->x_ix86_isa_flags))
 	opts->x_ix86_isa_flags &= ~OPTION_MASK_ABI_X32;
 #endif
     }