• Kris Van Hees's avatar
    scripts: add verifier script for builtin module range data · ac7bd094
    Kris Van Hees authored
    The modules.builtin.ranges offset range data for builtin modules is
    generated at compile time based on the list of built-in modules and
    the vmlinux.map and vmlinux.o.map linker maps.  This data can be used
    to determine whether a symbol at a particular address belongs to
    module code that was configured to be compiled into the kernel proper
    as a built-in module (rather than as a standalone module).
    
    This patch adds a script that uses the generated modules.builtin.ranges
    data to annotate the symbols in the System.map with module names if
    their address falls within a range that belongs to one or more built-in
    modules.
    
    It then processes the vmlinux.map (and if needed, vmlinux.o.map) to
    verify the annotation:
    
      - For each top-level section:
         - For each object in the section:
            - Determine whether the object is part of a built-in module
              (using modules.builtin and the .*.cmd file used to compile
               the object as suggested in [0])
            - For each symbol in that object, verify that the built-in
              module association (or lack thereof) matches the annotation
              given to the symbol.
    Signed-off-by: default avatarKris Van Hees <kris.van.hees@oracle.com>
    Reviewed-by: default avatarNick Alcock <nick.alcock@oracle.com>
    Reviewed-by: default avatarAlan Maguire <alan.maguire@oracle.com>
    Tested-by: default avatarSam James <sam@gentoo.org>
    Reviewed-by: default avatarSami Tolvanen <samitolvanen@google.com>
    Tested-by: default avatarSami Tolvanen <samitolvanen@google.com>
    Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
    ac7bd094
verify_builtin_ranges.awk 9.12 KB