From patchwork Fri Aug 14 22:24:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 507583 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 492811401B5 for ; Sat, 15 Aug 2015 08:24:53 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=iEpnXDEH; 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; q=dns; s=default; b=SxbYyQblyeF2Xod tUVtGa0+YEQfQw2KThnJQ38rtOEQtHkW9+eXUckQdXZKmrhymnVZHdDMsp3j5CvT 8aHpA4/MfuE3jR0E7gKjaVCsvL428Fshv20ujg/EE/A+bvLdQ/oXu70P8/uTAoyY TL2EITVWFs8LBYJJTAT6wPOI9VlI= 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; s=default; bh=BiWIfavtqxhVmxS6h0b6/ CxkRoU=; b=iEpnXDEHc2HN4qRP5hYw65CR18LU+ybTfxseRP2yees6Ns0vifyuk EfEx4DssTwC1P3/+h/kgMnszSY/K2GyR3IRFaX9RsJwCcs+J3hDI6SIZn10bnwCE gBWfaLRccdRw1i5UAZ69SrChUZBqfDW1wFSAe93SAZlj0h19v9BTFc= Received: (qmail 27272 invoked by alias); 14 Aug 2015 22:24:46 -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 27257 invoked by uid 89); 14 Aug 2015 22:24:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wi0-f169.google.com Received: from mail-wi0-f169.google.com (HELO mail-wi0-f169.google.com) (209.85.212.169) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 14 Aug 2015 22:24:45 +0000 Received: by wicne3 with SMTP id ne3so31960060wic.1 for ; Fri, 14 Aug 2015 15:24:42 -0700 (PDT) X-Received: by 10.180.75.78 with SMTP id a14mr10904665wiw.43.1439591082068; Fri, 14 Aug 2015 15:24:42 -0700 (PDT) Received: from 640k.lan ([94.39.138.45]) by smtp.gmail.com with ESMTPSA id 4sm10160915wjt.46.2015.08.14.15.24.40 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Aug 2015 15:24:40 -0700 (PDT) From: Paolo Bonzini To: gcc-patches@gcc.gnu.org Subject: [PATCH] Remove pointless -fPIC warning on Windows platforms Date: Sat, 15 Aug 2015 00:24:37 +0200 Message-Id: <1439591077-2642-1-git-send-email-bonzini@gnu.org> There are plenty of targets that do not require -fPIC because they always generate position independent code, but none of them feels the need to complain with the user about an unnecessary but perfectly valid option, on each and every .c->.o rule, and without a way to disable it. Adding insult to injury, the warning is also wrong in 3 cases out of four. For 32-bit, warning may make a small amount of sense because there is simply no such thing as PIC code (Windows just uses a "preferred base address" for DLLs); but then the text is wrong. For 64-bit, -fpic does not warn, but "all code is position independent" would apply just as well! As a summary, googling for the warning text finds exactly two categories of people: those that are annoyed by the message because they want to use -Werror (this includes me), and those that suggest replacing -fPIC with -fpic. Just zap it. Paolo * config/i386/cygming.h (SUBTARGET_OVERRIDE_OPTIONS): Do not warn. diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h index fda59fb..71506ec 100644 --- a/gcc/config/i386/cygming.h +++ b/gcc/config/i386/cygming.h @@ -198,20 +198,7 @@ along with GCC; see the file COPYING3. If not see #undef SUBTARGET_OVERRIDE_OPTIONS #define SUBTARGET_OVERRIDE_OPTIONS \ do { \ - if (TARGET_64BIT && flag_pic != 1) \ - { \ - if (flag_pic > 1) \ - warning (0, \ - "-fPIC ignored for target (all code is position independent)"\ - ); \ - flag_pic = 1; \ - } \ - else if (!TARGET_64BIT && flag_pic) \ - { \ - warning (0, "-f%s ignored for target (all code is position independent)",\ - (flag_pic > 1) ? "PIC" : "pic"); \ - flag_pic = 0; \ - } \ + flag_pic = TARGET_64BIT ? 1 : 0; \ } while (0) /* Define this macro if references to a symbol must be treated