From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62DAAC433DF for ; Tue, 11 Aug 2020 14:12:26 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2DC6E2076C for ; Tue, 11 Aug 2020 14:12:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="CwaskDuC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2DC6E2076C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=iogearbox.net Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=GUZCnPC35bUpl6x96TmD6gCit0tXfoTswJ0YgHuytoY=; b=CwaskDuC8KJdT61+ECsug9v0G 1ieyWj1788UMSpLbemtH9wl2mkGDNWy6VzTN0nmJVtaiY6o5WzbVphVyANJQjJOgRs85sOt42VPW+ eJReC+NzJcTIqGqG9K1y4a8huu11BXCLVNPOo1FSiSsrbvp/tLWIm7Ed5SPlLjGI+xi0aGEpqnlQ6 wvMEhk4cb8+21lTphONSYL7aQFjrgjPBJE38I01OUfXolkH3KUjdEfSp3vhc0URR/P6HirGegdlOG 5AE/XiyZ7XuwVZE2/LzA6e4IDSvgo3gQFwLPPH5Lb0z6tqqQPN49JG6gOxiRWrkLUkXJfy+4v6xY0 LLd3d5ogw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k5UzH-000606-Co; Tue, 11 Aug 2020 14:10:47 +0000 Received: from www62.your-server.de ([213.133.104.62]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k5UzE-0005z6-5b for linux-arm-kernel@lists.infradead.org; Tue, 11 Aug 2020 14:10:45 +0000 Received: from sslproxy01.your-server.de ([78.46.139.224]) by www62.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89_1) (envelope-from ) id 1k5Uz1-0000N6-QL; Tue, 11 Aug 2020 16:10:31 +0200 Received: from [178.196.57.75] (helo=pc-9.home) by sslproxy01.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k5Uz1-000JTh-Ij; Tue, 11 Aug 2020 16:10:31 +0200 Subject: Re: [PATCH bpf] libbpf: Handle GCC built-in types for Arm NEON To: Jean-Philippe Brucker , ast@kernel.org References: <20200810122835.2309026-1-jean-philippe@linaro.org> From: Daniel Borkmann Message-ID: <65afcc0c-5468-1654-83d6-dade2c848745@iogearbox.net> Date: Tue, 11 Aug 2020 16:10:31 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <20200810122835.2309026-1-jean-philippe@linaro.org> Content-Language: en-US X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.102.4/25900/Mon Aug 10 14:44:29 2020) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200811_101044_221832_B196FD37 X-CRM114-Status: GOOD ( 19.61 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: songliubraving@fb.com, Jakov Petrina , john.fastabend@gmail.com, kpsingh@chromium.org, yhs@fb.com, bpf@vger.kernel.org, andriin@fb.com, kafai@fb.com, linux-arm-kernel@lists.infradead.org Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 8/10/20 2:28 PM, Jean-Philippe Brucker wrote: > When building Arm NEON (SIMD) code, GCC emits built-in types __PolyXX_t, > which are not recognized by Clang. This causes build failures when > including vmlinux.h generated from a kernel built with CONFIG_RAID6_PQ=y > and CONFIG_KERNEL_MODE_NEON. Emit typedefs for these built-in types, > based on the Clang definitions. poly64_t is unsigned long because it's > only defined for 64-bit Arm. > > Including linux/kernel.h to use ARRAY_SIZE() incidentally redefined > max(), causing a build bug due to different types, hence the seemingly > unrelated change. > > Reported-by: Jakov Petrina > Signed-off-by: Jean-Philippe Brucker Looks like this was fixed here [0], but not available on older clang/LLVM versions, right? [0] https://reviews.llvm.org/D79711 [...] > > +static const char *builtin_types[][2] = { > + /* > + * GCC emits typedefs to its internal __PolyXX_t types when compiling > + * Arm SIMD intrinsics. Alias them to the same standard types as Clang. > + */ > + { "__Poly8_t", "unsigned char" }, > + { "__Poly16_t", "unsigned short" }, > + { "__Poly64_t", "unsigned long" }, > + { "__Poly128_t", "unsigned __int128" }, In that above LLVM link [0], they typefdef this to signed types ... which one is correct now? // For now, signedness of polynomial types depends on target OS << "#ifdef __aarch64__\n"; OS << "typedef uint8_t poly8_t;\n"; OS << "typedef uint16_t poly16_t;\n"; OS << "typedef uint64_t poly64_t;\n"; OS << "typedef __uint128_t poly128_t;\n"; OS << "#else\n"; OS << "typedef int8_t poly8_t;\n"; OS << "typedef int16_t poly16_t;\n"; OS << "typedef int64_t poly64_t;\n"; OS << "#endif\n"; > +}; > + > +static void btf_dump_emit_int_def(struct btf_dump *d, __u32 id, > + const struct btf_type *t) > +{ > + const char *name = btf_dump_type_name(d, id); > + int i; > + > + for (i = 0; i < ARRAY_SIZE(builtin_types); i++) { > + if (strcmp(name, builtin_types[i][0]) == 0) { > + btf_dump_printf(d, "typedef %s %s;\n\n", > + builtin_types[i][1], name); > + break; > + } > + } > +} > + > static void btf_dump_emit_enum_fwd(struct btf_dump *d, __u32 id, > const struct btf_type *t) > { > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel