ANDROID: Revert "af73d78bd384 ("kbuild: Remove debug info from kallsyms linking")"

clang's linker can not handle this at the moment, so revert it to keep
the x86 build working properly.

Bug: 153164546
Cc: <ndesaulniers@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I87c587398065d91f1e9be8a317b755d1f7963c95
This commit is contained in:
Greg Kroah-Hartman
2020-04-04 12:24:29 +02:00
parent 6aea7b7129
commit 1780c41d22

View File

@@ -110,18 +110,12 @@ vmlinux_link()
local lds="${objtree}/${KBUILD_LDS}" local lds="${objtree}/${KBUILD_LDS}"
local output=${1} local output=${1}
local objects local objects
local strip_debug
info LD ${output} info LD ${output}
# skip output file argument # skip output file argument
shift shift
# The kallsyms linking does not need debug symbols included.
if [ "$output" != "${output#.tmp_vmlinux.kallsyms}" ] ; then
strip_debug=-Wl,--strip-debug
fi
if [ "${SRCARCH}" != "um" ]; then if [ "${SRCARCH}" != "um" ]; then
if [ -n "${CONFIG_LTO_CLANG}" ]; then if [ -n "${CONFIG_LTO_CLANG}" ]; then
# Use vmlinux.o instead of performing the slow LTO # Use vmlinux.o instead of performing the slow LTO
@@ -141,7 +135,6 @@ vmlinux_link()
fi fi
${LD} ${KBUILD_LDFLAGS} ${LDFLAGS_vmlinux} \ ${LD} ${KBUILD_LDFLAGS} ${LDFLAGS_vmlinux} \
${strip_debug#-Wl,} \
-o ${output} \ -o ${output} \
-T ${lds} ${objects} -T ${lds} ${objects}
else else
@@ -154,7 +147,6 @@ vmlinux_link()
${@}" ${@}"
${CC} ${CFLAGS_vmlinux} \ ${CC} ${CFLAGS_vmlinux} \
${strip_debug} \
-o ${output} \ -o ${output} \
-Wl,-T,${lds} \ -Wl,-T,${lds} \
${objects} \ ${objects} \
@@ -181,9 +173,8 @@ gen_btf()
return 1 return 1
fi fi
vmlinux_link ${1}
info "BTF" ${2} info "BTF" ${2}
vmlinux_link ${1}
LLVM_OBJCOPY=${OBJCOPY} ${PAHOLE} -J ${1} LLVM_OBJCOPY=${OBJCOPY} ${PAHOLE} -J ${1}
# Create ${2} which contains just .BTF section but no symbols. Add # Create ${2} which contains just .BTF section but no symbols. Add
@@ -230,8 +221,8 @@ kallsyms()
kallsyms_step() kallsyms_step()
{ {
kallsymso_prev=${kallsymso} kallsymso_prev=${kallsymso}
kallsyms_vmlinux=.tmp_vmlinux.kallsyms${1} kallsymso=.tmp_kallsyms${1}.o
kallsymso=${kallsyms_vmlinux}.o kallsyms_vmlinux=.tmp_vmlinux${1}
vmlinux_link ${kallsyms_vmlinux} "${kallsymso_prev}" ${btf_vmlinux_bin_o} vmlinux_link ${kallsyms_vmlinux} "${kallsymso_prev}" ${btf_vmlinux_bin_o}
kallsyms ${kallsyms_vmlinux} ${kallsymso} kallsyms ${kallsyms_vmlinux} ${kallsymso}
@@ -254,6 +245,7 @@ cleanup()
{ {
rm -f .btf.* rm -f .btf.*
rm -f .tmp_System.map rm -f .tmp_System.map
rm -f .tmp_kallsyms*
rm -f .tmp_lto.lds rm -f .tmp_lto.lds
rm -f .tmp_vmlinux* rm -f .tmp_vmlinux*
rm -f System.map rm -f System.map
@@ -325,8 +317,9 @@ tr '\0' '\n' < modules.builtin.modinfo | sed -n 's/^[[:alnum:]:_]*\.file=//p' |
btf_vmlinux_bin_o="" btf_vmlinux_bin_o=""
if [ -n "${CONFIG_DEBUG_INFO_BTF}" ]; then if [ -n "${CONFIG_DEBUG_INFO_BTF}" ]; then
btf_vmlinux_bin_o=.btf.vmlinux.bin.o if gen_btf .tmp_vmlinux.btf .btf.vmlinux.bin.o ; then
if ! gen_btf .tmp_vmlinux.btf $btf_vmlinux_bin_o ; then btf_vmlinux_bin_o=.btf.vmlinux.bin.o
else
echo >&2 "Failed to generate BTF for vmlinux" echo >&2 "Failed to generate BTF for vmlinux"
echo >&2 "Try to disable CONFIG_DEBUG_INFO_BTF" echo >&2 "Try to disable CONFIG_DEBUG_INFO_BTF"
exit 1 exit 1