2016-08-25 12:27 GMT+03:00 Alexander Ivchenko <aivch...@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 "\ > .