This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [MPX] Fix for PR77267
- From: Ilya Enkovich <enkovich dot gnu at gmail dot com>
- To: Alexander Ivchenko <aivchenk at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, "H.J. Lu" <hjl dot tools at gmail dot com>
- Date: Mon, 29 Aug 2016 13:09:38 +0300
- Subject: Re: [MPX] Fix for PR77267
- Authentication-results: sourceware.org; auth=none
- References: <CACysShgQsjKUxkLcEs2BeBCL8zbVmFpL3_uRK_e5Aw0aObp1cA@mail.gmail.com>
2016-08-25 12:27 GMT+03:00 Alexander Ivchenko <aivchenk@gmail.com>:
> The attached patched fixes the usage of MPX in presence of
> "-Wl,-as-needed" option. 'make checked' on MPX-enabled machine.
>
> "--push-state" and "--pop-state" are not supported by gold at the
> moment. But that's OK because using MPX with gold only recommended in
> static build.
What will happen if compiler is configured to use gold by default?
Also is there any chance
we may use old linker with no push-state/pop-state support? I wonder
if you need to make
a new configure check and emit a warning similar to what is done for
"-z bndplt" option.
Thanks,
Ilya
>
> Would that be OK for trunk?
>
> diff --git a/gcc/config/i386/linux-common.h b/gcc/config/i386/linux-common.h
> index dd79ec6..1928b4e 100644
> --- a/gcc/config/i386/linux-common.h
> +++ b/gcc/config/i386/linux-common.h
> @@ -70,7 +70,9 @@ along with GCC; see the file COPYING3. If not see
> %{mmpx:%{fcheck-pointer-bounds:\
> %{static:--whole-archive -lmpx --no-whole-archive" LIBMPX_LIBS "}\
> %{!static:%{static-libmpx:" LD_STATIC_OPTION " --whole-archive}\
> - -lmpx %{static-libmpx:--no-whole-archive " LD_DYNAMIC_OPTION \
> + %{!fuse-ld=gold:--push-state --no-as-needed} -lmpx\
> + %{!fuse-ld=gold:--pop-state} %{static-libmpx:--no-whole-archive "\
> + LD_DYNAMIC_OPTION \
> LIBMPX_LIBS "}}}}"
> #else
> #define LIBMPX_SPEC "\
> @@ -84,7 +86,8 @@ along with GCC; see the file COPYING3. If not see
> %{mmpx:%{fcheck-pointer-bounds:%{!fno-chkp-use-wrappers:\
> %{static:-lmpxwrappers}\
> %{!static:%{static-libmpxwrappers:" LD_STATIC_OPTION " --whole-archive}\
> - -lmpxwrappers %{static-libmpxwrappers:--no-whole-archive "\
> + %{!fuse-ld=gold:--push-state --no-as-needed} -lmpxwrappers\
> + %{!fuse-ld=gold:--pop-state} %{static-libmpxwrappers:--no-whole-archive "\
> LD_DYNAMIC_OPTION "}}}}}"
> #else
> #define LIBMPXWRAPPERS_SPEC "\
> .