Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1938177pxb; Sat, 23 Jan 2021 10:28:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJynMqpxJccJZj1S3Ou2aCweAn1LBQ224L5DKFR7Jvt1Vf6Ix62Zo0OeflAk7lziCUpNSzNQ X-Received: by 2002:a50:8741:: with SMTP id 1mr1518250edv.349.1611426507783; Sat, 23 Jan 2021 10:28:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611426507; cv=none; d=google.com; s=arc-20160816; b=GDz40jg0oloW8CV1Yt95uVSCjzieINTH1d3OIXaXEJa9cbksFTKDHwsBIMgYWP0bnn SNpzjLpMlOP9slYurLpmx0JEjBXIIp7V65BW2fkly5rd6RBUrXF2n94BxjfSfITL0UB+ smtvdh/cfirU2hyGz/XcVxNd4YRgMCxEmYp3EMfEFPYUU4BTa0+qMV4De04oemjBvfvH QcVhBeybYXNbRIvY/4fT/wp7lR5o/Br0IcWysTJRgz18bB7H6zmxkx6pUB98MsH+JqNP EjaqTayqVG0DXvzCu7WqoEW6kmJKjsXR7gPVR9zGVB107SLRo9+G8T/JByiGtj2BqPI9 HWNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=IgsmJxNhjM6n7JOSepgWyLYU2D0ed5MSeP1SAOXnnP8=; b=tZ2mfEvafdxOt324BmmSeZ1LzceLz8T4+7FwOaZfXbUvopvecJGCO5zs4vrpkP4Xdz R1StIkPBqlUvlWuJYGnUKLVmzGL0rRw4FrQeJAOYjD4XZ4LiQhnEzAYMI883dqjyufFc +JF3el8NBkpWfNTvCpsl/gpWK/LA2NQqfBQ1giBMs+7ozvzwlf9AIYPcU3oaBd33vK43 sXkkRq5yyUB8NtIk/Yjx/AwM1J1khRkNfuNbwOj3xuFQ7Sy6W0eam9vI/ax78SWFKhv4 323+F8psuAJhmdbZEsJZEUGRw28lW7b1aUQwbY3xpYt+zjgRPNJn4WOn35gFbmD+e5Ii r/Rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=E0Be+SNK; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c95si5856355edf.605.2021.01.23.10.28.04; Sat, 23 Jan 2021 10:28:27 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=E0Be+SNK; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726309AbhAWS03 (ORCPT + 99 others); Sat, 23 Jan 2021 13:26:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726301AbhAWS0Y (ORCPT ); Sat, 23 Jan 2021 13:26:24 -0500 Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D1A8C061786 for ; Sat, 23 Jan 2021 10:25:43 -0800 (PST) Received: by mail-pg1-x530.google.com with SMTP id n7so6128258pgg.2 for ; Sat, 23 Jan 2021 10:25:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=IgsmJxNhjM6n7JOSepgWyLYU2D0ed5MSeP1SAOXnnP8=; b=E0Be+SNKLKxeZp1olAA15doSY0b2e6N3oQCN5iJ07sOIZUCGohvOwrfj2LzAaW5TUD WMOU1Gtfis9fTfYMQfkfZeMj1mU3lvMm1CDGovVBg642EssNONQDGhRYbRwtUSr8hnJy uZhOlnHfgrmXZfcskPREbKzLoy9W8HleVFErPyFeWevSefoxdbzg/bLSBArWwWYjeVkm V1rXAZOmnxEcpds3ctdGtm/WJHqLvSMJoVZvBUS7CIY8W9/2kk7rdvqeFVKYz8F6RwEJ l5MbdKJXV3ZVoxZu2721vqNn0I19lJjGTecavBfLTvnKwVKt2VBBhDJKKgW3WlyC936Y HRFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=IgsmJxNhjM6n7JOSepgWyLYU2D0ed5MSeP1SAOXnnP8=; b=WEwjoWJ8g31y8DZ84/yoW/oRnNzxG4aeBCF3eXVkR2M2i5Jsg5DOBx/GZWZFNqVZbW RtEjJ3hFfcg1ZayhmN4sd0e2H5eHEYx2mO0+V+a21qVriCd8vtV94zriU05vhecDVA6w MjRRBGnCq9ak7sySynOISj5tpSheCnGUTwoecLUTzyl9QN1yZ8VWDS1JSIoRgw75s+9V bdXs5A3XZ5+TigKwFmT92ux4XtA8rLbjP0TyX/Chj5R0YFTgaJ+O5SSwoKc7k/4xPnRs G3mtuJs9RPgw5dZ363hDdbtFGk5wtcLi5x3I4Wi104KE8EToob3geSuFuxZ7SYNwcASF 35IA== X-Gm-Message-State: AOAM531ZZuO/yv4iZu1KJioF2DC8TrF1krJ3HtCqeyCibI1/I7hdhwuV vM2oj/QzoMg7zt7k26zDTfg= X-Received: by 2002:a65:458d:: with SMTP id o13mr10574362pgq.450.1611426342838; Sat, 23 Jan 2021 10:25:42 -0800 (PST) Received: from [192.168.29.245] ([49.36.171.181]) by smtp.gmail.com with ESMTPSA id a22sm8777677pjh.5.2021.01.23.10.25.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 23 Jan 2021 10:25:42 -0800 (PST) Subject: Re: [PATCH v2] checkpatch: add warning for avoiding .L prefix symbols in assembly files To: Joe Perches , linux-kernel@vger.kernel.org Cc: lukas.bulwahn@gmail.com, dwaipayanray1@gmail.com, broonie@kernel.org, ndesaulniers@google.com, jpoimboe@redhat.com, linux-kernel-mentees@lists.linuxfoundation.org, clang-built-linux@googlegroups.com References: <20210123151405.26267-1-yashsri421@gmail.com> From: Aditya Message-ID: Date: Sat, 23 Jan 2021 23:53:26 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 23/1/21 10:51 pm, Joe Perches wrote: > On Sat, 2021-01-23 at 20:44 +0530, Aditya Srivastava wrote: >> objtool requires that all code must be contained in an ELF symbol. >> Symbol names that have a '.L' prefix do not emit symbol table entries, as >> they have special meaning for the assembler. >> >> '.L' prefixed symbols can be used within a code region, but should be >> avoided for denoting a range of code via 'SYM_*_START/END' annotations. >> >> Add a new check to emit a warning on finding the usage of '.L' symbols >> for '.S' files in arch/x86/entry/* and arch/x86/lib/*, if it denotes >> range of code via SYM_*_START/END annotation pair. >> >> Suggested-by: Mark Brown >> Link: https://groups.google.com/g/clang-built-linux/c/-drkmLgu-cU/m/4staOlf-CgAJ > > Please do not use groups.google.com links, or if you must, please > use links that are readable. > > For instance, this is a better link as it shows the context without > struggling with the poor interface: > > https://groups.google.com/g/clang-built-linux/c/E-naBMt_1SM > Okay, Got it.. I'll use lkml link for the best. >> Signed-off-by: Aditya Srivastava >> --- >> * Applies perfectly on next-20210122 >> >> Changes in v2: >> - Reduce the check to only SYM_*_START/END lines >> - Reduce the check for only .S files in arch/x86/entry/* and arch/x86/lib/* as suggested by Josh and Nick > > I think that's unnecessary. > >> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > [] >> @@ -3590,6 +3590,13 @@ sub process { >>   } >>   } >>   >> >> +# check for .L prefix local symbols in .S files >> + if ($realfile =~ m@^arch/x86/(?:entry|lib)/.*\.S$@ && > > Using /.S$/ should be enough > >> + $line =~ /^\+\s*SYM_[A-Z]+_(?:START|END)(?:_[A-Z_]+)?\s*\(\s*\.L/) { > > This might need to be > > + $line =~ /^\+\s*(?:[A-Z]+_)?SYM_[A-Z]+_(?:START|END)(?:_[A-Z_]+)?\s*\(\s*\.L/) { > Okay.. Thanks. I'll modify the patch accordingly. Thanks Aditya >> + WARN("AVOID_L_PREFIX", >> + "Avoid using '.L' prefixed local symbol names for denoting a range of code via 'SYM_*_START/END' annotations; see Documentation/asm-annotations.rst\n" . $herecurr); >> + } >> + > >