On Fri, 9 Oct 2020 09:13:09 -0700 Sami Tolvanen <samitolvanen@xxxxxxxxxx> wrote: > This patch series adds support for building x86_64 and arm64 kernels > with Clang's Link Time Optimization (LTO). > > In addition to performance, the primary motivation for LTO is > to allow Clang's Control-Flow Integrity (CFI) to be used in the > kernel. Google has shipped millions of Pixel devices running three > major kernel versions with LTO+CFI since 2018. > > Most of the patches are build system changes for handling LLVM > bitcode, which Clang produces with LTO instead of ELF object files, > postponing ELF processing until a later stage, and ensuring initcall > ordering. > > Note that this version is based on tip/master to reduce the number > of prerequisite patches, and to make it easier to manage changes to > objtool. Patch 1 is from Masahiro's kbuild tree, and while it's not > directly related to LTO, it makes the module linker script changes > cleaner. > I went to test this, but it appears that the latest tip/master fails to build for me. This error is on tip/master, before I even applied a single patch. (config attached) -- Steve SYSMAP System.map HOSTCC arch/x86/tools/insn_decoder_test HOSTCC arch/x86/tools/insn_sanity MODPOST Module.symvers In file included from /work/git/linux-test.git/include/uapi/linux/byteorder/little_endian.h:12, from /work/git/linux-test.git/include/linux/byteorder/little_endian.h:5, from /usr/include/asm/byteorder.h:5, from /work/git/linux-test.git/arch/x86/include/asm/insn.h:10, from /work/git/linux-test.git/arch/x86/tools/insn_sanity.c:21: /work/git/linux-test.git/tools/include/linux/types.h:30:18: error: conflicting types for ‘u64’ 30 | typedef uint64_t u64; | ^~~ In file included from /usr/include/asm-generic/types.h:7, from /usr/include/asm/types.h:1, from /work/git/linux-test.git/tools/include/linux/types.h:10, from /work/git/linux-test.git/include/uapi/linux/byteorder/little_endian.h:12, from /work/git/linux-test.git/include/linux/byteorder/little_endian.h:5, from /usr/include/asm/byteorder.h:5, from /work/git/linux-test.git/arch/x86/include/asm/insn.h:10, from /work/git/linux-test.git/arch/x86/tools/insn_sanity.c:21: /work/git/linux-test.git/include/asm-generic/int-ll64.h:23:15: note: previous declaration of ‘u64’ was here 23 | typedef __u64 u64; | ^~~ In file included from /work/git/linux-test.git/include/uapi/linux/byteorder/little_endian.h:12, from /work/git/linux-test.git/include/linux/byteorder/little_endian.h:5, from /usr/include/asm/byteorder.h:5, from /work/git/linux-test.git/arch/x86/include/asm/insn.h:10, from /work/git/linux-test.git/arch/x86/tools/insn_sanity.c:21: /work/git/linux-test.git/tools/include/linux/types.h:31:17: error: conflicting types for ‘s64’ 31 | typedef int64_t s64; | ^~~ In file included from /usr/include/asm-generic/types.h:7, from /usr/include/asm/types.h:1, from /work/git/linux-test.git/tools/include/linux/types.h:10, from /work/git/linux-test.git/include/uapi/linux/byteorder/little_endian.h:12, from /work/git/linux-test.git/include/linux/byteorder/little_endian.h:5, from /usr/include/asm/byteorder.h:5, from /work/git/linux-test.git/arch/x86/include/asm/insn.h:10, from /work/git/linux-test.git/arch/x86/tools/insn_sanity.c:21: /work/git/linux-test.git/include/asm-generic/int-ll64.h:22:15: note: previous declaration of ‘s64’ was here 22 | typedef __s64 s64; | ^~~ In file included from /work/git/linux-test.git/arch/x86/lib/insn.c:8, from /work/git/linux-test.git/arch/x86/tools/insn_sanity.c:23: /work/git/linux-test.git/tools/include/linux/kernel.h:87: warning: "cpu_to_le16" redefined 87 | #define cpu_to_le16 | In file included from /work/git/linux-test.git/include/linux/byteorder/little_endian.h:11, from /usr/include/asm/byteorder.h:5, from /work/git/linux-test.git/arch/x86/include/asm/insn.h:10, from /work/git/linux-test.git/arch/x86/tools/insn_sanity.c:21: /work/git/linux-test.git/include/linux/byteorder/generic.h:90: note: this is the location of the previous definition 90 | #define cpu_to_le16 __cpu_to_le16 | In file included from /work/git/linux-test.git/arch/x86/lib/insn.c:8, from /work/git/linux-test.git/arch/x86/tools/insn_sanity.c:23: /work/git/linux-test.git/tools/include/linux/kernel.h:88: warning: "cpu_to_le32" redefined 88 | #define cpu_to_le32 | In file included from /work/git/linux-test.git/include/linux/byteorder/little_endian.h:11, from /usr/include/asm/byteorder.h:5, from /work/git/linux-test.git/arch/x86/include/asm/insn.h:10, from /work/git/linux-test.git/arch/x86/tools/insn_sanity.c:21: /work/git/linux-test.git/include/linux/byteorder/generic.h:88: note: this is the location of the previous definition 88 | #define cpu_to_le32 __cpu_to_le32 | In file included from /work/git/linux-test.git/arch/x86/lib/insn.c:8, from /work/git/linux-test.git/arch/x86/tools/insn_sanity.c:23: /work/git/linux-test.git/tools/include/linux/kernel.h:89: warning: "cpu_to_le64" redefined 89 | #define cpu_to_le64 | In file included from /work/git/linux-test.git/include/linux/byteorder/little_endian.h:11, from /usr/include/asm/byteorder.h:5, from /work/git/linux-test.git/arch/x86/include/asm/insn.h:10, from /work/git/linux-test.git/arch/x86/tools/insn_sanity.c:21: /work/git/linux-test.git/include/linux/byteorder/generic.h:86: note: this is the location of the previous definition 86 | #define cpu_to_le64 __cpu_to_le64 | In file included from /work/git/linux-test.git/arch/x86/lib/insn.c:8, from /work/git/linux-test.git/arch/x86/tools/insn_sanity.c:23: /work/git/linux-test.git/tools/include/linux/kernel.h:90: warning: "le16_to_cpu" redefined 90 | #define le16_to_cpu | In file included from /work/git/linux-test.git/include/linux/byteorder/little_endian.h:11, from /usr/include/asm/byteorder.h:5, from /work/git/linux-test.git/arch/x86/include/asm/insn.h:10, from /work/git/linux-test.git/arch/x86/tools/insn_sanity.c:21: /work/git/linux-test.git/include/linux/byteorder/generic.h:91: note: this is the location of the previous definition 91 | #define le16_to_cpu __le16_to_cpu | In file included from /work/git/linux-test.git/arch/x86/lib/insn.c:8, from /work/git/linux-test.git/arch/x86/tools/insn_sanity.c:23: /work/git/linux-test.git/tools/include/linux/kernel.h:91: warning: "le32_to_cpu" redefined 91 | #define le32_to_cpu | In file included from /work/git/linux-test.git/include/linux/byteorder/little_endian.h:11, from /usr/include/asm/byteorder.h:5, from /work/git/linux-test.git/arch/x86/include/asm/insn.h:10, from /work/git/linux-test.git/arch/x86/tools/insn_sanity.c:21: /work/git/linux-test.git/include/linux/byteorder/generic.h:89: note: this is the location of the previous definition 89 | #define le32_to_cpu __le32_to_cpu | In file included from /work/git/linux-test.git/arch/x86/lib/insn.c:8, from /work/git/linux-test.git/arch/x86/tools/insn_sanity.c:23: /work/git/linux-test.git/tools/include/linux/kernel.h:92: warning: "le64_to_cpu" redefined 92 | #define le64_to_cpu | In file included from /work/git/linux-test.git/include/linux/byteorder/little_endian.h:11, from /usr/include/asm/byteorder.h:5, from /work/git/linux-test.git/arch/x86/include/asm/insn.h:10, from /work/git/linux-test.git/arch/x86/tools/insn_sanity.c:21: /work/git/linux-test.git/include/linux/byteorder/generic.h:87: note: this is the location of the previous definition 87 | #define le64_to_cpu __le64_to_cpu | In file included from /work/git/linux-test.git/arch/x86/lib/insn.c:8, from /work/git/linux-test.git/arch/x86/tools/insn_sanity.c:23: /work/git/linux-test.git/tools/include/linux/kernel.h:93: warning: "cpu_to_be16" redefined 93 | #define cpu_to_be16 bswap_16 | In file included from /work/git/linux-test.git/include/linux/byteorder/little_endian.h:11, from /usr/include/asm/byteorder.h:5, from /work/git/linux-test.git/arch/x86/include/asm/insn.h:10, from /work/git/linux-test.git/arch/x86/tools/insn_sanity.c:21: /work/git/linux-test.git/include/linux/byteorder/generic.h:96: note: this is the location of the previous definition 96 | #define cpu_to_be16 __cpu_to_be16 | In file included from /work/git/linux-test.git/arch/x86/lib/insn.c:8, from /work/git/linux-test.git/arch/x86/tools/insn_sanity.c:23: /work/git/linux-test.git/tools/include/linux/kernel.h:94: warning: "cpu_to_be32" redefined 94 | #define cpu_to_be32 bswap_32 | In file included from /work/git/linux-test.git/include/linux/byteorder/little_endian.h:11, from /usr/include/asm/byteorder.h:5, from /work/git/linux-test.git/arch/x86/include/asm/insn.h:10, from /work/git/linux-test.git/arch/x86/tools/insn_sanity.c:21: /work/git/linux-test.git/include/linux/byteorder/generic.h:94: note: this is the location of the previous definition 94 | #define cpu_to_be32 __cpu_to_be32 | In file included from /work/git/linux-test.git/arch/x86/lib/insn.c:8, from /work/git/linux-test.git/arch/x86/tools/insn_sanity.c:23: /work/git/linux-test.git/tools/include/linux/kernel.h:95: warning: "cpu_to_be64" redefined 95 | #define cpu_to_be64 bswap_64 | In file included from /work/git/linux-test.git/include/linux/byteorder/little_endian.h:11, from /usr/include/asm/byteorder.h:5, from /work/git/linux-test.git/arch/x86/include/asm/insn.h:10, from /work/git/linux-test.git/arch/x86/tools/insn_sanity.c:21: /work/git/linux-test.git/include/linux/byteorder/generic.h:92: note: this is the location of the previous definition 92 | #define cpu_to_be64 __cpu_to_be64 | In file included from /work/git/linux-test.git/arch/x86/lib/insn.c:8, from /work/git/linux-test.git/arch/x86/tools/insn_sanity.c:23: /work/git/linux-test.git/tools/include/linux/kernel.h:96: warning: "be16_to_cpu" redefined 96 | #define be16_to_cpu bswap_16 | In file included from /work/git/linux-test.git/include/linux/byteorder/little_endian.h:11, from /usr/include/asm/byteorder.h:5, from /work/git/linux-test.git/arch/x86/include/asm/insn.h:10, from /work/git/linux-test.git/arch/x86/tools/insn_sanity.c:21: /work/git/linux-test.git/include/linux/byteorder/generic.h:97: note: this is the location of the previous definition 97 | #define be16_to_cpu __be16_to_cpu | In file included from /work/git/linux-test.git/arch/x86/lib/insn.c:8, from /work/git/linux-test.git/arch/x86/tools/insn_sanity.c:23: /work/git/linux-test.git/tools/include/linux/kernel.h:97: warning: "be32_to_cpu" redefined 97 | #define be32_to_cpu bswap_32 | In file included from /work/git/linux-test.git/include/linux/byteorder/little_endian.h:11, from /usr/include/asm/byteorder.h:5, from /work/git/linux-test.git/arch/x86/include/asm/insn.h:10, from /work/git/linux-test.git/arch/x86/tools/insn_sanity.c:21: /work/git/linux-test.git/include/linux/byteorder/generic.h:95: note: this is the location of the previous definition 95 | #define be32_to_cpu __be32_to_cpu | In file included from /work/git/linux-test.git/arch/x86/lib/insn.c:8, from /work/git/linux-test.git/arch/x86/tools/insn_sanity.c:23: /work/git/linux-test.git/tools/include/linux/kernel.h:98: warning: "be64_to_cpu" redefined 98 | #define be64_to_cpu bswap_64 | In file included from /work/git/linux-test.git/include/linux/byteorder/little_endian.h:11, from /usr/include/asm/byteorder.h:5, from /work/git/linux-test.git/arch/x86/include/asm/insn.h:10, from /work/git/linux-test.git/arch/x86/tools/insn_sanity.c:21: /work/git/linux-test.git/include/linux/byteorder/generic.h:93: note: this is the location of the previous definition 93 | #define be64_to_cpu __be64_to_cpu | In file included from /work/git/linux-test.git/arch/x86/lib/insn.c:8, from /work/git/linux-test.git/arch/x86/tools/insn_sanity.c:23: /work/git/linux-test.git/tools/include/linux/kernel.h:105: warning: "ARRAY_SIZE" redefined 105 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) | /work/git/linux-test.git/arch/x86/tools/insn_sanity.c:19: note: this is the location of the previous definition 19 | #define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0])) | make[2]: *** [scripts/Makefile.host:95: arch/x86/tools/insn_sanity] Error 1 make[2]: *** Waiting for unfinished jobs.... make[1]: *** [arch/x86/Makefile:267: bzImage] Error 2 make[1]: *** Waiting for unfinished jobs....
Attachment:
config
Description: Binary data