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.
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 "\
.