Hello.
With gcc (GCC) 8.3.1 20190311 (Red Hat 8.3.1-3) on d0ee23f9d78be553 ("tools:
compiler-gcc.h: Guard error attribute use with __has_attribute"), I get
CC /usr/src/linux/tools/objtool/exec-cmd.o
In file included from /usr/src/linux/tools/include/linux/compiler_types.h:36:0,
from /usr/src/linux/tools/include/linux/compiler.h:5,
from exec-cmd.c:2:
/usr/src/linux/tools/include/linux/compiler-gcc.h:19:5: error: "__has_attribute" is not defined [-Werror=undef]
#if __has_attribute(__error__)
^
/usr/src/linux/tools/include/linux/compiler-gcc.h:19:20: error: missing binary operator before token "("
#if __has_attribute(__error__)
^
cc1: all warnings being treated as errors
make[5]: *** [/usr/src/linux/tools/objtool/exec-cmd.o] Error 1
make[4]: *** [/usr/src/linux/tools/objtool/libsubcmd-in.o] Error 2
make[3]: *** [/usr/src/linux/tools/objtool/libsubcmd.a] Error 2
make[2]: *** [objtool] Error 2
make[1]: *** [tools/objtool] Error 2
make: *** [__sub-make] Error 2
On 2021/09/14 15:22, Stephen Rothwell wrote:
> This is known and being addressed.
Can you tell me the commit ?
On Tue, Sep 14, 2021 at 6:42 AM Tetsuo Handa
<[email protected]> wrote:
>
> Can you tell me the commit ?
Two commits, in fact - both odd cases of "confused code ended up using
the GCC4 #defines despite not being GCC4":
1619b69edce1 ("powerpc/boot: Fix build failure since GCC 4.9 removal")
d0ee23f9d78b ("tools: compiler-gcc.h: Guard error attribute use
with __has_attribute")
hopefully that was all of it.
Linus
Hi Tetsuo,
On 9/14/2021 6:41 AM, Tetsuo Handa wrote:
> Hello.
>
> With gcc (GCC) 8.3.1 20190311 (Red Hat 8.3.1-3) on d0ee23f9d78be553 ("tools:
> compiler-gcc.h: Guard error attribute use with __has_attribute"), I get
>
> CC /usr/src/linux/tools/objtool/exec-cmd.o
> In file included from /usr/src/linux/tools/include/linux/compiler_types.h:36:0,
> from /usr/src/linux/tools/include/linux/compiler.h:5,
> from exec-cmd.c:2:
> /usr/src/linux/tools/include/linux/compiler-gcc.h:19:5: error: "__has_attribute" is not defined [-Werror=undef]
> #if __has_attribute(__error__)
> ^
> /usr/src/linux/tools/include/linux/compiler-gcc.h:19:20: error: missing binary operator before token "("
> #if __has_attribute(__error__)
> ^
> cc1: all warnings being treated as errors
> make[5]: *** [/usr/src/linux/tools/objtool/exec-cmd.o] Error 1
> make[4]: *** [/usr/src/linux/tools/objtool/libsubcmd-in.o] Error 2
> make[3]: *** [/usr/src/linux/tools/objtool/libsubcmd.a] Error 2
> make[2]: *** [objtool] Error 2
> make[1]: *** [tools/objtool] Error 2
> make: *** [__sub-make] Error 2
Sorry for the breakage :(
This is the most reasonable close that I can get to that compiler version:
# gcc --version | head -1
gcc (GCC) 8.4.1 20200928 (Red Hat 8.4.1-1)
and after I install all of the dependencies, the kernel builds just fine:
# dnf update -y
...
# dnf group install -y "Development Tools"
...
# dnf install -y bc openssl-devel
...
# make -j"$(nproc)" distclean defconfig bzImage
...
OBJCOPY arch/x86/boot/vmlinux.bin
AS arch/x86/boot/header.o
LD arch/x86/boot/setup.elf
OBJCOPY arch/x86/boot/setup.bin
BUILD arch/x86/boot/bzImage
Kernel: arch/x86/boot/bzImage is ready (#1)
Maybe something with your configuration? Although that seems unlikely
given it is happening in objtool, whose build does not depend on
configuration options within it. What does V=1 show as the command for
exec-cmd.o so that I can try to just run that locally?
Cheers,
Nathan
On 2021/09/15 1:26, Nathan Chancellor wrote:
> Maybe something with your configuration? Although that seems unlikely given it is happening in objtool,
> whose build does not depend on configuration options within it.
OK, I found what is wrong.
gcc-4.8.5-44.el7.x86_64
devtoolset-8-gcc-8.3.1-3.2.el7.x86_64
I'm using CentOS 7, and using gcc from devtoolset for building kernels.
Although .config says
CONFIG_CC_VERSION_TEXT="gcc (GCC) 8.3.1 20190311 (Red Hat 8.3.1-3)"
, the distribution's default gcc
GCC: (GNU) 4.8.5 20150623 (Red Hat 4.8.5-44)
is used for building tools/objtool/exec-cmd.o etc. Explicitly adding
export PATH=/opt/rh/devtoolset-8/root/usr/bin:$PATH
solved this problem.
It would be nice if Makefile can also check gcc version used for building tools.
> What does V=1 show as the command for exec-cmd.o so that I can try to just run that locally?
# make V=1
make -C /usr/src/linux -f /usr/src/linux/Makefile
make -f ./scripts/Makefile.build obj=arch/x86/entry/syscalls all
sh ./scripts/syscallhdr.sh --abis i386 --emit-nr arch/x86/entry/syscalls/syscall_32.tbl arch/x86/include/generated/uapi/asm/unistd_32.h
sh ./scripts/syscallhdr.sh --abis common,64 --emit-nr arch/x86/entry/syscalls/syscall_64.tbl arch/x86/include/generated/uapi/asm/unistd_64.h
sh ./scripts/syscallhdr.sh --abis common,x32 --emit-nr --offset __X32_SYSCALL_BIT arch/x86/entry/syscalls/syscall_64.tbl arch/x86/include/generated/uapi/asm/unistd_x32.h
sh ./scripts/syscalltbl.sh --abis i386 arch/x86/entry/syscalls/syscall_32.tbl arch/x86/include/generated/asm/syscalls_32.h
sh ./scripts/syscallhdr.sh --abis i386 --emit-nr --prefix ia32_ arch/x86/entry/syscalls/syscall_32.tbl arch/x86/include/generated/asm/unistd_32_ia32.h
sh ./scripts/syscallhdr.sh --abis x32 --emit-nr --prefix x32_ arch/x86/entry/syscalls/syscall_64.tbl arch/x86/include/generated/asm/unistd_64_x32.h
sh ./scripts/syscalltbl.sh --abis common,64 arch/x86/entry/syscalls/syscall_64.tbl arch/x86/include/generated/asm/syscalls_64.h
make -f ./scripts/Makefile.build obj=scripts/basic
gcc -Wp,-MMD,scripts/basic/.fixdep.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 -o scripts/basic/fixdep scripts/basic/fixdep.c
make -f ./scripts/Makefile.build obj=arch/x86/tools relocs
gcc -Wp,-MMD,arch/x86/tools/.relocs_32.o.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 -I./tools/include -c -o arch/x86/tools/relocs_32.o arch/x86/tools/relocs_32.c
gcc -Wp,-MMD,arch/x86/tools/.relocs_64.o.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 -I./tools/include -c -o arch/x86/tools/relocs_64.o arch/x86/tools/relocs_64.c
gcc -Wp,-MMD,arch/x86/tools/.relocs_common.o.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 -I./tools/include -c -o arch/x86/tools/relocs_common.o arch/x86/tools/relocs_common.c
gcc -o arch/x86/tools/relocs arch/x86/tools/relocs_32.o arch/x86/tools/relocs_64.o arch/x86/tools/relocs_common.o
make -f ./scripts/Makefile.build obj=scripts/dtc
make -f ./scripts/Makefile.build obj=scripts
make -f ./scripts/Makefile.build obj=scripts/genksyms \
\
need-builtin= \
need-modorder=
gcc -Wp,-MMD,scripts/genksyms/.genksyms.o.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 -c -o scripts/genksyms/genksyms.o scripts/genksyms/genksyms.c
bison --version >/dev/null; bison -o scripts/genksyms/parse.tab.c --defines=scripts/genksyms/parse.tab.h -t -l scripts/genksyms/parse.y 2>/dev/null
gcc -Wp,-MMD,scripts/genksyms/.parse.tab.o.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 -I ./scripts/genksyms -c -o scripts/genksyms/parse.tab.o scripts/genksyms/parse.tab.c
flex -oscripts/genksyms/lex.lex.c -L scripts/genksyms/lex.l
gcc -Wp,-MMD,scripts/genksyms/.lex.lex.o.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 -I ./scripts/genksyms -c -o scripts/genksyms/lex.lex.o scripts/genksyms/lex.lex.c
gcc -o scripts/genksyms/genksyms scripts/genksyms/genksyms.o scripts/genksyms/parse.tab.o scripts/genksyms/lex.lex.o
gcc -Wp,-MMD,scripts/.bin2c.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 -o scripts/bin2c scripts/bin2c.c
gcc -Wp,-MMD,scripts/.kallsyms.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 -o scripts/kallsyms scripts/kallsyms.c
gcc -Wp,-MMD,scripts/.sorttable.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 -I./tools/include -o scripts/sorttable scripts/sorttable.c
gcc -Wp,-MMD,scripts/.asn1_compiler.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 -I./include -o scripts/asn1_compiler scripts/asn1_compiler.c
set -e; mkdir -p include/config/; trap "rm -f include/config/.kernel.release.tmp" EXIT; { echo "5.15.0-rc1$(sh ./scripts/setlocalversion .)"; } > include/config/.kernel.release.tmp; if [ ! -r include/config/kernel.release ] || ! cmp -s include/config/kernel.release include/config/.kernel.release.tmp; then : ' UPD include/config/kernel.release'; mv -f include/config/.kernel.release.tmp include/config/kernel.release; fi
make -f ./scripts/Makefile.asm-generic obj=arch/x86/include/generated/uapi/asm \
generic=include/uapi/asm-generic
make -f ./scripts/Makefile.asm-generic obj=arch/x86/include/generated/asm \
generic=include/asm-generic
set -e; mkdir -p include/generated/uapi/linux/; trap "rm -f include/generated/uapi/linux/.version.h.tmp" EXIT; { if [ 0 -gt 255 ]; then echo \#define LINUX_VERSION_CODE 331775; else echo \#define LINUX_VERSION_CODE 331520; fi; echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + ((c) > 255 ? 255 : (c)))'; echo \#define LINUX_VERSION_MAJOR 5; echo \#define LINUX_VERSION_PATCHLEVEL 15; echo \#define LINUX_VERSION_SUBLEVEL 0; } > include/generated/uapi/linux/.version.h.tmp; if [ ! -r include/generated/uapi/linux/version.h ] || ! cmp -s include/generated/uapi/linux/version.h include/generated/uapi/linux/.version.h.tmp; then : ' UPD include/generated/uapi/linux/version.h'; mv -f include/generated/uapi/linux/.version.h.tmp include/generated/uapi/linux/version.h; fi
set -e; mkdir -p include/generated/; trap "rm -f include/generated/.utsrelease.h.tmp" EXIT; { if [ `echo -n "5.15.0-rc1+" | wc -c ` -gt 64 ]; then echo '"5.15.0-rc1+" exceeds 64 characters' >&2; exit 1; fi; echo \#define UTS_RELEASE \"5.15.0-rc1+\"; } > include/generated/.utsrelease.h.tmp; if [ ! -r include/generated/utsrelease.h ] || ! cmp -s include/generated/utsrelease.h include/generated/.utsrelease.h.tmp; then : ' UPD include/generated/utsrelease.h'; mv -f include/generated/.utsrelease.h.tmp include/generated/utsrelease.h; fi
./scripts/remove-stale-files
make -f ./scripts/Makefile.build obj=scripts/mod
gcc -Wp,-MMD,scripts/mod/.mk_elfconfig.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 -o scripts/mod/mk_elfconfig scripts/mod/mk_elfconfig.c
/opt/rh/devtoolset-8/root/bin/gcc -Wp,-MMD,scripts/mod/.empty.o.d -nostdinc -isystem /opt/rh/devtoolset-8/root/usr/lib/gcc/x86_64-redhat-linux/8/include -I./arch/x86/include -I./arch/x86/include/generated -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -fmacro-prefix-map=./= -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu89 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -fcf-protection=none -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -Wno-sign-compare -fno-asynchronous-unwind-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -O2 --param=allow-store-data-races=0 -Wframe-larger-than=2048 -fstack-protector-strong -Wimplicit-fallthrough=5 -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-stack-clash-protection -fno-inline-functions-called-once -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-stringop-truncation -Wno-array-bounds -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -fno-strict-overflow -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -Wno-packed-not-aligned -DKBUILD_MODFILE='"scripts/mod/empty"' -DKBUILD_BASENAME='"empty"' -DKBUILD_MODNAME='"empty"' -D__KBUILD_MODNAME=kmod_empty -c -o scripts/mod/empty.o scripts/mod/empty.c
if /opt/rh/devtoolset-8/root/bin/objdump -h scripts/mod/empty.o | grep -q __ksymtab; then /opt/rh/devtoolset-8/root/bin/gcc -E -D__GENKSYMS__ -Wp,-MMD,scripts/mod/.empty.o.d -nostdinc -isystem /opt/rh/devtoolset-8/root/usr/lib/gcc/x86_64-redhat-linux/8/include -I./arch/x86/include -I./arch/x86/include/generated -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -fmacro-prefix-map=./= -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu89 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -fcf-protection=none -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -Wno-sign-compare -fno-asynchronous-unwind-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -O2 --param=allow-store-data-races=0 -Wframe-larger-than=2048 -fstack-protector-strong -Wimplicit-fallthrough=5 -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-stack-clash-protection -fno-inline-functions-called-once -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-stringop-truncation -Wno-array-bounds -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -fno-strict-overflow -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -Wno-packed-not-aligned -DKBUILD_MODFILE='"scripts/mod/empty"' -DKBUILD_BASENAME='"empty"' -DKBUILD_MODNAME='"empty"' -D__KBUILD_MODNAME=kmod_empty scripts/mod/empty.c | scripts/genksyms/genksyms -r /dev/null > scripts/mod/.tmp_empty.ver; /opt/rh/devtoolset-8/root/bin/ld -m elf_x86_64 -r -o scripts/mod/.tmp_empty.o scripts/mod/empty.o -T scripts/mod/.tmp_empty.ver; mv -f scripts/mod/.tmp_empty.o scripts/mod/empty.o; rm -f scripts/mod/.tmp_empty.ver; fi
scripts/mod/mk_elfconfig < scripts/mod/empty.o > scripts/mod/elfconfig.h
gcc -Wp,-MMD,scripts/mod/.modpost.o.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 -c -o scripts/mod/modpost.o scripts/mod/modpost.c
/opt/rh/devtoolset-8/root/bin/gcc -Wp,-MMD,scripts/mod/.devicetable-offsets.s.d -nostdinc -isystem /opt/rh/devtoolset-8/root/usr/lib/gcc/x86_64-redhat-linux/8/include -I./arch/x86/include -I./arch/x86/include/generated -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -fmacro-prefix-map=./= -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu89 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -fcf-protection=none -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -Wno-sign-compare -fno-asynchronous-unwind-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -O2 --param=allow-store-data-races=0 -Wframe-larger-than=2048 -fstack-protector-strong -Wimplicit-fallthrough=5 -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-stack-clash-protection -fno-inline-functions-called-once -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-stringop-truncation -Wno-array-bounds -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -fno-strict-overflow -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -Wno-packed-not-aligned -DKBUILD_MODFILE='"scripts/mod/devicetable-offsets"' -DKBUILD_BASENAME='"devicetable_offsets"' -DKBUILD_MODNAME='"devicetable_offsets"' -D__KBUILD_MODNAME=kmod_devicetable_offsets -fverbose-asm -S -o scripts/mod/devicetable-offsets.s scripts/mod/devicetable-offsets.c
set -e; mkdir -p scripts/mod/; trap "rm -f scripts/mod/.devicetable-offsets.h.tmp" EXIT; { echo "#ifndef __DEVICETABLE_OFFSETS_H__"; echo "#define __DEVICETABLE_OFFSETS_H__"; echo "/*"; echo " * DO NOT MODIFY."; echo " *"; echo " * This file was generated by Kbuild"; echo " */"; echo ""; sed -ne 's:^[[:space:]]*\.ascii[[:space:]]*"\(.*\)".*:\1:; /^->/{s:->#\(.*\):/* \1 */:; s:^->\([^ ]*\) [\$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}' < scripts/mod/devicetable-offsets.s; echo ""; echo "#endif"; } > scripts/mod/.devicetable-offsets.h.tmp; if [ ! -r scripts/mod/devicetable-offsets.h ] || ! cmp -s scripts/mod/devicetable-offsets.h scripts/mod/.devicetable-offsets.h.tmp; then : ' UPD scripts/mod/devicetable-offsets.h'; mv -f scripts/mod/.devicetable-offsets.h.tmp scripts/mod/devicetable-offsets.h; fi
gcc -Wp,-MMD,scripts/mod/.file2alias.o.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 -c -o scripts/mod/file2alias.o scripts/mod/file2alias.c
gcc -Wp,-MMD,scripts/mod/.sumversion.o.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 -c -o scripts/mod/sumversion.o scripts/mod/sumversion.c
gcc -o scripts/mod/modpost scripts/mod/modpost.o scripts/mod/file2alias.o scripts/mod/sumversion.o
make -f ./scripts/Makefile.build obj=.
/opt/rh/devtoolset-8/root/bin/gcc -Wp,-MMD,kernel/.bounds.s.d -nostdinc -isystem /opt/rh/devtoolset-8/root/usr/lib/gcc/x86_64-redhat-linux/8/include -I./arch/x86/include -I./arch/x86/include/generated -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -fmacro-prefix-map=./= -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu89 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -fcf-protection=none -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -Wno-sign-compare -fno-asynchronous-unwind-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -O2 --param=allow-store-data-races=0 -Wframe-larger-than=2048 -fstack-protector-strong -Wimplicit-fallthrough=5 -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-stack-clash-protection -fno-inline-functions-called-once -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-stringop-truncation -Wno-array-bounds -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -fno-strict-overflow -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -Wno-packed-not-aligned -DKBUILD_MODFILE='"./bounds"' -DKBUILD_BASENAME='"bounds"' -DKBUILD_MODNAME='"bounds"' -D__KBUILD_MODNAME=kmod_bounds -fverbose-asm -S -o kernel/bounds.s kernel/bounds.c
set -e; mkdir -p include/generated/; trap "rm -f include/generated/.bounds.h.tmp" EXIT; { echo "#ifndef __LINUX_BOUNDS_H__"; echo "#define __LINUX_BOUNDS_H__"; echo "/*"; echo " * DO NOT MODIFY."; echo " *"; echo " * This file was generated by Kbuild"; echo " */"; echo ""; sed -ne 's:^[[:space:]]*\.ascii[[:space:]]*"\(.*\)".*:\1:; /^->/{s:->#\(.*\):/* \1 */:; s:^->\([^ ]*\) [\$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}' < kernel/bounds.s; echo ""; echo "#endif"; } > include/generated/.bounds.h.tmp; if [ ! -r include/generated/bounds.h ] || ! cmp -s include/generated/bounds.h include/generated/.bounds.h.tmp; then : ' UPD include/generated/bounds.h'; mv -f include/generated/.bounds.h.tmp include/generated/bounds.h; fi
set -e; mkdir -p include/generated/; trap "rm -f include/generated/.timeconst.h.tmp" EXIT; { echo 1000 | bc -q kernel/time/timeconst.bc; } > include/generated/.timeconst.h.tmp; if [ ! -r include/generated/timeconst.h ] || ! cmp -s include/generated/timeconst.h include/generated/.timeconst.h.tmp; then : ' UPD include/generated/timeconst.h'; mv -f include/generated/.timeconst.h.tmp include/generated/timeconst.h; fi
/opt/rh/devtoolset-8/root/bin/gcc -Wp,-MMD,arch/x86/kernel/.asm-offsets.s.d -nostdinc -isystem /opt/rh/devtoolset-8/root/usr/lib/gcc/x86_64-redhat-linux/8/include -I./arch/x86/include -I./arch/x86/include/generated -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -fmacro-prefix-map=./= -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu89 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -fcf-protection=none -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -Wno-sign-compare -fno-asynchronous-unwind-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -O2 --param=allow-store-data-races=0 -Wframe-larger-than=2048 -fstack-protector-strong -Wimplicit-fallthrough=5 -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-stack-clash-protection -fno-inline-functions-called-once -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-stringop-truncation -Wno-array-bounds -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -fno-strict-overflow -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -Wno-packed-not-aligned -DKBUILD_MODFILE='"./asm-offsets"' -DKBUILD_BASENAME='"asm_offsets"' -DKBUILD_MODNAME='"asm_offsets"' -D__KBUILD_MODNAME=kmod_asm_offsets -fverbose-asm -S -o arch/x86/kernel/asm-offsets.s arch/x86/kernel/asm-offsets.c
set -e; mkdir -p include/generated/; trap "rm -f include/generated/.asm-offsets.h.tmp" EXIT; { echo "#ifndef __ASM_OFFSETS_H__"; echo "#define __ASM_OFFSETS_H__"; echo "/*"; echo " * DO NOT MODIFY."; echo " *"; echo " * This file was generated by Kbuild"; echo " */"; echo ""; sed -ne 's:^[[:space:]]*\.ascii[[:space:]]*"\(.*\)".*:\1:; /^->/{s:->#\(.*\):/* \1 */:; s:^->\([^ ]*\) [\$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}' < arch/x86/kernel/asm-offsets.s; echo ""; echo "#endif"; } > include/generated/.asm-offsets.h.tmp; if [ ! -r include/generated/asm-offsets.h ] || ! cmp -s include/generated/asm-offsets.h include/generated/.asm-offsets.h.tmp; then : ' UPD include/generated/asm-offsets.h'; mv -f include/generated/.asm-offsets.h.tmp include/generated/asm-offsets.h; fi
sh scripts/checksyscalls.sh /opt/rh/devtoolset-8/root/bin/gcc -Wp,-MMD,./.missing-syscalls.d -nostdinc -isystem /opt/rh/devtoolset-8/root/usr/lib/gcc/x86_64-redhat-linux/8/include -I./arch/x86/include -I./arch/x86/include/generated -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -fmacro-prefix-map=./= -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu89 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -fcf-protection=none -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -Wno-sign-compare -fno-asynchronous-unwind-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -O2 --param=allow-store-data-races=0 -Wframe-larger-than=2048 -fstack-protector-strong -Wimplicit-fallthrough=5 -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-stack-clash-protection -fno-inline-functions-called-once -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-stringop-truncation -Wno-array-bounds -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -fno-strict-overflow -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -Wno-packed-not-aligned -DKBUILD_MODFILE='"./missing-syscalls"' -DKBUILD_BASENAME='"missing_syscalls"' -DKBUILD_MODNAME='"missing_syscalls"' -D__KBUILD_MODNAME=kmod_missing_syscalls
sh scripts/atomic/check-atomics.sh
mkdir -p ./tools
make LDFLAGS= MAKEFLAGS=" " O=/usr/src/linux subdir=tools -C ./tools/ objtool
mkdir -p /usr/src/linux/tools/objtool && make O=/usr/src/linux subdir=tools/objtool --no-print-directory -C objtool
make -C /usr/src/linux/tools/build CFLAGS= LDFLAGS= /usr/src/linux/tools/objtool/fixdep
make -f /usr/src/linux/tools/build/Makefile.build dir=. obj=fixdep
gcc -Wp,-MD,/usr/src/linux/tools/objtool/.fixdep.o.d -Wp,-MT,/usr/src/linux/tools/objtool/fixdep.o -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 -D"BUILD_STR(s)=#s" -c -o /usr/src/linux/tools/objtool/fixdep.o fixdep.c
ld -r -o /usr/src/linux/tools/objtool/fixdep-in.o /usr/src/linux/tools/objtool/fixdep.o
gcc -o /usr/src/linux/tools/objtool/fixdep /usr/src/linux/tools/objtool/fixdep-in.o
make -C /usr/src/linux/tools/lib/subcmd/ OUTPUT=/usr/src/linux/tools/objtool/
make -C /usr/src/linux/tools/build CFLAGS= LDFLAGS= /usr/src/linux/tools/objtool/fixdep
make -f /usr/src/linux/tools/build/Makefile.build dir=. obj=fixdep
gcc -Wp,-MD,/usr/src/linux/tools/objtool/.exec-cmd.o.d -Wp,-MT,/usr/src/linux/ -ggdb3 -Wall -Wextra -std=gnu99 -fPIC -O6 -Werror -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -I/usr/src/linux/tools/include/ -Wbad-function-cast -Wdeclaration-after-statement -Wformat-security -Wformat-y2k -Winit-self -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wno-system-headers -Wold-style-definition -Wpacked -Wredundant-decls -Wstrict-prototypes -Wswitch-default -Wswitch-enum -Wundef -Wwrite-strings -Wformat -Wno-type-limits -Wstrict-aliasing=3 -fno-strict-aliasing -Wno-shadow -D"BUILD_STR(s)=#s" -c -o /usr/src/linux/tools/objtool/exec-cmd.o exec-cmd.c
In file included from /usr/src/linux/tools/include/linux/compiler_types.h:36:0,
from /usr/src/linux/tools/include/linux/compiler.h:5,
from exec-cmd.c:2:
/usr/src/linux/tools/include/linux/compiler-gcc.h:19:5: error: "__has_attribute" is not defined [-Werror=undef]
#if __has_attribute(__error__)
^
/usr/src/linux/tools/include/linux/compiler-gcc.h:19:20: error: missing binary operator before token "("
#if __has_attribute(__error__)
^
cc1: all warnings being treated as errors
make[5]: *** [/usr/src/linux/tools/objtool/exec-cmd.o] Error 1
make[4]: *** [/usr/src/linux/tools/objtool/libsubcmd-in.o] Error 2
make[3]: *** [/usr/src/linux/tools/objtool/libsubcmd.a] Error 2
make[2]: *** [objtool] Error 2
make[1]: *** [tools/objtool] Error 2
make: *** [__sub-make] Error 2
On Tue, Sep 14, 2021 at 6:05 PM Tetsuo Handa
<[email protected]> wrote:
>
> It would be nice if Makefile can also check gcc version used for building tools.
I think the real problem is that the tool headers are cut-down from
the real kernel headers, but not cut down enough, so they are still
very complex, often with stuff that just isn't worth it in user space
at all.
And they _look_ like kernel headers - both in naming and in contents.
But they really aren't.
And it turns out there are two independent bugs here.
Bug #1 is that the tool header files look _so_ much like the main
kernel header files, that Nick thought that the
#if GCC_VERSION >= 40300
was about the compiler we compile the kernel with.
But no, it's about the host compiler.
Easy mistake to make when the naming is so similar and the contents
are often also fairly closely related too.
But basically, commit 4e59869aa655 ("compiler-gcc.h: drop checks for
older GCC versions") was buggy, because it took the kernel compiler
version logic ("we require 5.1 to build the kernel") and applied it to
the tooling header files too (we do _not_ require the kernel compiler
for host tools).
Now, arguably, commit 4eb6bd55cfb2 ("compiler.h: drop fallback
overflow checkers") has the exact same problem: it too ends up
changing both the kernel header files and the tooling header files.
But tooling really REALLY shouldn't be using those overflow macros, so
nobody should care.
Famous last words.
I think we should remove that "tools/include/linux/overflow.h" header
entirely. Yes, it is used - by tools/virtio/linux/kernel.h. But I
think that overflow handling code should be removed. It's just not
interesting in user tools.
Now, the _second_ bug was then that when Nathan fixed the tooling
header file in commit d0ee23f9d78b ("tools: compiler-gcc.h: Guard
error attribute use with __has_attribute"), he did it the wrong way.
The gcc docs are fairly clear about how to test for __has_attibute correctly:
https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005fattribute.html
and a host build environment should probably have used
#if defined __has_attribute
# if __has_attribute (error)
...
and not used any version checks at all.
Of course, I'm not convinced it should do that __compiletime_error()
at all, and again, I think it would be better to remove the complexity
rather than anything else.
Anybody want to tackle those issues in
tools/include/linux/overflow.h
tools/include/linux/compiler-gcc.h
and try to simplify the code?
Linus
> On Sep 14, 2021, at 7:59 PM, Linus Torvalds <[email protected]> wrote:
> Now, the _second_ bug was then that when Nathan fixed the tooling
> header file in commit d0ee23f9d78b ("tools: compiler-gcc.h: Guard
> error attribute use with __has_attribute"), he did it the wrong way.
>
> The gcc docs are fairly clear about how to test for __has_attibute correctly:
>
> https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005fattribute.html
>
> and a host build environment should probably have used
>
> #if defined __has_attribute
> # if __has_attribute (error)
> ...
>
> and not used any version checks at all.
Ugh, yes, I had assumed that the host compiler would always equal the
compiler used for the kernel because I am so used to clang so I figured
the 'defined(__has_attribute)' was redundant but that obviously is not
true, especially when cross compiling.
> Of course, I'm not convinced it should do that __compiletime_error()
> at all, and again, I think it would be better to remove the complexity
> rather than anything else.
>
> Anybody want to tackle those issues in
>
> tools/include/linux/overflow.h
> tools/include/linux/compiler-gcc.h
>
> and try to simplify the code?
I made the tools/include/linux/compiler-gcc.h situation worse so I am
more than happy to try to resolve it.
__compiletime_error() is ultimately used within BUILD_BUG_ON(), which
does appear to be used a couple places within the tools/ directory so I
am not sure it should be eliminated; doing so would cause BUILD_BUG_ON()
failures to be a lot more cryptic (although it is entirely possible
those are not at all common so who cares). I could be entirely wrong
though if I am misreading the code, there are a few different
BUILD_BUG_ON() defines...
If it cannot be eliminated, we could either add back the
GCC_VERSION >= 40300 check (because there does not appear to be a
minimum host version of GCC) along with my fix or we could just do the
'defined(__has_attribute)' and leave GCC 4.3 to 5.1 behind. I do not
have a strong opinion.
Cheers,
Nathan
On Tue, Sep 14, 2021 at 7:59 PM Linus Torvalds
<[email protected]> wrote:
>
> On Tue, Sep 14, 2021 at 6:05 PM Tetsuo Handa
> <[email protected]> wrote:
> >
> > It would be nice if Makefile can also check gcc version used for building tools.
>
> I think the real problem is that the tool headers are cut-down from
> the real kernel headers, but not cut down enough, so they are still
> very complex, often with stuff that just isn't worth it in user space
> at all.
>
> And they _look_ like kernel headers - both in naming and in contents.
> But they really aren't.
>
> And it turns out there are two independent bugs here.
>
> Bug #1 is that the tool header files look _so_ much like the main
> kernel header files, that Nick thought that the
>
> #if GCC_VERSION >= 40300
>
> was about the compiler we compile the kernel with.
>
> But no, it's about the host compiler.
>
> Easy mistake to make when the naming is so similar and the contents
> are often also fairly closely related too.
No, I got that.
I don't get why you wouldn't keep those in sync, at least the minimum
supported compiler version for both. Sure, for cross compiling HOSTCC
and CC could be wildly different versions, but why should the minimum
supported version differ between the two?
Do we even document anywhere what's the lowest support compiler
version for tools/ or HOSTCC?
> But basically, commit 4e59869aa655 ("compiler-gcc.h: drop checks for
> older GCC versions") was buggy, because it took the kernel compiler
> version logic ("we require 5.1 to build the kernel") and applied it to
> the tooling header files too (we do _not_ require the kernel compiler
> for host tools).
That the minimum versions don't need to match between the two is
surprising to me. Probably to the reviewers of those patches, too.
--
Thanks,
~Nick Desaulniers