• Rasmus Villemoes's avatar
    kbuild: apply fixdep logic to link-vmlinux.sh · 0b956e20
    Rasmus Villemoes authored
    The patch adding CONFIG_VMLINUX_MAP revealed a small defect in the
    build system: link-vmlinux.sh takes decisions based on CONFIG_*
    options, but changing one of those does not always lead to vmlinux
    being linked again.
    
    For most of the CONFIG_* knobs referenced previously, this has
    probably been hidden by those knobs also affecting some object file,
    hence indirectly also vmlinux.
    
    But CONFIG_VMLINUX_MAP is only handled inside link-vmlinux.sh, and
    changing CONFIG_VMLINUX_MAP=n to CONFIG_VMLINUX_MAP=y does not cause
    the build system to re-link (and hence have vmlinux.map
    emitted). Since that map file is mostly a debugging aid, this is
    merely a nuisance which is easily worked around by just deleting
    vmlinux and building again.
    
    But one could imagine other (possibly future) CONFIG options that
    actually do affect the vmlinux binary but which are not captured
    through some object file dependency.
    
    To fix this, make link-vmlinux.sh emit a .vmlinux.d file in the same
    format as the dependency files generated by gcc, and apply the fixdep
    logic to that. I've tested that this correctly works with both in-tree
    and out-of-tree builds.
    Signed-off-by: default avatarRasmus Villemoes <linux@rasmusvillemoes.dk>
    Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
    0b956e20
link-vmlinux.sh 11.1 KB