tools headers UAPI: Sync openat2.h with the kernel sources
[linux-2.6-microblaze.git] / scripts / link-vmlinux.sh
index c5919d5..3b261b0 100755 (executable)
@@ -103,14 +103,36 @@ modpost_link()
 
 objtool_link()
 {
+       local objtoolcmd;
        local objtoolopt;
 
+       if [ "${CONFIG_LTO_CLANG} ${CONFIG_STACK_VALIDATION}" = "y y" ]; then
+               # Don't perform vmlinux validation unless explicitly requested,
+               # but run objtool on vmlinux.o now that we have an object file.
+               if [ -n "${CONFIG_UNWINDER_ORC}" ]; then
+                       objtoolcmd="orc generate"
+               fi
+
+               objtoolopt="${objtoolopt} --duplicate"
+
+               if [ -n "${CONFIG_FTRACE_MCOUNT_USE_OBJTOOL}" ]; then
+                       objtoolopt="${objtoolopt} --mcount"
+               fi
+       fi
+
        if [ -n "${CONFIG_VMLINUX_VALIDATION}" ]; then
-               objtoolopt="check"
+               objtoolopt="${objtoolopt} --noinstr"
+       fi
+
+       if [ -n "${objtoolopt}" ]; then
+               if [ -z "${objtoolcmd}" ]; then
+                       objtoolcmd="check"
+               fi
+               objtoolopt="${objtoolopt} --vmlinux"
                if [ -z "${CONFIG_FRAME_POINTER}" ]; then
                        objtoolopt="${objtoolopt} --no-fp"
                fi
-               if [ -n "${CONFIG_GCOV_KERNEL}" ]; then
+               if [ -n "${CONFIG_GCOV_KERNEL}" ] || [ -n "${CONFIG_LTO_CLANG}" ]; then
                        objtoolopt="${objtoolopt} --no-unreachable"
                fi
                if [ -n "${CONFIG_RETPOLINE}" ]; then
@@ -120,7 +142,7 @@ objtool_link()
                        objtoolopt="${objtoolopt} --uaccess"
                fi
                info OBJTOOL ${1}
-               tools/objtool/objtool ${objtoolopt} ${1}
+               tools/objtool/objtool ${objtoolcmd} ${objtoolopt} ${1}
        fi
 }