^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) #!/bin/sh
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) # SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) # link vmlinux
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) # vmlinux is linked from the objects selected by $(KBUILD_VMLINUX_OBJS) and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) # $(KBUILD_VMLINUX_LIBS). Most are built-in.a files from top-level directories
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) # in the kernel tree, others are specified in arch/$(ARCH)/Makefile.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) # $(KBUILD_VMLINUX_LIBS) are archives which are linked conditionally
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) # (not within --whole-archive), and do not require symbol indexes added.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) # vmlinux
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) # ^
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) # |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) # +--< $(KBUILD_VMLINUX_OBJS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) # | +--< init/built-in.a drivers/built-in.a mm/built-in.a + more
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) # |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) # +--< $(KBUILD_VMLINUX_LIBS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) # | +--< lib/lib.a + more
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) # |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) # +-< ${kallsymso} (see description in KALLSYMS section)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) # vmlinux version (uname -v) cannot be updated during normal
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) # descending-into-subdirs phase since we do not yet know if we need to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) # update vmlinux.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) # Therefore this step is delayed until just before final link of vmlinux.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) # System.map is generated to document addresses of all kernel symbols
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) # Error out on error
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) set -e
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) LD="$1"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) KBUILD_LDFLAGS="$2"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) LDFLAGS_vmlinux="$3"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) # Nice output in kbuild format
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) # Will be supressed by "make -s"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) info()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) if [ "${quiet}" != "silent_" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) printf " %-7s %s\n" "${1}" "${2}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) # Generate a linker script to ensure correct ordering of initcalls.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) gen_initcalls()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) info GEN .tmp_initcalls.lds
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) ${PYTHON} ${srctree}/scripts/jobserver-exec \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) ${PERL} ${srctree}/scripts/generate_initcall_order.pl \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) ${KBUILD_VMLINUX_OBJS} ${KBUILD_VMLINUX_LIBS} \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) > .tmp_initcalls.lds
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) # If CONFIG_LTO_CLANG is selected, collect generated symbol versions into
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) # .tmp_symversions.lds
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) gen_symversions()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) info GEN .tmp_symversions.lds
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) rm -f .tmp_symversions.lds
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) for o in ${KBUILD_VMLINUX_OBJS} ${KBUILD_VMLINUX_LIBS}; do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) if [ -f ${o}.symversions ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) cat ${o}.symversions >> .tmp_symversions.lds
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) # Link of vmlinux.o used for section mismatch analysis
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) # ${1} output file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) modpost_link()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) local objects
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) local lds=""
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) objects="--whole-archive \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) ${KBUILD_VMLINUX_OBJS} \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) --no-whole-archive \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) --start-group \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) ${KBUILD_VMLINUX_LIBS} \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) --end-group"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) if [ -n "${CONFIG_LTO_CLANG}" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) gen_initcalls
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) lds="-T .tmp_initcalls.lds"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) if [ -n "${CONFIG_MODVERSIONS}" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) gen_symversions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) lds="${lds} -T .tmp_symversions.lds"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) # This might take a while, so indicate that we're doing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) # an LTO link
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) info LTO ${1}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) info LD ${1}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) ${LD} ${KBUILD_LDFLAGS} -r -o ${1} ${lds} ${objects}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) objtool_link()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) local objtoolcmd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) local objtoolopt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) if [ "${CONFIG_LTO_CLANG} ${CONFIG_STACK_VALIDATION}" = "y y" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) # Don't perform vmlinux validation unless explicitly requested,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) # but run objtool on vmlinux.o now that we have an object file.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) if [ -n "${CONFIG_UNWINDER_ORC}" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) objtoolcmd="orc generate"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) objtoolopt="${objtoolopt} --duplicate"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) if [ -n "${CONFIG_FTRACE_MCOUNT_USE_OBJTOOL}" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) objtoolopt="${objtoolopt} --mcount"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) if [ -n "${CONFIG_VMLINUX_VALIDATION}" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) objtoolopt="${objtoolopt} --noinstr"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) if [ -n "${objtoolopt}" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) if [ -z "${objtoolcmd}" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) objtoolcmd="check"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) objtoolopt="${objtoolopt} --vmlinux"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) if [ -z "${CONFIG_FRAME_POINTER}" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) objtoolopt="${objtoolopt} --no-fp"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) if [ -n "${CONFIG_GCOV_KERNEL}" ] || [ -n "${CONFIG_LTO_CLANG}" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) objtoolopt="${objtoolopt} --no-unreachable"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) if [ -n "${CONFIG_RETPOLINE}" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) objtoolopt="${objtoolopt} --retpoline"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) if [ -n "${CONFIG_X86_SMAP}" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) objtoolopt="${objtoolopt} --uaccess"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) info OBJTOOL ${1}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) tools/objtool/objtool ${objtoolcmd} ${objtoolopt} ${1}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) # Link of vmlinux
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) # ${1} - output file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) # ${2}, ${3}, ... - optional extra .o files
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) vmlinux_link()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) local lds="${objtree}/${KBUILD_LDS}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) local output=${1}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) local objects
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) local strip_debug
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) info LD ${output}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) # skip output file argument
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) shift
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) # The kallsyms linking does not need debug symbols included.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) if [ "$output" != "${output#.tmp_vmlinux.kallsyms}" ] ; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) strip_debug=-Wl,--strip-debug
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) if [ "${SRCARCH}" != "um" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) if [ -n "${CONFIG_LTO_CLANG}" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) # Use vmlinux.o instead of performing the slow LTO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) # link again.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) objects="--whole-archive \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) vmlinux.o \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) --no-whole-archive \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) ${@}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) objects="--whole-archive \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) ${KBUILD_VMLINUX_OBJS} \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) --no-whole-archive \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) --start-group \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) ${KBUILD_VMLINUX_LIBS} \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) --end-group \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) ${@}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) ${LD} ${KBUILD_LDFLAGS} ${LDFLAGS_vmlinux} \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) ${strip_debug#-Wl,} \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) -o ${output} \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) -T ${lds} ${objects}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) objects="-Wl,--whole-archive \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) ${KBUILD_VMLINUX_OBJS} \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) -Wl,--no-whole-archive \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) -Wl,--start-group \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) ${KBUILD_VMLINUX_LIBS} \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) -Wl,--end-group \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) ${@}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) ${CC} ${CFLAGS_vmlinux} \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) ${strip_debug} \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) -o ${output} \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) -Wl,-T,${lds} \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) ${objects} \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) -lutil -lrt -lpthread
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) rm -f linux
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) # generate .BTF typeinfo from DWARF debuginfo
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) # ${1} - vmlinux image
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) # ${2} - file to dump raw BTF data into
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) gen_btf()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) local pahole_ver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) if ! [ -x "$(command -v ${PAHOLE})" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) echo >&2 "BTF: ${1}: pahole (${PAHOLE}) is not available"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) return 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) pahole_ver=$(${PAHOLE} --version | sed -E 's/v([0-9]+)\.([0-9]+)/\1\2/')
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) if [ "${pahole_ver}" -lt "116" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) echo >&2 "BTF: ${1}: pahole version $(${PAHOLE} --version) is too old, need at least v1.16"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) return 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) vmlinux_link ${1}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) info "BTF" ${2}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) LLVM_OBJCOPY=${OBJCOPY} ${PAHOLE} -J ${1}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) # Create ${2} which contains just .BTF section but no symbols. Add
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) # SHF_ALLOC because .BTF will be part of the vmlinux image. --strip-all
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) # deletes all symbols including __start_BTF and __stop_BTF, which will
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) # be redefined in the linker script. Add 2>/dev/null to suppress GNU
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) # objcopy warnings: "empty loadable segment detected at ..."
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) ${OBJCOPY} --only-section=.BTF --set-section-flags .BTF=alloc,readonly \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) --strip-all ${1} ${2} 2>/dev/null
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) # Change e_type to ET_REL so that it can be used to link final vmlinux.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) # Unlike GNU ld, lld does not allow an ET_EXEC input.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) printf '\1' | dd of=${2} conv=notrunc bs=1 seek=16 status=none
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) # Create ${2} .S file with all symbols from the ${1} object file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) kallsyms()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) local kallsymopt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) if [ -n "${CONFIG_KALLSYMS_ALL}" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) kallsymopt="${kallsymopt} --all-symbols"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) if [ -n "${CONFIG_KALLSYMS_ABSOLUTE_PERCPU}" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) kallsymopt="${kallsymopt} --absolute-percpu"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) if [ -n "${CONFIG_KALLSYMS_BASE_RELATIVE}" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) kallsymopt="${kallsymopt} --base-relative"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) info KSYMS ${2}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) if [ -n "${CONFIG_CFI_CLANG}" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) ${PERL} ${srctree}/scripts/generate_cfi_kallsyms.pl ${1} | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) sort -n > .tmp_kallsyms
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) ${NM} -n ${1} > .tmp_kallsyms
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) scripts/kallsyms ${kallsymopt} < .tmp_kallsyms > ${2}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) # Perform one step in kallsyms generation, including temporary linking of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) # vmlinux.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) kallsyms_step()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) kallsymso_prev=${kallsymso}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) kallsyms_vmlinux=.tmp_vmlinux.kallsyms${1}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) kallsymso=${kallsyms_vmlinux}.o
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) kallsyms_S=${kallsyms_vmlinux}.S
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) vmlinux_link ${kallsyms_vmlinux} "${kallsymso_prev}" ${btf_vmlinux_bin_o}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) kallsyms ${kallsyms_vmlinux} ${kallsyms_S}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) info AS ${kallsyms_S}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) ${CC} ${NOSTDINC_FLAGS} ${LINUXINCLUDE} ${KBUILD_CPPFLAGS} \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) ${KBUILD_AFLAGS} ${KBUILD_AFLAGS_KERNEL} \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) -c -o ${kallsymso} ${kallsyms_S}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) # Create map file with all symbols from ${1}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) # See mksymap for additional details
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) mksysmap()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) ${CONFIG_SHELL} "${srctree}/scripts/mksysmap" ${1} ${2}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) sorttable()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) ${objtree}/scripts/sorttable ${1}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) # Delete output files in case of error
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) cleanup()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) rm -f .btf.*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) rm -f .tmp_System.map
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) rm -f .tmp_kallsyms
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) rm -f .tmp_initcalls.lds
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) rm -f .tmp_symversions.lds
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) rm -f .tmp_vmlinux*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) rm -f System.map
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) rm -f vmlinux
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) rm -f vmlinux.o
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) on_exit()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) if [ $? -ne 0 ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) cleanup
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) trap on_exit EXIT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) on_signals()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) exit 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) trap on_signals HUP INT QUIT TERM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) # Use "make V=1" to debug this script
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) case "${KBUILD_VERBOSE}" in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) *1*)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) set -x
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) ;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) esac
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) if [ "$1" = "clean" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) cleanup
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) exit 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) # We need access to CONFIG_ symbols
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) . include/config/auto.conf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) # Update version
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) info GEN .version
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) if [ -r .version ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) VERSION=$(expr 0$(cat .version) + 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) echo $VERSION > .version
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) rm -f .version
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) echo 1 > .version
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) fi;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) # final build of init/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) ${MAKE} -f "${srctree}/scripts/Makefile.build" obj=init need-builtin=1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) #link vmlinux.o
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) modpost_link vmlinux.o
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) objtool_link vmlinux.o
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) # modpost vmlinux.o to check for section mismatches
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) ${MAKE} -f "${srctree}/scripts/Makefile.modpost" MODPOST_VMLINUX=1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) info MODINFO modules.builtin.modinfo
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) ${OBJCOPY} -j .modinfo -O binary vmlinux.o modules.builtin.modinfo
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) info GEN modules.builtin
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) # The second line aids cases where multiple modules share the same object.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) tr '\0' '\n' < modules.builtin.modinfo | sed -n 's/^[[:alnum:]:_]*\.file=//p' |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) tr ' ' '\n' | uniq | sed -e 's:^:kernel/:' -e 's/$/.ko/' > modules.builtin
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) btf_vmlinux_bin_o=""
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) if [ -n "${CONFIG_DEBUG_INFO_BTF}" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) btf_vmlinux_bin_o=.btf.vmlinux.bin.o
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) if ! gen_btf .tmp_vmlinux.btf $btf_vmlinux_bin_o ; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) echo >&2 "Failed to generate BTF for vmlinux"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) echo >&2 "Try to disable CONFIG_DEBUG_INFO_BTF"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) exit 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) kallsymso=""
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) kallsymso_prev=""
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) kallsyms_vmlinux=""
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) if [ -n "${CONFIG_KALLSYMS}" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) # kallsyms support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) # Generate section listing all symbols and add it into vmlinux
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) # It's a three step process:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) # 1) Link .tmp_vmlinux1 so it has all symbols and sections,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) # but __kallsyms is empty.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) # Running kallsyms on that gives us .tmp_kallsyms1.o with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) # the right size
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) # 2) Link .tmp_vmlinux2 so it now has a __kallsyms section of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) # the right size, but due to the added section, some
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) # addresses have shifted.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) # From here, we generate a correct .tmp_kallsyms2.o
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) # 3) That link may have expanded the kernel image enough that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) # more linker branch stubs / trampolines had to be added, which
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) # introduces new names, which further expands kallsyms. Do another
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) # pass if that is the case. In theory it's possible this results
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) # in even more stubs, but unlikely.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) # KALLSYMS_EXTRA_PASS=1 may also used to debug or work around
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) # other bugs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) # 4) The correct ${kallsymso} is linked into the final vmlinux.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) # a) Verify that the System.map from vmlinux matches the map from
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) # ${kallsymso}.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) kallsyms_step 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) kallsyms_step 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) # step 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) size1=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" ${kallsymso_prev})
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) size2=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" ${kallsymso})
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) if [ $size1 -ne $size2 ] || [ -n "${KALLSYMS_EXTRA_PASS}" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) kallsyms_step 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) vmlinux_link vmlinux "${kallsymso}" ${btf_vmlinux_bin_o}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) # fill in BTF IDs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) if [ -n "${CONFIG_DEBUG_INFO_BTF}" -a -n "${CONFIG_BPF}" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) info BTFIDS vmlinux
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) ${RESOLVE_BTFIDS} vmlinux
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) if [ -n "${CONFIG_BUILDTIME_TABLE_SORT}" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) info SORTTAB vmlinux
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) if ! sorttable vmlinux; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) echo >&2 Failed to sort kernel tables
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) exit 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) info SYSMAP System.map
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) mksysmap vmlinux System.map
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) # step a (see comment above)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) if [ -n "${CONFIG_KALLSYMS}" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) mksysmap ${kallsyms_vmlinux} .tmp_System.map
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) if ! cmp -s System.map .tmp_System.map; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) echo >&2 Inconsistent kallsyms data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) echo >&2 Try "make KALLSYMS_EXTRA_PASS=1" as a workaround
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) exit 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) fi