scripts/link-vmlinux.sh: force error on kallsyms failure
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Fri, 5 Feb 2016 10:25:05 +0000 (11:25 +0100)
committerMichal Marek <mmarek@suse.com>
Mon, 8 Feb 2016 19:45:09 +0000 (20:45 +0100)
Since the output of the invocation of scripts/kallsyms is piped directly
into the assembler, error messages it emits are visible on stderr, but
a non-zero return code is ignored, and the build simply proceeds in that
case. However, the resulting kernel is most likely broken, and will crash
at boot.

So instead, capture the output of kallsyms in a separate .S file, and pass
that to the assembler in a separate step.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Michal Marek <mmarek@suse.com>
scripts/link-vmlinux.sh

index ba6c34ea5429535cd303b1aa1d6ebd6ae30dd912..8f22654c71b46bcd487ef791ecfc9b50b2dbf6f2 100755 (executable)
@@ -93,9 +93,10 @@ kallsyms()
        local aflags="${KBUILD_AFLAGS} ${KBUILD_AFLAGS_KERNEL}               \
                      ${NOSTDINC_FLAGS} ${LINUXINCLUDE} ${KBUILD_CPPFLAGS}"
 
-       ${NM} -n ${1} | \
-               scripts/kallsyms ${kallsymopt} | \
-               ${CC} ${aflags} -c -o ${2} -x assembler-with-cpp -
+       local afile="`basename ${2} .o`.S"
+
+       ${NM} -n ${1} | scripts/kallsyms ${kallsymopt} > ${afile}
+       ${CC} ${aflags} -c -o ${2} ${afile}
 }
 
 # Create map file with all symbols from ${1}