* Error out on -fvtable-verify without --enable-vtable-verify
@ 2016-05-08 10:44 Rainer Orth
2016-05-09 9:23 ` Bernd Schmidt
0 siblings, 1 reply; 4+ messages in thread
From: Rainer Orth @ 2016-05-08 10:44 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 1021 bytes --]
With the recent change not to install libvtv without
--enable-vtable-verify, I noticed that gcc/g++ would still accept
-fvtable-verify without errors, only to emit obscure link-time errors
about missing vtv_*.o (which hadn't been installed in that situation
before) and libvtv.
It seems to me a much better user experience to emit a clear error
message in this case, which is what this patch does.
Bootstrapped without regressions (without and with
--enable-vtable-verify) on i386-pc-solaris2.12 and x86_64-pc-linux-gnu.
Manually tested that I get (or don't get) the expected errors for
-fvtable-verfy=(none|std|preinit].
Ok for mainline?
Rainer
2016-05-04 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* configure.ac (enable_vtable_verify): Handle --enable-vtable-verify.
* configure: Regenerate.
* config.in: Regenerate.
* gcc.c (VTABLE_VERIFICATION_SPEC) [!ENABLE_VTABLE_VERIFY]: Error
on -fvtable-verify.
* config/sol2.h [!ENABLE_VTABLE_VERIFY] (STARTFILE_VTV_SPEC): Define.
(ENDFILE_VTV_SPEC): Define.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: fvtable-verify-error.patch --]
[-- Type: text/x-patch, Size: 2874 bytes --]
# HG changeset patch
# Parent 26d037ddd624a6e7b738c1db2b6dbdeb90c9b01c
Error out on -fvtable-verify without --enable-vtable-verify
diff --git a/gcc/config/sol2.h b/gcc/config/sol2.h
--- a/gcc/config/sol2.h
+++ b/gcc/config/sol2.h
@@ -166,21 +166,26 @@ along with GCC; see the file COPYING3.
#define STARTFILE_CRTBEGIN_SPEC "crtbegin.o%s"
#endif
+#if ENABLE_VTABLE_VERIFY
#if SUPPORTS_INIT_PRIORITY
#define STARTFILE_VTV_SPEC \
"%{fvtable-verify=none:%s; \
fvtable-verify=preinit:vtv_start_preinit.o%s; \
fvtable-verify=std:vtv_start.o%s}"
-
#define ENDFILE_VTV_SPEC \
"%{fvtable-verify=none:%s; \
fvtable-verify=preinit:vtv_end_preinit.o%s; \
fvtable-verify=std:vtv_end.o%s}"
-#else
+#else /* !SUPPORTS_INIT_PRIORITY */
#define STARTFILE_VTV_SPEC \
- "%{fvtable-verify:%e-fvtable-verify is not supported in this configuration}"
+ "%{fvtable-verify=*: \
+ %e-fvtable-verify=%* is not supported in this configuration}"
#define ENDFILE_VTV_SPEC ""
-#endif
+#endif /* !SUPPORTS_INIT_PRIORITY */
+#else /* !ENABLE_VTABLE_VERIFY */
+#define STARTFILE_VTV_SPEC ""
+#define ENDFILE_VTV_SPEC ""
+#endif /* !ENABLE_VTABLE_VERIFY */
/* We don't use the standard svr4 STARTFILE_SPEC because it's wrong for us. */
#undef STARTFILE_SPEC
diff --git a/gcc/configure.ac b/gcc/configure.ac
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -865,6 +865,19 @@ Valid choices are 'yes' and 'no'.]) ;;
esac
], [enable_tls=''])
+AC_ARG_ENABLE(vtable-verify,
+[AS_HELP_STRING([--enable-vtable-verify],
+ [enable vtable verification feature])],
+[case "$enableval" in
+ yes) enable_vtable_verify=yes ;;
+ no) enable_vtable_verify=no ;;
+ *) enable_vtable_verify=no;;
+ esac],
+[enable_vtable_verify=no])
+vtable_verify=`if test $enable_vtable_verify != no; then echo 1; else echo 0; fi`
+AC_DEFINE_UNQUOTED(ENABLE_VTABLE_VERIFY, $vtable_verify,
+[Define 0/1 if vtable verification feature is enabled.])
+
AC_ARG_ENABLE(objc-gc,
[AS_HELP_STRING([--enable-objc-gc],
[enable the use of Boehm's garbage collector with
diff --git a/gcc/gcc.c b/gcc/gcc.c
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -989,9 +989,18 @@ proper position among the other output f
the vtable verification runtime functions are in libstdc++, so we use
the spec just below this one. */
#ifndef VTABLE_VERIFICATION_SPEC
+#if ENABLE_VTABLE_VERIFY
#define VTABLE_VERIFICATION_SPEC "\
%{!nostdlib:%{fvtable-verify=std: -lvtv -u_vtable_map_vars_start -u_vtable_map_vars_end}\
%{fvtable-verify=preinit: -lvtv -u_vtable_map_vars_start -u_vtable_map_vars_end}}"
+#else
+#define VTABLE_VERIFICATION_SPEC "\
+%{fvtable-verify=none:} \
+%{fvtable-verify=std: \
+ %e-fvtable-verify=std is not supported in this configuration} \
+%{fvtable-verify=preinit: \
+ %e-fvtable-verify=preinit is not supported in this configuration}"
+#endif
#endif
#ifndef CHKP_SPEC
[-- Attachment #3: Type: text/plain, Size: 143 bytes --]
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Error out on -fvtable-verify without --enable-vtable-verify
2016-05-08 10:44 Error out on -fvtable-verify without --enable-vtable-verify Rainer Orth
@ 2016-05-09 9:23 ` Bernd Schmidt
2016-05-09 11:28 ` Rainer Orth
0 siblings, 1 reply; 4+ messages in thread
From: Bernd Schmidt @ 2016-05-09 9:23 UTC (permalink / raw)
To: Rainer Orth, gcc-patches
On 05/08/2016 12:44 PM, Rainer Orth wrote:
> With the recent change not to install libvtv without
> --enable-vtable-verify, I noticed that gcc/g++ would still accept
> -fvtable-verify without errors, only to emit obscure link-time errors
> about missing vtv_*.o (which hadn't been installed in that situation
> before) and libvtv.
>
> It seems to me a much better user experience to emit a clear error
> message in this case, which is what this patch does.
Generally ok, but...
> +AC_ARG_ENABLE(vtable-verify,
> +[AS_HELP_STRING([--enable-vtable-verify],
> + [enable vtable verification feature])],
> +[case "$enableval" in
> + yes) enable_vtable_verify=yes ;;
> + no) enable_vtable_verify=no ;;
> + *) enable_vtable_verify=no;;
> + esac],
> +[enable_vtable_verify=no])
> +vtable_verify=`if test $enable_vtable_verify != no; then echo 1; else echo 0; fi`
> +AC_DEFINE_UNQUOTED(ENABLE_VTABLE_VERIFY, $vtable_verify,
> +[Define 0/1 if vtable verification feature is enabled.])
That looks a little overly complicated. Don't you get the enable_
variables set by autoconf? And if you do need the case statement, you
might as well set things to 0/1 directly and skip the
enable_vtable_verify variable entirely.
Bernd
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Error out on -fvtable-verify without --enable-vtable-verify
2016-05-09 9:23 ` Bernd Schmidt
@ 2016-05-09 11:28 ` Rainer Orth
2016-05-09 11:29 ` Bernd Schmidt
0 siblings, 1 reply; 4+ messages in thread
From: Rainer Orth @ 2016-05-09 11:28 UTC (permalink / raw)
To: Bernd Schmidt; +Cc: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 1357 bytes --]
Hi Bernd,
> On 05/08/2016 12:44 PM, Rainer Orth wrote:
>> With the recent change not to install libvtv without
>> --enable-vtable-verify, I noticed that gcc/g++ would still accept
>> -fvtable-verify without errors, only to emit obscure link-time errors
>> about missing vtv_*.o (which hadn't been installed in that situation
>> before) and libvtv.
>>
>> It seems to me a much better user experience to emit a clear error
>> message in this case, which is what this patch does.
>
> Generally ok, but...
>
>> +AC_ARG_ENABLE(vtable-verify,
>> +[AS_HELP_STRING([--enable-vtable-verify],
>> + [enable vtable verification feature])],
>> +[case "$enableval" in
>> + yes) enable_vtable_verify=yes ;;
>> + no) enable_vtable_verify=no ;;
>> + *) enable_vtable_verify=no;;
>> + esac],
>> +[enable_vtable_verify=no])
>> +vtable_verify=`if test $enable_vtable_verify != no; then echo 1; else
>> echo 0; fi`
>> +AC_DEFINE_UNQUOTED(ENABLE_VTABLE_VERIFY, $vtable_verify,
>> +[Define 0/1 if vtable verification feature is enabled.])
>
> That looks a little overly complicated. Don't you get the enable_ variables
> set by autoconf? And if you do need the case statement, you might as well
> set things to 0/1 directly and skip the enable_vtable_verify variable
> entirely.
that's what you get for blindly copying configure.ac fragments. The
following works instead:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: c.a.patch --]
[-- Type: text/x-patch, Size: 648 bytes --]
diff --git a/gcc/configure.ac b/gcc/configure.ac
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -865,6 +865,14 @@ Valid choices are 'yes' and 'no'.]) ;;
esac
], [enable_tls=''])
+AC_ARG_ENABLE(vtable-verify,
+[AS_HELP_STRING([--enable-vtable-verify],
+ [enable vtable verification feature])],,
+[enable_vtable_verify=no])
+vtable_verify=`if test x$enable_vtable_verify = xyes; then echo 1; else echo 0; fi`
+AC_DEFINE_UNQUOTED(ENABLE_VTABLE_VERIFY, $vtable_verify,
+[Define 0/1 if vtable verification feature is enabled.])
+
AC_ARG_ENABLE(objc-gc,
[AS_HELP_STRING([--enable-objc-gc],
[enable the use of Boehm's garbage collector with
[-- Attachment #3: Type: text/plain, Size: 447 bytes --]
I had to tighten the $enable_vtable_verify test to guard against a
non-no argument to --enable-vtable-verify being interpreted as yes.
Tested by just running gcc/configure without and with
--enable-vtable-verify, and with --enable-vtable-verify=nonstd (handled
as no).
Ok now?
Thanks.
Rainer
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Error out on -fvtable-verify without --enable-vtable-verify
2016-05-09 11:28 ` Rainer Orth
@ 2016-05-09 11:29 ` Bernd Schmidt
0 siblings, 0 replies; 4+ messages in thread
From: Bernd Schmidt @ 2016-05-09 11:29 UTC (permalink / raw)
To: Rainer Orth; +Cc: gcc-patches
On 05/09/2016 01:28 PM, Rainer Orth wrote:
> Ok now?
Yes, thanks.
Bernd
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-05-09 11:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-08 10:44 Error out on -fvtable-verify without --enable-vtable-verify Rainer Orth
2016-05-09 9:23 ` Bernd Schmidt
2016-05-09 11:28 ` Rainer Orth
2016-05-09 11:29 ` Bernd Schmidt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).