Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4085528pxk; Tue, 29 Sep 2020 14:01:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxALkApLC6tS/nWiDpZMini2BxdFWhLRSk72+7uSQG/5jYWYPPO8/Htm6r3ydsNjzana5Ot X-Received: by 2002:a50:e78f:: with SMTP id b15mr5487901edn.104.1601413274273; Tue, 29 Sep 2020 14:01:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601413274; cv=none; d=google.com; s=arc-20160816; b=FYjlFsLNHencjRthGFNzLVmcyy+KYOhirlYtAND9n5x8P/oCOGuYgeUiSs9I2plQkh UG/h5DIC+rCyXAHjboP8+0c5jBTrKtiPTzzJHChbLXQJq3DiiaMSV0sHwJCh+5c06ybA JG/aU5LRs95a4tcqSIGN2lEQQb9w1bcY0gIYZAg0EXMsF+eHAp0dHNeaPBAbheIKydBb L34xR0u8/AINL/0f7diXmnphjfFFaNvCth2/xpTMzQaBjSLK8KEI3Vz3dr7iDbG9Fj9D 4eMdNeG/APMHUptce018Ctg3KEe3ztmwhR0C2NLmfkasPf87eJqGleSChgqMxv8rUP+K N4fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=j96NedzGrWve7hqjmdtY+y6fO2Eq0jqMR0Z821xkzTY=; b=BGEmsCHg20KJORTCNWsePvl2ig+lYASu6y6EyIBhV/UENJtPKw78+zrDj0lfU9r7Me ESd1pHx6v7N32bJ6kTEKbXJVkZX6AqfYPWXKLTaLsisd3m/SY+dxcK+qW8lcVmRt4y+F dcTqVRT4Wb+hn8AeOG8DUhKg3if9EpNBym3HX/CE28yuF54utQX17ubut4u8IQa1wZ/c 9IsfNuvEirbz/p4MiN83Y3SxLceZHI6jpVtjWa5JQTCfWi2KFFmrJHo+b7ccVDeO70bm s5le5jjWK92Dzgx1kYwX2RkgV/faNOLKlVMCMJu6AyTfWj8XvUaVQxKVslBrN5PgzL5Z 8gAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=XKwEiCwm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r26si3757812eja.484.2020.09.29.14.00.51; Tue, 29 Sep 2020 14:01:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=XKwEiCwm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729392AbgI2U7n (ORCPT + 99 others); Tue, 29 Sep 2020 16:59:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728729AbgI2U7n (ORCPT ); Tue, 29 Sep 2020 16:59:43 -0400 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED3B0C061755 for ; Tue, 29 Sep 2020 13:59:42 -0700 (PDT) Received: by mail-pf1-x443.google.com with SMTP id l126so5933157pfd.5 for ; Tue, 29 Sep 2020 13:59:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=j96NedzGrWve7hqjmdtY+y6fO2Eq0jqMR0Z821xkzTY=; b=XKwEiCwmAC3jhPabqr8QHkp/dKsSR5IyQtwHI1IpeT4t2z6bPbJe2tZ1S0DbzstuJU 8MSecgKhO0ch+8KnP59v/SBpMJjwvayqDhknG6UrekmAgP8I1gsQ39xs4z30s2/r037g UzAc0No2XTKC1EuUHL+clUa2rZ52ZT3jq7GxV7m/ERMUokR63+XZ/3W7P4AegkQ2bsgn jmnqeEx7isCw3BFV1nmfAA2sq1fiFjYg9GcXEGjzDC/Vt4OCRuSldJWDU5H5VRyTW2su p10pUUvJNz01iA5tYwKBouK/F2vLbCOeW2TEgqoi14irfphSrnKDdMCNkafoUbh2Yyqh Jfrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=j96NedzGrWve7hqjmdtY+y6fO2Eq0jqMR0Z821xkzTY=; b=ISn3ri6H7xehjcnfnOckGk2H/N6CxRpX8ly7OC3NlvMG809chaDIgMx+vc8PkqbRgq GHeltv4hNw0tg+yWAMQw44uXj/0iKBR0/JJgKPkvCmEsfkrSw0vWu8vONYtujAi762i4 e9X8FCt0gUkYbhB8ff6k6hX/YC0vPjucIFiygI5Lx1jkQScmy2Fq7qY/ynfgFZvoHfsU RLuP/UGr33RN5OKluybnbiZxg5wFqeTp8KZdRLuyVwF14dF7YIYRjlMsC0+ES3YfJ2EO b1JIddQp4OX1HQMLV1bcPohERdWz+XJCrGUSB6i1uK8c/ZhtVv7SR0uksBNkUPeBHHR7 rZLQ== X-Gm-Message-State: AOAM530S3g5E9StTPoE2HZBDwDVW4knUwh76hYYhSsV9Lc6Zv70fQIzR eWDwoICRwrOeT86s5Sm2KG7EUf3JgPV6/k4iQIJiQCG3pzxjVg== X-Received: by 2002:a17:902:c151:b029:d2:42a6:2fb with SMTP id 17-20020a170902c151b02900d242a602fbmr6414637plj.10.1601413182230; Tue, 29 Sep 2020 13:59:42 -0700 (PDT) MIME-Version: 1.0 References: <20200929194318.548707-1-ndesaulniers@google.com> <20200929200801.GA2668747@rani.riverdale.lan> <20200929204748.GA2683578@rani.riverdale.lan> In-Reply-To: <20200929204748.GA2683578@rani.riverdale.lan> From: Nick Desaulniers Date: Tue, 29 Sep 2020 13:59:30 -0700 Message-ID: Subject: Re: [PATCH] compiler.h: avoid escaped section names To: Nicholas Piggin Cc: Arvind Sankar , Andrew Morton , Miguel Ojeda , Luc Van Oostenryck , Nathan Chancellor , linux-sparse@vger.kernel.org, LKML , clang-built-linux , Joe Perches Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 29, 2020 at 1:47 PM Arvind Sankar wrote: > > On Tue, Sep 29, 2020 at 01:30:22PM -0700, Nick Desaulniers wrote: > > On Tue, Sep 29, 2020 at 1:25 PM Nick Desaulniers > > wrote: > > > > > > On Tue, Sep 29, 2020 at 1:08 PM Arvind Sankar wrote: > > > > > > > > On Tue, Sep 29, 2020 at 12:43:18PM -0700, Nick Desaulniers wrote: > > > > > The stringification operator, `#`, in the preprocessor escapes strings. > > > > > For example, `# "foo"` becomes `"\"foo\""`. GCC and Clang differ in how > > > > > they treat section names that contain \". > > > > > > > > > > The portable solution is to not use a string literal with the > > > > > preprocessor stringification operator. > > > > > > > > > > In this case, since __section unconditionally uses the stringification > > > > > operator, we actually want the more verbose > > > > > __attribute__((__section__())). > > > > > > > > > > Link: https://bugs.llvm.org/show_bug.cgi?id=42950 > > > > > Fixes: commit e04462fb82f8 ("Compiler Attributes: remove uses of __attribute__ from compiler.h") > > > > > Signed-off-by: Nick Desaulniers > > > > > --- > > > > > include/linux/compiler.h | 2 +- > > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > > > diff --git a/include/linux/compiler.h b/include/linux/compiler.h > > > > > index 92ef163a7479..ac45f6d40d39 100644 > > > > > --- a/include/linux/compiler.h > > > > > +++ b/include/linux/compiler.h > > > > > @@ -155,7 +155,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, > > > > > extern typeof(sym) sym; \ > > > > > static const unsigned long __kentry_##sym \ > > > > > __used \ > > > > > - __section("___kentry" "+" #sym ) \ > > > > > + __attribute__((__section__("___kentry+" #sym))) \ > > > > > = (unsigned long)&sym; > > > > > #endif > > > > > > > > > > -- > > > > > 2.28.0.709.gb0816b6eb0-goog > > > > > > > > > > > > > There was this previous mini-thread: > > > > https://lore.kernel.org/lkml/20200629205448.GA1474367@rani.riverdale.lan/ > > > > and this older one: > > > > https://lore.kernel.org/lkml/20190904181740.GA19688@gmail.com/ > > > > > > > > Just for my own curiosity: how does KENTRY actually get used? grep > > > > doesn't show any hits, and the thread from 2019 was actually going to > > > > drop it if I read it right, and also just remove stringification from > > > > the __section macro. > > > > > > Oh, sorry I didn't respond on that thread; I could have sworn I ran a > > > grep for KENTRY back then. > > > > > > $ git log -S KENTRY > > > > Added by > > b67067f1176df6ee727450546b58704e4b588563 ? > > > > Yeah but nothing seems to have used it. I assume for LTO we use some > other technique to mark functions as used? Nicholas, do you recall why KENTRY was added in b67067f1176df6ee727450546b58704e4b588563? May I remove that and the addition to INIT_DATA from that commit? -- Thanks, ~Nick Desaulniers