Skip to content

Commit a7f13d0

Browse files
Kent Overstreetakpm00
authored andcommitted
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/[email protected] Signed-off-by: Kent Overstreet <[email protected]> Signed-off-by: Suren Baghdasaryan <[email protected]> Reviewed-by: Kees Cook <[email protected]> Reviewed-by: Pasha Tatashin <[email protected]> Tested-by: Kees Cook <[email protected]> Cc: Alexander Viro <[email protected]> Cc: Alex Gaynor <[email protected]> Cc: Alice Ryhl <[email protected]> Cc: Andreas Hindborg <[email protected]> Cc: Benno Lossin <[email protected]> Cc: "Björn Roy Baron" <[email protected]> Cc: Boqun Feng <[email protected]> Cc: Christoph Lameter <[email protected]> Cc: Dennis Zhou <[email protected]> Cc: Gary Guo <[email protected]> Cc: Miguel Ojeda <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Tejun Heo <[email protected]> Cc: Vlastimil Babka <[email protected]> Cc: Wedson Almeida Filho <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 9ea9cd8 commit a7f13d0

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

scripts/kallsyms.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,13 +204,26 @@ static int symbol_in_range(const struct sym_entry *s,
204204
return 0;
205205
}
206206

207+
static bool string_starts_with(const char *s, const char *prefix)
208+
{
209+
return strncmp(s, prefix, strlen(prefix)) == 0;
210+
}
211+
207212
static int symbol_valid(const struct sym_entry *s)
208213
{
209214
const char *name = sym_name(s);
210215

211216
/* if --all-symbols is not specified, then symbols outside the text
212217
* and inittext sections are discarded */
213218
if (!all_symbols) {
219+
/*
220+
* Symbols starting with __start and __stop are used to denote
221+
* section boundaries, and should always be included:
222+
*/
223+
if (string_starts_with(name, "__start_") ||
224+
string_starts_with(name, "__stop_"))
225+
return 1;
226+
214227
if (symbol_in_range(s, text_ranges,
215228
ARRAY_SIZE(text_ranges)) == 0)
216229
return 0;

0 commit comments

Comments
 (0)