Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp4712289rwe; Tue, 30 Aug 2022 15:43:42 -0700 (PDT) X-Google-Smtp-Source: AA6agR6F/vISxUBQwNISj6PA3AHEfO6+lhXgFHDYaCyFw3JA7Nt1Ud9qpn8lVE5kSFyhsTZPteg1 X-Received: by 2002:a05:6402:3591:b0:448:a15e:3ca0 with SMTP id y17-20020a056402359100b00448a15e3ca0mr7160619edc.195.1661899421798; Tue, 30 Aug 2022 15:43:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661899421; cv=none; d=google.com; s=arc-20160816; b=qEJIK8XqhIne94/KPj/dGOHAustkoIcK5SLoWrgyfwBXkiVeMKjLUt5SXgjjyhZ4wj ht4iLiH5A7RDfYh3vtnSLpMDGGA8w1ff35Ln+fSW//Gw4FpqRapAgNy30/XhB2AYWQAT 3Bsd+r6S7q8PZ/jr7/jJBoUY/xTsCB3IfT9r3RSZevTCGiZvJ+5Cx1ApSksD5GPOlI+I IQASMF+WD5W+DokfhPYWKAbo3pC5l4YHf0d4G8bnR+xVbzk8XYvKc1f854BUJLMIkJdc /Xh7CjOxz7gsLGRPTVh3iIXscbj7voBfrVjE6C+XtJwvn4MqQ8VKIk01kg8RHyoaSKhn cE5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=Ximx3byfJ7rLtdPEIh1Ra0raz9MzgSTr/ga3ge5UvWM=; b=CMBy7znRgPMUXxEkJ3rgF0uBW4ecHK9HgJJ8qkpzAvEJKrp5Ou234KqR3Y6ZLB7hq0 szksbZO0ePfDvAYvFK6kN6tESaKRekRdK834qQjUtbtaRSrygBw2fTqE3+4B0y5UqjSe sskMk0ScYUK9noqneJilXte1zh1bTO/tzrlRGaBm7419/AqXhLj309gCmpFszUzUN4Ot /ShP0ebZlLW6l5kx7cjm1dM4EHDJ//SBSNfckwenqr4KXygzdlvV/UwRzlExj3OQTEX9 hdRiotouRpUuqEWhYpKHdi/fdmZU6pdgx9HjpZzn0GblWCZzpEUy2bmeWtNt6EQyVWzC SF5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=hlMw9ssX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w20-20020a056402269400b004486b3296aasi6660279edd.511.2022.08.30.15.43.16; Tue, 30 Aug 2022 15:43:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=hlMw9ssX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231919AbiH3VuR (ORCPT + 99 others); Tue, 30 Aug 2022 17:50:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231805AbiH3Vti (ORCPT ); Tue, 30 Aug 2022 17:49:38 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED6C5901A1 for ; Tue, 30 Aug 2022 14:49:35 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id k126-20020a253d84000000b0068bb342010dso712232yba.1 for ; Tue, 30 Aug 2022 14:49:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc; bh=Ximx3byfJ7rLtdPEIh1Ra0raz9MzgSTr/ga3ge5UvWM=; b=hlMw9ssXTclldlCaHPrcXJ+C8bd3xApn5Llhx/6gZpRfRlRJOwhqWghtr5RVB1LK2v 8FfTzwl4OCrCjFuadtzRuPxbLUjQJudmMLjVKcB1W8L4nbh23VnBIJLeDBpv1hunXsFS TNZP/OkUwJBjRdLHnTFXsfbD3FCLleefIIXeH80z2Nq7UmGRffrhNJtzi3K0o37plX80 MxuLJZry+KmCa87qIRicDj7F3K2/cxyGqrCNJyg48FflYe+16BIsOuCNrNLVMYU6qqtM jxbTTAqnCt+yOzPfECe6hBLshpNDmGjFaoiWgb1ccH/WG7XlQYWhlthKRprfEZxNn5xs 7PgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc; bh=Ximx3byfJ7rLtdPEIh1Ra0raz9MzgSTr/ga3ge5UvWM=; b=3WFJEz4UPgoGwoCHMS9PiVZxGhnmEM9KGUYeT51YSDdxjjC7SyeyZ/OEuoZzs2HT/A nYiyatL6DTf9nmfoIaAzkgxcOnBBtCM5fk7D5DHgeL9IzrsS/uvCww77iNUwvrwSFh5r Zb6vPFLP7z0/jVQ/QhOAJIfrlZ/M1qyU1oy+vl6kg2NEn5ZLnWuI/VL54kIuTkFHX2lC PSlWUR/88hC1+ffkHE6443Baow26BG5kxhK+aaMoORvbCqmYQ9XprkYgl01WFnx5GZl7 SFRp4TaBx4jqU3i7xUF1hz5qGIr8jBBSajSQoQoNuVYYsv8s2om05+/dNT4A7xyYSc4d 2mSA== X-Gm-Message-State: ACgBeo1fj0TyKLgkQx8XN33BYnhGwzWxI7sbkdXy8YWLEYDcwmj9aKdW v0/tRqwGHszqbCBvXegJiWUCUEN0rto= X-Received: from surenb-desktop.mtv.corp.google.com ([2620:15c:211:200:a005:55b3:6c26:b3e4]) (user=surenb job=sendgmr) by 2002:a0d:d98c:0:b0:33d:c482:9714 with SMTP id b134-20020a0dd98c000000b0033dc4829714mr15776751ywe.415.1661896174717; Tue, 30 Aug 2022 14:49:34 -0700 (PDT) Date: Tue, 30 Aug 2022 14:48:53 -0700 In-Reply-To: <20220830214919.53220-1-surenb@google.com> Mime-Version: 1.0 References: <20220830214919.53220-1-surenb@google.com> X-Mailer: git-send-email 2.37.2.672.g94769d06f0-goog Message-ID: <20220830214919.53220-5-surenb@google.com> Subject: [RFC PATCH 04/30] scripts/kallysms: Always include __start and __stop symbols From: Suren Baghdasaryan To: akpm@linux-foundation.org Cc: kent.overstreet@linux.dev, mhocko@suse.com, vbabka@suse.cz, hannes@cmpxchg.org, roman.gushchin@linux.dev, mgorman@suse.de, dave@stgolabs.net, willy@infradead.org, liam.howlett@oracle.com, void@manifault.com, peterz@infradead.org, juri.lelli@redhat.com, ldufour@linux.ibm.com, peterx@redhat.com, david@redhat.com, axboe@kernel.dk, mcgrof@kernel.org, masahiroy@kernel.org, nathan@kernel.org, changbin.du@intel.com, ytcoode@gmail.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, bristot@redhat.com, vschneid@redhat.com, cl@linux.com, penberg@kernel.org, iamjoonsoo.kim@lge.com, 42.hyeyoo@gmail.com, glider@google.com, elver@google.com, dvyukov@google.com, shakeelb@google.com, songmuchun@bytedance.com, arnd@arndb.de, jbaron@akamai.com, rientjes@google.com, minchan@google.com, kaleshsingh@google.com, surenb@google.com, kernel-team@android.com, linux-mm@kvack.org, iommu@lists.linux.dev, kasan-dev@googlegroups.com, io-uring@vger.kernel.org, linux-arch@vger.kernel.org, xen-devel@lists.xenproject.org, linux-bcache@vger.kernel.org, linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kent Overstreet These symbols are used to denote section boundaries: by always including them we can unify loading sections from modules with loading built-in sections, which leads to some significant cleanup. Signed-off-by: Kent Overstreet --- scripts/kallsyms.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index f18e6dfc68c5..3d51639a595d 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -263,6 +263,11 @@ static int symbol_in_range(const struct sym_entry *s, return 0; } +static bool string_starts_with(const char *s, const char *prefix) +{ + return strncmp(s, prefix, strlen(prefix)) == 0; +} + static int symbol_valid(const struct sym_entry *s) { const char *name = sym_name(s); @@ -270,6 +275,14 @@ static int symbol_valid(const struct sym_entry *s) /* if --all-symbols is not specified, then symbols outside the text * and inittext sections are discarded */ if (!all_symbols) { + /* + * Symbols starting with __start and __stop are used to denote + * section boundaries, and should always be included: + */ + if (string_starts_with(name, "__start_") || + string_starts_with(name, "__stop_")) + return 1; + if (symbol_in_range(s, text_ranges, ARRAY_SIZE(text_ranges)) == 0) return 0; -- 2.37.2.672.g94769d06f0-goog