From patchwork Tue Oct 24 13:45:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suren Baghdasaryan X-Patchwork-Id: 13434530 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34A3DC25B6D for ; Tue, 24 Oct 2023 13:46:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9E6456B0256; Tue, 24 Oct 2023 09:46:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9463B6B0257; Tue, 24 Oct 2023 09:46:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7996A6B0258; Tue, 24 Oct 2023 09:46:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 4D9956B0256 for ; Tue, 24 Oct 2023 09:46:49 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 223B8B5DA5 for ; Tue, 24 Oct 2023 13:46:49 +0000 (UTC) X-FDA: 81380480538.25.DA65B13 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) by imf25.hostedemail.com (Postfix) with ESMTP id 3DF69A0010 for ; Tue, 24 Oct 2023 13:46:47 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=Pljd7L7m; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf25.hostedemail.com: domain of 3xco3ZQYKCGoacZMVJOWWOTM.KWUTQVcf-UUSdIKS.WZO@flex--surenb.bounces.google.com designates 209.85.219.201 as permitted sender) smtp.mailfrom=3xco3ZQYKCGoacZMVJOWWOTM.KWUTQVcf-UUSdIKS.WZO@flex--surenb.bounces.google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1698155207; a=rsa-sha256; cv=none; b=KtJGkCH0uo2GRO+TtJN5DADADPmQdgL4hMmf17jLDtHEuxkx71BSG7d8Y2xEPF8OaqteZ8 iPQaYwYHOg5GUWUD8+NcgLmPNCAwajBbAexwX4Yi18O+o2UxEZi2rBYgWFFYfwOfKXGJeo DnUCU+WT5IYNdLAHUGJn9ZeTeVkggys= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=Pljd7L7m; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf25.hostedemail.com: domain of 3xco3ZQYKCGoacZMVJOWWOTM.KWUTQVcf-UUSdIKS.WZO@flex--surenb.bounces.google.com designates 209.85.219.201 as permitted sender) smtp.mailfrom=3xco3ZQYKCGoacZMVJOWWOTM.KWUTQVcf-UUSdIKS.WZO@flex--surenb.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1698155207; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=fObhDXE+DfK48fbfXMStFHtHAmn90M4M91A2l4CxzLM=; b=HlSzwbWzmo8TVdDVJVlUJJliYXMXOZR6onV/5q6ntVOcz9RhkGC1jdd3Ek4+hge3mCgKPN ijGFmMaE4QQXfdJSdj8taGVXxlPu0El2jpKL6TYiaOS3+shQBEMU74K+f0DFmhj4+v5hu1 g8KSOXYdRTqlp0Fms2N6nUydcJ1nZm0= Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-d9cad450d5fso5174017276.1 for ; Tue, 24 Oct 2023 06:46:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1698155206; x=1698760006; darn=kvack.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=fObhDXE+DfK48fbfXMStFHtHAmn90M4M91A2l4CxzLM=; b=Pljd7L7mhLJQIfZuMGinpXlQx5kgBVHjLuGFlr85EfFkaiXNLqf0VlgxiALKYS48R0 dJkehTF76N0/CqDVs8ZsYV593Nn5+Dwanb8AAjQn7eYhstvSlgQ2IYXfQAM/x4xNHgIn R0bCzYdIUs/cV3h/61p4NX7qJ1semc6YHlsBfBb7U3LvIi/blyjPn3JNiCEwTzWyZb61 daNqqxjjeVUi4uoplmeAdZSCm9lNPbe2KGTWcG8Q2TEhi/wnFrjPDNJmiNP8iMrs/rlc Uc3X7JZRK3h/FHF3COU8hY36TCD+c0lrA9s8zGW6KqlBUov1PCnoME7Z8S1PNTsdn4dH Y4mA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698155206; x=1698760006; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=fObhDXE+DfK48fbfXMStFHtHAmn90M4M91A2l4CxzLM=; b=db8oEDOaw+uKwaOMqpM1EsvwIubaoTLuTOEVfKsyNsqhNzqPADEcjAlOHaYXmq31RY 7Q5DzmdWnetxxqi7pxIYeI93YERHl47GUY6vHWkYGcmKu+w6YTnDaogrEAifkrChl4+s 0xnifUc52xyhoAk0COAkTXgciIM2hwTkksFagD8OqyAGhDQxZOZBGGLjtuXYDW3p5bsa b40Y26+jMEwqKAfiRQ1koukioz0lVMlWsbNWm674/0oqEa5qGovOb31DMLVxiUgkYSf8 +o7UkviebRj4AG41Me01U2B+KHHsAJ5/cDmMUH+JBGFSWCtT6rGfMJhswSVUZfqnlf3y hmwQ== X-Gm-Message-State: AOJu0YyvOiWoy3wBYvIYCN235d5XIjiTwmuTT8GMD/Y8NXrNu7JO6Kf7 NU3qqWQsKWzNVFHtBiYPctZtrD35LOE= X-Google-Smtp-Source: AGHT+IGzqDmmVKWAX0qOLCG4zSSOu2XUUgzUKaIXDvA8+3j+t9o+p5RCbsfa+aQ1r6gMSAIrcYIsUr6/0f0= X-Received: from surenb-desktop.mtv.corp.google.com ([2620:15c:211:201:45ba:3318:d7a5:336a]) (user=surenb job=sendgmr) by 2002:a25:5008:0:b0:da0:2b01:7215 with SMTP id e8-20020a255008000000b00da02b017215mr55818ybb.10.1698155205957; Tue, 24 Oct 2023 06:46:45 -0700 (PDT) Date: Tue, 24 Oct 2023 06:45:59 -0700 In-Reply-To: <20231024134637.3120277-1-surenb@google.com> Mime-Version: 1.0 References: <20231024134637.3120277-1-surenb@google.com> X-Mailer: git-send-email 2.42.0.758.gaed0368e0e-goog Message-ID: <20231024134637.3120277-3-surenb@google.com> Subject: [PATCH v2 02/39] 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, corbet@lwn.net, void@manifault.com, peterz@infradead.org, juri.lelli@redhat.com, ldufour@linux.ibm.com, catalin.marinas@arm.com, will@kernel.org, arnd@arndb.de, tglx@linutronix.de, mingo@redhat.com, dave.hansen@linux.intel.com, x86@kernel.org, peterx@redhat.com, david@redhat.com, axboe@kernel.dk, mcgrof@kernel.org, masahiroy@kernel.org, nathan@kernel.org, dennis@kernel.org, tj@kernel.org, muchun.song@linux.dev, rppt@kernel.org, paulmck@kernel.org, pasha.tatashin@soleen.com, yosryahmed@google.com, yuzhao@google.com, dhowells@redhat.com, hughd@google.com, andreyknvl@gmail.com, keescook@chromium.org, ndesaulniers@google.com, vvvvvv@google.com, gregkh@linuxfoundation.org, ebiggers@google.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, jbaron@akamai.com, rientjes@google.com, minchan@google.com, kaleshsingh@google.com, surenb@google.com, kernel-team@android.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, iommu@lists.linux.dev, linux-arch@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-modules@vger.kernel.org, kasan-dev@googlegroups.com, cgroups@vger.kernel.org X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 3DF69A0010 X-Stat-Signature: byhicsnjnatwpqbcrejfc6qztmtrwqem X-HE-Tag: 1698155207-790440 X-HE-Meta: U2FsdGVkX19746M165bXqhvnn8qt6vfB0pl4QFkqfnsMCRcrpcKY+YPIrpWqeAWBaRPc1cDJSQlyeOnJ0BtIvQFS8MNIgL+09Z6/1Cklbsxyt+NX5C9g7dLShPWwep5lQ0YY7dPun2A+jkbo65bo/3tiCs1NeXlP2hbmKMJNWjzFni7zvhWsvnVKM9RDUkfLZexmlpwoQton3y8XW+O4GUD8ObmNzMOu5jMusk0gtlDApd0/dgqxvtKfZ64ZeGCqtKx9lfcXYnzKTGgVyieYkl6AVVfXaml7C9ZoVTAKFRgL5Xx0NX7p8iAQ1sBu+1HyYKygJ5aR1FUbOm+w2+cDpY9BxUfN6V1cMfhvbFjIFl1lh/kNOBqWNvcGPUVt5vRdzvVUEQaOTTEYG6czlbyBXTZi1vvfTbjp43ciJv6MlfehDBn9UwBXtJVOufO+820Ld4SOpe+gA4b9q0fD2AYSvfy3kGC5PNt21rgcPlXds8WasjAL0Apeej7GwmQcYmo7I34loATOw4b4MsFYozyHKv9WAf2BEal/FniL/mFm0C4VWF3JZ2xyFmuIqXhGXDAI5eEvcJ8xyZ4FPy3rLE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zZzJOSl2btkK14cPX4Hq5At0KPa9hd1T9W/dLJPnc//HAAL/CCUFZ X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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 Signed-off-by: Suren Baghdasaryan --- scripts/kallsyms.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index 653b92f6d4c8..47978efe4797 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -204,6 +204,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); @@ -211,6 +216,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;