diff mbox

[i386,PR,driver/66737] Don't pass '-z bndplt' to linker for 32bit target

Message ID 20150720124233.GA65017@msticlxl57.ims.intel.com
State New
Headers show

Commit Message

Ilya Enkovich July 20, 2015, 12:42 p.m. UTC
Hi,

This patch adds a target filter for '-z bndplt' linker option.  Bootstrapped and regtested for x86_64-unknown-linux-gnu.  MPX tests at lto.exp are not marked as unsupported for 32bit any more.  Going to commit it to trunk in a few days if no obections appear.

Thanks,
Ilya
--
gcc/

2015-07-20  Ilya Enkovich  <enkovich.gnu@gmail.com>

	PR target/66737
	* config/i386/linux-common.h (MPX_SPEC): Use linker option
	for 64bit target only.

Comments

H.J. Lu July 20, 2015, 8:57 p.m. UTC | #1
On Mon, Jul 20, 2015 at 5:42 AM, Ilya Enkovich <enkovich.gnu@gmail.com> wrote:
> Hi,
>
> This patch adds a target filter for '-z bndplt' linker option.  Bootstrapped and regtested for x86_64-unknown-linux-gnu.  MPX tests at lto.exp are not marked as unsupported for 32bit any more.  Going to commit it to trunk in a few days if no obections appear.
>
> Thanks,
> Ilya
> --
> gcc/
>
> 2015-07-20  Ilya Enkovich  <enkovich.gnu@gmail.com>
>
>         PR target/66737
>         * config/i386/linux-common.h (MPX_SPEC): Use linker option
>         for 64bit target only.
>
>
> diff --git a/gcc/config/i386/linux-common.h b/gcc/config/i386/linux-common.h
> index 63dd8d8..da09d3d 100644
> --- a/gcc/config/i386/linux-common.h
> +++ b/gcc/config/i386/linux-common.h
> @@ -72,7 +72,7 @@ along with GCC; see the file COPYING3.  If not see
>
>  #ifndef MPX_SPEC
>  #define MPX_SPEC "\
> - %{mmpx:%{fcheck-pointer-bounds:%{!static:" LINK_MPX "}}}"
> + %{mmpx:%{fcheck-pointer-bounds:%{!static:%{" SPEC_64 ":" LINK_MPX "}}}}"
>  #endif
>
>  #ifndef LIBMPX_SPEC

This doesn't build on Linux/ia32:

In file included from ./tm.h:36:0,
                 from /export/gnu/import/git/sources/gcc/gcc/gcc.c:34:
/export/gnu/import/git/sources/gcc/gcc/config/i386/linux-common.h:75:47:
error: expected ‘,’ or ‘;’ before ‘SPEC_64’
  %{mmpx:%{fcheck-pointer-bounds:%{!static:%{" SPEC_64 ":" LINK_MPX "}}}}"

SPEC_64 may not be defined.  You should use

#ifndef MPX_SPEC
#ifdef SPEC_64
#define MPX_SPEC "\
 %{mmpx:%{fcheck-pointer-bounds:%{!static:%{" SPEC_64 ":" LINK_MPX "}}}}"
#else
#define MPX_SPEC "\
 %{mmpx:%{fcheck-pointer-bounds}}"
#endif
#endif
H.J. Lu July 20, 2015, 9:26 p.m. UTC | #2
On Mon, Jul 20, 2015 at 1:57 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Mon, Jul 20, 2015 at 5:42 AM, Ilya Enkovich <enkovich.gnu@gmail.com> wrote:
>> Hi,
>>
>> This patch adds a target filter for '-z bndplt' linker option.  Bootstrapped and regtested for x86_64-unknown-linux-gnu.  MPX tests at lto.exp are not marked as unsupported for 32bit any more.  Going to commit it to trunk in a few days if no obections appear.
>>
>> Thanks,
>> Ilya
>> --
>> gcc/
>>
>> 2015-07-20  Ilya Enkovich  <enkovich.gnu@gmail.com>
>>
>>         PR target/66737
>>         * config/i386/linux-common.h (MPX_SPEC): Use linker option
>>         for 64bit target only.
>>
>>
>> diff --git a/gcc/config/i386/linux-common.h b/gcc/config/i386/linux-common.h
>> index 63dd8d8..da09d3d 100644
>> --- a/gcc/config/i386/linux-common.h
>> +++ b/gcc/config/i386/linux-common.h
>> @@ -72,7 +72,7 @@ along with GCC; see the file COPYING3.  If not see
>>
>>  #ifndef MPX_SPEC
>>  #define MPX_SPEC "\
>> - %{mmpx:%{fcheck-pointer-bounds:%{!static:" LINK_MPX "}}}"
>> + %{mmpx:%{fcheck-pointer-bounds:%{!static:%{" SPEC_64 ":" LINK_MPX "}}}}"
>>  #endif
>>
>>  #ifndef LIBMPX_SPEC
>
> This doesn't build on Linux/ia32:
>
> In file included from ./tm.h:36:0,
>                  from /export/gnu/import/git/sources/gcc/gcc/gcc.c:34:
> /export/gnu/import/git/sources/gcc/gcc/config/i386/linux-common.h:75:47:
> error: expected ‘,’ or ‘;’ before ‘SPEC_64’
>   %{mmpx:%{fcheck-pointer-bounds:%{!static:%{" SPEC_64 ":" LINK_MPX "}}}}"
>
> SPEC_64 may not be defined.  You should use
>
> #ifndef MPX_SPEC
> #ifdef SPEC_64
> #define MPX_SPEC "\
>  %{mmpx:%{fcheck-pointer-bounds:%{!static:%{" SPEC_64 ":" LINK_MPX "}}}}"
> #else
> #define MPX_SPEC "\
>  %{mmpx:%{fcheck-pointer-bounds}}"
> #endif
> #endif

This won't work either..  Here is a working one:

#ifndef MPX_SPEC
#ifdef SPEC_64
#define MPX_SPEC "\
 %{mmpx:%{fcheck-pointer-bounds:%{!static:%{" SPEC_64 ":" LINK_MPX "}}}}"
#else
#define MPX_SPEC ""
#endif
#endif
diff mbox

Patch

diff --git a/gcc/config/i386/linux-common.h b/gcc/config/i386/linux-common.h
index 63dd8d8..da09d3d 100644
--- a/gcc/config/i386/linux-common.h
+++ b/gcc/config/i386/linux-common.h
@@ -72,7 +72,7 @@  along with GCC; see the file COPYING3.  If not see
 
 #ifndef MPX_SPEC
 #define MPX_SPEC "\
- %{mmpx:%{fcheck-pointer-bounds:%{!static:" LINK_MPX "}}}"
+ %{mmpx:%{fcheck-pointer-bounds:%{!static:%{" SPEC_64 ":" LINK_MPX "}}}}"
 #endif
 
 #ifndef LIBMPX_SPEC