From patchwork Sun May 8 10:44:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rainer Orth X-Patchwork-Id: 619638 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3r2hwM6h1qz9snm for ; Sun, 8 May 2016 20:44:35 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=l1fn4fOE; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; q=dns; s= default; b=N3g7kRHp9Fez8CYIFlWcZiBMTCHbwnCSppzaXkK+K8KuDTEA53mlF 48SvDQrb0Oci50NQ6HGt+W8AUXvsnav+JZZBJARodmsyNqtScSTxVPsVCW7d+ZRS lg3oRoVa+xiB2CcFwBlqWL2a3HiWi5ll8irTdPysyQFNUB6bLLICK8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; s= default; bh=e4+vj/wjN5YaFCkbiU60vQvWiZU=; b=l1fn4fOEPMm3fW5yxSOG RpxZ84q1U1WJiquMnl2jPw90NC19bsK9UcXDPGbaz3DEH/P31mWDZS9oy6IERD7F 6XHz86uvf3cwfAcvZ0tgx5fRpvQwTD24zC4vg250Gq2x5t5qkzA5Rs86mrxq1Mz5 M3xoKG39I91GR0PpB00XRRY= Received: (qmail 73126 invoked by alias); 8 May 2016 10:44:26 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 72898 invoked by uid 89); 8 May 2016 10:44:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.0 required=5.0 tests=BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=Regenerate, collector, 8656, ac_arg_enable X-HELO: smtp.CeBiTec.Uni-Bielefeld.DE Received: from smtp.CeBiTec.Uni-Bielefeld.DE (HELO smtp.CeBiTec.Uni-Bielefeld.DE) (129.70.160.84) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 08 May 2016 10:44:14 +0000 Received: from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id 89B6B8C3 for ; Sun, 8 May 2016 12:44:12 +0200 (CEST) Received: from smtp.CeBiTec.Uni-Bielefeld.DE ([127.0.0.1]) by localhost (malfoy.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) (amavisd-new, port 10024) with LMTP id gaJq+x8HPW3B for ; Sun, 8 May 2016 12:44:09 +0200 (CEST) Received: from fuego.CeBiTec.Uni-Bielefeld.DE (p5B29F28B.dip0.t-ipconnect.de [91.41.242.139]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPSA id 697968C2 for ; Sun, 8 May 2016 12:44:09 +0200 (CEST) From: Rainer Orth To: gcc-patches@gcc.gnu.org Subject: Error out on -fvtable-verify without --enable-vtable-verify Date: Sun, 08 May 2016 12:44:03 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.93 (usg-unix-v) MIME-Version: 1.0 X-IsSubscribed: yes 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 * 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. # 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