Since the modules loader determines whether an exported symbol is GPL
only from the kflagstab section data, modpost can put all symbols in the
regular ksymtab and stop using the *_gpl versions of the ksymtab and
kcrctab.

Signed-off-by: Siddharth Nayyar <sidnay...@google.com>
---
 include/linux/export-internal.h | 21 +++++++++++----------
 scripts/mod/modpost.c           |  8 ++++----
 2 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/include/linux/export-internal.h b/include/linux/export-internal.h
index 4123c7592404..726054614752 100644
--- a/include/linux/export-internal.h
+++ b/include/linux/export-internal.h
@@ -37,14 +37,14 @@
  * section flag requires it. Use '%progbits' instead of '@progbits' since the
  * former apparently works on all arches according to the binutils source.
  */
-#define __KSYMTAB(name, sym, sec, ns)                                          
\
+#define __KSYMTAB(name, sym, ns)                                               
\
        asm("   .section \"__ksymtab_strings\",\"aMS\",%progbits,1"     "\n"    
\
            "__kstrtab_" #name ":"                                      "\n"    
\
            "   .asciz \"" #name "\""                                   "\n"    
\
            "__kstrtabns_" #name ":"                                    "\n"    
\
            "   .asciz \"" ns "\""                                      "\n"    
\
            "   .previous"                                              "\n"    
\
-           "   .section \"___ksymtab" sec "+" #name "\", \"a\""        "\n"    
\
+           "   .section \"___ksymtab+" #name "\", \"a\""               "\n"    
\
                __KSYM_ALIGN                                            "\n"    
\
            "__ksymtab_" #name ":"                                      "\n"    
\
                __KSYM_REF(sym)                                         "\n"    
\
@@ -59,15 +59,16 @@
 #define KSYM_FUNC(name)                name
 #endif
 
-#define KSYMTAB_FUNC(name, sec, ns)    __KSYMTAB(name, KSYM_FUNC(name), sec, 
ns)
-#define KSYMTAB_DATA(name, sec, ns)    __KSYMTAB(name, name, sec, ns)
+#define KSYMTAB_FUNC(name, ns) __KSYMTAB(name, KSYM_FUNC(name), ns)
+#define KSYMTAB_DATA(name, ns) __KSYMTAB(name, name, ns)
 
-#define SYMBOL_CRC(sym, crc, sec)   \
-       asm(".section \"___kcrctab" sec "+" #sym "\",\"a\""     "\n" \
-           ".balign 4"                                         "\n" \
-           "__crc_" #sym ":"                                   "\n" \
-           ".long " #crc                                       "\n" \
-           ".previous"                                         "\n")
+#define SYMBOL_CRC(sym, crc)                                   \
+       asm("   .section \"___kcrctab+" #sym "\",\"a\"" "\n"    \
+           "   .balign 4"                              "\n"    \
+           "__crc_" #sym ":"                           "\n"    \
+           "   .long " #crc                            "\n"    \
+           "   .previous"                              "\n"    \
+       )
 
 #define SYMBOL_FLAGS(sym, flags)                                       \
        asm("   .section \"___kflagstab+" #sym "\",\"a\""       "\n"    \
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index f5ce7aeed52d..8936db84779b 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -1867,9 +1867,9 @@ static void add_exported_symbols(struct buffer *buf, 
struct module *mod)
                if (trim_unused_exports && !sym->used)
                        continue;
 
-               buf_printf(buf, "KSYMTAB_%s(%s, \"%s\", \"%s\");\n",
+               buf_printf(buf, "KSYMTAB_%s(%s, \"%s\");\n",
                           sym->is_func ? "FUNC" : "DATA", sym->name,
-                          sym->is_gpl_only ? "_gpl" : "", sym->namespace);
+                          sym->namespace);
 
                buf_printf(buf, "SYMBOL_FLAGS(%s, 0x%02x);\n",
                           sym->name, get_symbol_flags(sym));
@@ -1890,8 +1890,8 @@ static void add_exported_symbols(struct buffer *buf, 
struct module *mod)
                             sym->name, mod->name, mod->is_vmlinux ? "" : ".ko",
                             sym->name);
 
-               buf_printf(buf, "SYMBOL_CRC(%s, 0x%08x, \"%s\");\n",
-                          sym->name, sym->crc, sym->is_gpl_only ? "_gpl" : "");
+               buf_printf(buf, "SYMBOL_CRC(%s, 0x%08x);\n",
+                          sym->name, sym->crc);
        }
 }
 
-- 
2.51.0.338.gd7d06c2dae-goog


Reply via email to