This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, libmpx, i386, PR driver/65444] Pass '-z bndplt' when building dynamic objects with MPX
- From: Ilya Enkovich <enkovich dot gnu at gmail dot com>
- To: Sandra Loosemore <sandra at codesourcery dot com>
- Cc: Joseph Myers <joseph at codesourcery dot com>, Richard Biener <rguenther at suse dot de>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 6 Apr 2015 18:17:42 +0300
- Subject: Re: [PATCH, libmpx, i386, PR driver/65444] Pass '-z bndplt' when building dynamic objects with MPX
- Authentication-results: sourceware.org; auth=none
- References: <20150318115630 dot GA64546 at msticlxl57 dot ims dot intel dot com> <CAMbmDYYuG0GAuym4-RVUnX6EWVtjaCuA240HTCef65kU26H6YQ at mail dot gmail dot com> <20150331094702 dot GC52842 at msticlxl57 dot ims dot intel dot com> <alpine dot DEB dot 2 dot 10 dot 1504031932570 dot 29464 at digraph dot polyomino dot org dot uk> <5521E515 dot 2030802 at codesourcery dot com>
On 05 Apr 19:44, Sandra Loosemore wrote:
> On 04/03/2015 01:34 PM, Joseph Myers wrote:
> >On Tue, 31 Mar 2015, Ilya Enkovich wrote:
> >
> >>+library. It also passes '-z bndplt' to a linker in case it supports this
> >>+option (which is checked on libmpx configuration). Note that old versions
> >>+of linker may ignore option. Gold linker doesn't support '-z bndplt'
> >>+option. With no '-z bndplt' support in linker all calls to dynamic libraries
> >>+lose passed bounds reducing overall protection level. It's highly
> >>+recommended to use linker with '-z bndplt' support. In case such linker
> >>+is not available it is adviced to always use @option{-static-libmpxwrappers}
> >>+for better protection level or use @option{-static} to completely avoid
> >>+external calls to dynamic libraries. MPX-based instrumentation
> >
> >Use @samp{-z bndplt} rather than '' quoting (but Sandra may have further
> >advice on the substance of this documentation).
>
> To tell the truth, I can't figure out what this means from a user
> perspective. How does a user know whether the linker option is
> being ignored, or if they have a new enough linker? If the linker
> available at configuration time doesn't support the option, does
> that mean the option will never be passed and users will never know
> that there are gaping holes in the pointer bounds checking?
>
> My suggestion would be to pass the option unconditionally and make
> the documentation say something like
This option was rejected.
>
> It also passes @option{-z bndplt} to the linker. LD version xxx or
> later is required to use this feature. If no linker support for
> @option{-z bndplt} is available, you should link with
> @option{-static-libmpxwrappers} or @option{-static} instead;
> otherwise calls to dynamic libraries lose bounds checking
> protection.
>
> ... where you need to fill in "version xxx" appropriately.
>
> -Sandra
>
Thank you for comments. Here is a doc update I'm going to install if nobody objects.
Ilya
--
2015-04-06 Ilya Enkovich <ilya.enkovich@intel.com>
* doc/invoke.texi (-fcheck-pointer-bounds): Fix
formatting.
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index c058710..72b9578 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -5858,12 +5858,12 @@ a runtime library to enable MPX in hardware and handle bounds
violation signals. By default when @option{-fcheck-pointer-bounds}
and @option{-mmpx} options are used to link a program, the GCC driver
links against the @file{libmpx} runtime library and @file{libmpxwrappers}
-library. It also passes '-z bndplt' to a linker in case it supports this
-option (which is checked on libmpx configuration). Note that old versions
-of linker may ignore option. Gold linker doesn't support '-z bndplt'
-option. With no '-z bndplt' support in linker all calls to dynamic libraries
-lose passed bounds reducing overall protection level. It's highly
-recommended to use linker with '-z bndplt' support. In case such linker
+library. It also passes @option{-z bndplt} to a linker in case it supports
+this option (which is checked on libmpx configuration). LD supports it starting
+from version 2.25. Gold linker doesn't support @option{-z bndplt}
+option. With no @option{-z bndplt} support in a linker all calls to dynamic
+libraries lose passed bounds reducing overall protection level. It's highly
+recommended to use linker with @option{-z bndplt} support. In case such linker
is not available it is adviced to always use @option{-static-libmpxwrappers}
for better protection level or use @option{-static} to completely avoid
external calls to dynamic libraries. MPX-based instrumentation