]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
kallsyms: fix /proc/kallmodsyms to not be misled by const variables
authorNick Alcock <nick.alcock@oracle.com>
Mon, 15 Jun 2015 16:47:42 +0000 (17:47 +0100)
committerNick Alcock <nick.alcock@oracle.com>
Tue, 21 Jul 2015 14:30:12 +0000 (15:30 +0100)
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 <nick.alcock@oracle.com>
Acked-by: Kris Van Hees <kris.van.hees@oracle.com>
scripts/kallsyms.c

index 18a96d383464c3bc89ef01b63dadac6d9bdcaefd..9b3941d50aa0b1860662d9b4117d8eee1fd20e77 100644 (file)
@@ -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) {