From: Nick Alcock Date: Mon, 15 Jun 2015 16:47:42 +0000 (+0100) Subject: kallsyms: fix /proc/kallmodsyms to not be misled by const variables X-Git-Tag: v4.1.12-92~313^2~8 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=6e9d5be0c0c3e899c79623a91cfe422821a5c365;p=users%2Fjedix%2Flinux-maple.git kallsyms: fix /proc/kallmodsyms to not be misled by const variables The recent fix to bug 21172433 caused all symbols with the external DWARF attribute which appear in only one built-in module to be considered part of that module rather than part of the core kernel as far as /proc/kallmodsyms is concerned. Unfortunately, this is the wrong DWARF attribute to use: it indicates that the content is visible outside this compilation unit, which is of course true even of the definition of anything which *can* be declared 'extern' (since it is, of course, not declared 'static'). The right attribute to use is the declaration attribute, which is unset only for the definition -- the module containing the translation unit in which a variable is defined is surely the module in which that variable resides. Orabug: 21257163 Signed-off-by: Nick Alcock Acked-by: Kris Van Hees --- diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index 18a96d383464..9b3941d50aa0 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -784,7 +784,7 @@ static void read_module_symbols(unsigned int module_name, do { if (((dwarf_tag(&toplevel) == DW_TAG_subprogram) || (dwarf_tag(&toplevel) == DW_TAG_variable)) && - !dwarf_hasattr(&toplevel, DW_AT_external)) { + !dwarf_hasattr(&toplevel, DW_AT_declaration)) { if (module_idx == NULL) { module_idx = malloc(sizeof(unsigned int)); if (module_idx == NULL) {