mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2024-12-29 09:13:38 +00:00
scripts/kallysms: always include __start and __stop symbols
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. Link: https://lkml.kernel.org/r/20240321163705.3067592-5-surenb@google.com Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> Signed-off-by: Suren Baghdasaryan <surenb@google.com> Reviewed-by: Kees Cook <keescook@chromium.org> Reviewed-by: Pasha Tatashin <pasha.tatashin@soleen.com> Tested-by: Kees Cook <keescook@chromium.org> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Cc: Alex Gaynor <alex.gaynor@gmail.com> Cc: Alice Ryhl <aliceryhl@google.com> Cc: Andreas Hindborg <a.hindborg@samsung.com> Cc: Benno Lossin <benno.lossin@proton.me> Cc: "Björn Roy Baron" <bjorn3_gh@protonmail.com> Cc: Boqun Feng <boqun.feng@gmail.com> Cc: Christoph Lameter <cl@linux.com> Cc: Dennis Zhou <dennis@kernel.org> Cc: Gary Guo <gary@garyguo.net> Cc: Miguel Ojeda <ojeda@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Tejun Heo <tj@kernel.org> Cc: Vlastimil Babka <vbabka@suse.cz> Cc: Wedson Almeida Filho <wedsonaf@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
9ea9cd8e61
commit
a7f13d0f4b
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user