From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14339 invoked by alias); 12 Apr 2014 04:00:25 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 14314 invoked by uid 89); 12 Apr 2014 04:00:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ob0-f176.google.com Received: from mail-ob0-f176.google.com (HELO mail-ob0-f176.google.com) (209.85.214.176) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sat, 12 Apr 2014 04:00:23 +0000 Received: by mail-ob0-f176.google.com with SMTP id wp18so6870170obc.7 for ; Fri, 11 Apr 2014 21:00:21 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.60.150.143 with SMTP id ui15mr6710oeb.50.1397275221574; Fri, 11 Apr 2014 21:00:21 -0700 (PDT) Received: by 10.60.164.74 with HTTP; Fri, 11 Apr 2014 21:00:21 -0700 (PDT) In-Reply-To: References: Date: Sat, 12 Apr 2014 04:00:00 -0000 Message-ID: Subject: Re: [patch] Fix unused static symbols so they're not dropped by clang From: Andrew Pinski To: David Blaikie Cc: Doug Evans , gdb-patches , Eric Christopher Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2014-04/txt/msg00234.txt.bz2 On Fri, Apr 11, 2014 at 1:17 PM, David Blaikie wrote: > On Fri, Apr 11, 2014 at 11:23 AM, Doug Evans wrote: >> On Thu, Apr 10, 2014 at 11:51 PM, David Blaikie wrote: >>> Several tests used file-static functions and variables that were not >>> referenced by the code. Even at -O0, clang omits these entities at the >>> frontend so the tests fail. >>> >>> Since it doesn't look like these tests needed this functionality for >>> what they were testing, I've modified the variables/functions to >>> either be non-static, or marked them with __attribute__((used)). >>> >>> If it's preferred that I use the attribute more pervasively, rather >>> than just making the entities non-static, I can provide a patch for >>> that (or some other preferred solution). There's certainly precedent >>> for both (non-static entities and __attribute__((used)) in the >>> testsuite already and much more of the former than the latter). >>> >>> I have commit-after-review access, so just looking for sign-off here. >> >> Yikes. >> >> This is becoming more and more painful (not your fault of course!). >> I can imagine this being a never ending source of regressions. >> >> Does clang perchance have a -O0-and-yes-I-really-mean-O0 option? > > Sort of. It does have -femit-all-decls, which, though poorly named, > causes clang to produce definitions for unused static entities and > even unused inline functions (which GCC doesn't do). By default GCC does not keep unused inline functions but there is an option for that -fkeep-inline-functions. Thanks, Andrew Pinski > I'm not sure > where we'd build in passing that flag from the GCC test suite. I'd > rather not have "clang passes the test suite only if you pass this > carefully chosen set of flags".