From ad103b01538743f91ba51cfa51da273d34c901c4 Mon Sep 17 00:00:00 2001 From: Rainer Orth Date: Mon, 9 May 2016 11:54:55 +0000 Subject: [PATCH] Error out on -fvtable-verify without --enable-vtable-verify * 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. From-SVN: r236029 --- gcc/ChangeLog | 10 ++++++++++ gcc/config.in | 6 ++++++ gcc/config/sol2.h | 13 +++++++++---- gcc/configure | 20 ++++++++++++++++++-- gcc/configure.ac | 8 ++++++++ gcc/gcc.c | 9 +++++++++ 6 files changed, 60 insertions(+), 6 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1adf8b51ee9..b00dc71cb1a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2016-05-09 Rainer Orth + + * 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. + 2016-05-09 Kaushik Phatak * config/rl78/rl78.c (rl78_expand_prologue): Save the MDUC related diff --git a/gcc/config.in b/gcc/config.in index bdde25fe12f..39d1e7524f8 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -234,6 +234,12 @@ #endif +/* Define 0/1 if vtable verification feature is enabled. */ +#ifndef USED_FOR_TARGET +#undef ENABLE_VTABLE_VERIFY +#endif + + /* Define to 1 if installation paths should be looked up in the Windows Registry. Ignored on non-Windows hosts. */ #ifndef USED_FOR_TARGET diff --git a/gcc/config/sol2.h b/gcc/config/sol2.h index 5160e1fda18..50f2b383a1b 100644 --- a/gcc/config/sol2.h +++ b/gcc/config/sol2.h @@ -166,21 +166,26 @@ along with GCC; see the file COPYING3. If not see #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 b/gcc/configure index 274c397be7d..319dcc3125e 100755 --- a/gcc/configure +++ b/gcc/configure @@ -904,6 +904,7 @@ enable_decimal_float enable_fixed_point enable_threads enable_tls +enable_vtable_verify enable_objc_gc with_dwarf2 enable_shared @@ -1619,6 +1620,7 @@ Optional Features: package --enable-tls enable or disable generation of tls code overriding the assembler check for tls support + --enable-vtable-verify enable vtable verification feature --enable-objc-gc enable the use of Boehm's garbage collector with the GNU Objective-C runtime --disable-shared don't provide a shared libgcc @@ -7591,6 +7593,20 @@ else fi +# Check whether --enable-vtable-verify was given. +if test "${enable_vtable_verify+set}" = set; then : + enableval=$enable_vtable_verify; +else + enable_vtable_verify=no +fi + +vtable_verify=`if test x$enable_vtable_verify = xyes; then echo 1; else echo 0; fi` + +cat >>confdefs.h <<_ACEOF +#define ENABLE_VTABLE_VERIFY $vtable_verify +_ACEOF + + # Check whether --enable-objc-gc was given. if test "${enable_objc_gc+set}" = set; then : enableval=$enable_objc_gc; if test x$enable_objc_gc = xno; then @@ -18458,7 +18474,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 18462 "configure" +#line 18477 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -18564,7 +18580,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 18568 "configure" +#line 18583 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff --git a/gcc/configure.ac b/gcc/configure.ac index e40d82a8306..d55f8458943 100644 --- 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 diff --git a/gcc/gcc.c b/gcc/gcc.c index 1af59209b31..7bcf3b375e5 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -989,9 +989,18 @@ proper position among the other output files. */ 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 -- 2.30.2