This section will contain read-only data for values of kernel symbol
flags in the form of an 8-bit bitsets for each kernel symbol. Each bit
in the bitset represents a flag value defined by ksym_flags enumeration.

The kflagstab section introduces a 1-byte overhead for each symbol
exported in the ksymtab. Given that typical kernel builds contain
roughly a few thousand exported symbols, the resulting memory increase
is negligible.

Signed-off-by: Siddharth Nayyar <[email protected]>
---
 include/asm-generic/vmlinux.lds.h | 7 +++++++
 scripts/module.lds.S              | 1 +
 2 files changed, 8 insertions(+)

diff --git a/include/asm-generic/vmlinux.lds.h 
b/include/asm-generic/vmlinux.lds.h
index eeb070f330bd..8f825dcbfae4 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -536,6 +536,13 @@
                __stop___kcrctab_gpl = .;                               \
        }                                                               \
                                                                        \
+       /* Kernel symbol flags table */                                 \
+       __kflagstab       : AT(ADDR(__kflagstab) - LOAD_OFFSET) {       \
+               __start___kflagstab = .;                                \
+               KEEP(*(SORT(___kflagstab+*)))                           \
+               __stop___kflagstab = .;                                 \
+       }                                                               \
+                                                                       \
        /* Kernel symbol table: strings */                              \
         __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) {        
\
                *(__ksymtab_strings)                                    \
diff --git a/scripts/module.lds.S b/scripts/module.lds.S
index 054ef99e8288..d7a8ba278dfc 100644
--- a/scripts/module.lds.S
+++ b/scripts/module.lds.S
@@ -23,6 +23,7 @@ SECTIONS {
        __ksymtab_gpl           0 : ALIGN(8) { *(SORT(___ksymtab_gpl+*)) }
        __kcrctab               0 : ALIGN(4) { *(SORT(___kcrctab+*)) }
        __kcrctab_gpl           0 : ALIGN(4) { *(SORT(___kcrctab_gpl+*)) }
+       __kflagstab             0 : ALIGN(1) { *(SORT(___kflagstab+*)) }
 
        .ctors                  0 : ALIGN(8) { *(SORT(.ctors.*)) *(.ctors) }
        .init_array             0 : ALIGN(8) { *(SORT(.init_array.*)) 
*(.init_array) }

-- 
2.53.0.473.g4a7958ca14-goog


Reply via email to