Don't check .GCC.command.line for kernel modules.
authorZac Medico <zmedico@gentoo.org>
Sat, 24 Dec 2011 10:13:32 +0000 (02:13 -0800)
committerZac Medico <zmedico@gentoo.org>
Sat, 24 Dec 2011 10:13:32 +0000 (02:13 -0800)
Linux kernel modules trigger the following warning when compiled with
-frecord-gcc-switches:

WARNING: mod.o (.GCC.command.line): unexpected non-allocatable section.

bin/misc-functions.sh

index 9d8244d65b715cb2f82de06925de069eb8b63bb5..bb674321e4c021bac0c1c0b55395b9e6d0a387e7 100755 (executable)
@@ -201,7 +201,18 @@ install_qa_check() {
                [[ "${FCFLAGS}" == *-frecord-gcc-switches* ]] ; then
                f=$(scanelf -qyRF '%k %p' -k \!.GCC.command.line "${ED}" | sed -e "s:\!.GCC.command.line ::")
                if [[ -n ${f} ]] ; then
-                       echo "${f}" > "${T}"/scanelf-ignored-CFLAGS.log
+                       # Separate out file types that are known to support
+                       # .GCC.command.line sections, using the `file` command
+                       # similar to how prepstrip uses it.
+                       > "${T}"/scanelf-ignored-CFLAGS.log
+                       for x in $f ; do
+                               f=$(file "${x}") || continue
+                               [[ -z ${f} ]] && continue
+                               if [[ ${f} == *"SB executable"* ||
+                                       ${f} == *"SB shared object"* ]] ; then
+                                       echo "${x}" >> "${T}"/scanelf-ignored-CFLAGS.log
+                               fi
+                       done
                        if [ "${QA_STRICT_FLAGS_IGNORED-unset}" = unset ] ; then
                                for x in "${QA_FLAGS_IGNORED[@]}" ; do
                                        sed -e "s#^${x#/}\$##" -i "${T}"/scanelf-ignored-CFLAGS.log