diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2022-08-08 17:02:58 -0400 |
---|---|---|
committer | Suren Baghdasaryan <surenb@google.com> | 2022-08-30 01:27:34 +0000 |
commit | d0b7da37d07250773d078d3f640e8ffe6627392b (patch) | |
tree | 0ffd2e9ecd071dda0b57d16c0f578d24714f22a1 | |
parent | 58242e14e71e6823f89e5f67c3647587df4d3463 (diff) |
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.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r-- | scripts/kallsyms.c | 13 |
1 files changed, 13 insertions, 0 deletions
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; |