X-Git-Url: http://git.monstr.eu/?a=blobdiff_plain;f=scripts%2Flink-vmlinux.sh;h=d74cee5c4326a5833048ed99bee859fd7f1dcd0e;hb=a2b28235335fee2586b4bd16448fb59ed6c80eef;hp=36ef7b37fc5dff82b19e85fae1e432fe5d07c96c;hpb=6e442d06621f2af87fc0bf352976694db547c780;p=linux-2.6-microblaze.git diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh index 36ef7b37fc5d..d74cee5c4326 100755 --- a/scripts/link-vmlinux.sh +++ b/scripts/link-vmlinux.sh @@ -149,67 +149,54 @@ objtool_link() # ${2}, ${3}, ... - optional extra .o files vmlinux_link() { - local lds="${objtree}/${KBUILD_LDS}" local output=${1} - local objects - local strip_debug - local map_option + local objs + local libs + local ld + local ldflags + local ldlibs info LD ${output} # skip output file argument shift + if [ -n "${CONFIG_LTO_CLANG}" ]; then + # Use vmlinux.o instead of performing the slow LTO link again. + objs=vmlinux.o + libs= + else + objs="${KBUILD_VMLINUX_OBJS}" + libs="${KBUILD_VMLINUX_LIBS}" + fi + + if [ "${SRCARCH}" = "um" ]; then + wl=-Wl, + ld="${CC}" + ldflags="${CFLAGS_vmlinux}" + ldlibs="-lutil -lrt -lpthread" + else + wl= + ld="${LD}" + ldflags="${KBUILD_LDFLAGS} ${LDFLAGS_vmlinux}" + ldlibs= + fi + + ldflags="${ldflags} ${wl}--script=${objtree}/${KBUILD_LDS}" + # The kallsyms linking does not need debug symbols included. if [ "$output" != "${output#.tmp_vmlinux.kallsyms}" ] ; then - strip_debug=-Wl,--strip-debug + ldflags="${ldflags} ${wl}--strip-debug" fi if [ -n "${CONFIG_VMLINUX_MAP}" ]; then - map_option="-Map=${output}.map" + ldflags="${ldflags} ${wl}-Map=${output}.map" fi - if [ "${SRCARCH}" != "um" ]; then - if [ -n "${CONFIG_LTO_CLANG}" ]; then - # Use vmlinux.o instead of performing the slow LTO - # link again. - objects="--whole-archive \ - vmlinux.o \ - --no-whole-archive \ - ${@}" - else - objects="--whole-archive \ - ${KBUILD_VMLINUX_OBJS} \ - --no-whole-archive \ - --start-group \ - ${KBUILD_VMLINUX_LIBS} \ - --end-group \ - ${@}" - fi - - ${LD} ${KBUILD_LDFLAGS} ${LDFLAGS_vmlinux} \ - ${strip_debug#-Wl,} \ - -o ${output} \ - ${map_option} \ - -T ${lds} ${objects} - else - objects="-Wl,--whole-archive \ - ${KBUILD_VMLINUX_OBJS} \ - -Wl,--no-whole-archive \ - -Wl,--start-group \ - ${KBUILD_VMLINUX_LIBS} \ - -Wl,--end-group \ - ${@}" - - ${CC} ${CFLAGS_vmlinux} \ - ${strip_debug} \ - -o ${output} \ - ${map_option:+-Wl,${map_option}} \ - -Wl,-T,${lds} \ - ${objects} \ - -lutil -lrt -lpthread - rm -f linux - fi + ${ld} ${ldflags} -o ${output} \ + ${wl}--whole-archive ${objs} ${wl}--no-whole-archive \ + ${wl}--start-group ${libs} ${wl}--end-group \ + $@ ${ldlibs} } # generate .BTF typeinfo from DWARF debuginfo