Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp907055iol; Thu, 9 Jun 2022 17:16:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxix9/TXCepVcMIAbtKepWWQrj3jhXMicD7HhFPC02WEyjzub7PmKaqPDMk7ICdK7wNuu86 X-Received: by 2002:a05:6a00:2918:b0:512:e4b5:60fb with SMTP id cg24-20020a056a00291800b00512e4b560fbmr43102252pfb.50.1654820196580; Thu, 09 Jun 2022 17:16:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654820196; cv=none; d=google.com; s=arc-20160816; b=zku7KFAxCJJNohuW8HHsAXySwT7BnDSmlnly1JK7bEp5mDzZFRKKCaVxEBiacAR//g seH9Zg7E6zwm3XWefVAoASLgnPrNMkxf4L/WNFMzNTyC2Cw3devjcIoEI4KNqYf1slUE QyGq1EFU919Ul+e1A8jpNJnkf3JV8xbcxaDegvP4EhfK9Bp69vyC8CNVDZl0FYjdh/IJ bhguY726DHa0PAzaAdJZ6Dg2Id9Q0YH8Oka83l4UCRsFRNvkvlrv5Q6jK/EdD+7xNeuJ 5mur832fy8z5v2ZKNkXEu20gN8xYGTIp+T1cNqj+AuPVkf9rYA3DOuQ+QylJGshzTK1Y mYIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=X141ZafwMnCya6zJqjlrPW7zfFJHx0toBuGRvDUmsjo=; b=m5UtO/mjWJH6tZkD4aVBTVRmzI6rHOVlx8k18aWa/IU4147YqJxo0U+ZUFrasbKsgS fKGzGuDjeL4OETAUeNItYOOXgWdbpD7VjXQKl5PPFLCsK8xDkKsSJm+t/57Syk0n+xwm oXuf801R0oRG1xGSoDOMUX63SFGXn6DOIrHiCVYeIEXMRZwY6ahNtMANuSS42N/jQ9fB puQiXclKbixos0Ss0Dxf/3CD+CixpQ5qUzj6sgnmPY3EFj41B+jjPzQ/GOUNtsB5LRah 4iNvE/He99VghfuCQA6Yw1S8T+ciy7o6CrFsBS57HZiNkLw/ai7QytdTqzKdV8hz6/J8 ATag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=q0XI0ntO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h189-20020a6383c6000000b003fe4bfeb694si2522590pge.481.2022.06.09.17.16.24; Thu, 09 Jun 2022 17:16:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=q0XI0ntO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345593AbiFIXqa (ORCPT + 99 others); Thu, 9 Jun 2022 19:46:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232670AbiFIXq0 (ORCPT ); Thu, 9 Jun 2022 19:46:26 -0400 Received: from mail-ot1-x333.google.com (mail-ot1-x333.google.com [IPv6:2607:f8b0:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81BB62C11A; Thu, 9 Jun 2022 16:46:25 -0700 (PDT) Received: by mail-ot1-x333.google.com with SMTP id g17-20020a9d6491000000b0060c0f0101ffso6240432otl.7; Thu, 09 Jun 2022 16:46:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=X141ZafwMnCya6zJqjlrPW7zfFJHx0toBuGRvDUmsjo=; b=q0XI0ntOLGfgMtPYG+icei7LjXutXp3f1wiAcFHblSBQLpArWvXjxTipBntsbcUa5q uAuctNRnldKvWtYq1gkFDgB0kTpQYPQIC4IdHb3vJRdBCTUM3tHQ+6BQhB72M0DncDaP yGYp2E8WiYKx8Nwhm/0h+jHI+rgeCZ9oNfNwrpxtlosamsr5k61n8hFpO5GsQjhwIDJa VW4o3S/K1xWzXFEHGkPWiCfCFeLECZpOXn8Upu9Ca3TFWp67de63HE5Sny5P9kCMfbXW 24yo2TyJtFDppyZtP58oWsTlrhFr8CZpZ+rusNdW9ccuMJqpDUXamp6uWijgttsrgCzY TgRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=X141ZafwMnCya6zJqjlrPW7zfFJHx0toBuGRvDUmsjo=; b=eB3SZGWyztcjnWRt/aW2qQZnrm2YKQinq+6AddxQPyP3Gr9IJpzVGSG6wY8DdBx8Gq uDLoqUU4UZVBmM4uvsLFrq85FzlgRmfQtO7OBt+b/cMQRoGCQAGkLAXcUO8PWRbCxhYN D8pyWjIyQD6Le4VNKM3IyukArZxQVvrWOfdKwsxiEwL6DmDb5ZVeriighVnKGihQ3xwM g4gqAuGcV3hqiYI4vhoaaTAyzFijgvyA0u6PjGXpBnAWisPSIUTW6oOhItOVPalLt6H/ dSJqSyY/4/Oetej45oakQeBiDAqQyGLLzIxzWV5AJlbJNN0mBql/rZXSxCMFaTYWdWT/ sEaw== X-Gm-Message-State: AOAM531ePWeK13rd9711Kz8RQ1Y8ngCzUkv7hD4mvaiVg4oUIvLXnwhc zNl8HmxCRUkj6rbfK3dVYKpsMuAzM7RqajIFqUWk/z+KABxoxA== X-Received: by 2002:a9d:7056:0:b0:60c:f8b:afac with SMTP id x22-20020a9d7056000000b0060c0f8bafacmr6250091otj.30.1654818384775; Thu, 09 Jun 2022 16:46:24 -0700 (PDT) MIME-Version: 1.0 References: <20220609062829.293217-1-james.hilliard1@gmail.com> In-Reply-To: From: James Hilliard Date: Thu, 9 Jun 2022 17:46:13 -0600 Message-ID: Subject: Re: [PATCH 1/1] libbpf: replace typeof with __typeof__ for -std=c17 compatibility To: Andrii Nakryiko Cc: bpf , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= , Magnus Karlsson , Maciej Fijalkowski , Jonathan Lemon , "open list:BPF (Safe dynamic programs and tools)" , open list Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 9, 2022 at 12:11 PM Andrii Nakryiko wrote: > > On Wed, Jun 8, 2022 at 11:28 PM James Hilliard > wrote: > > > > Fixes errors like: > > error: expected specifier-qualifier-list before 'typeof' > > 14 | #define __type(name, val) typeof(val) *name > > | ^~~~~~ > > ../src/core/bpf/socket_bind/socket-bind.bpf.c:25:9: note: in expansion of macro '__type' > > 25 | __type(key, __u32); > > | ^~~~~~ > > > > Signed-off-by: James Hilliard > > --- > > If you follow DPDK link you gave me ([0]), you'll see that they ended up doing > > #ifndef typeof > #define typeof __typeof__ > #endif > > It's way more localized. Let's do that. Won't that potentially leak the redefinition into external code including the header file? I don't see a redefinition of typeof like that used elsewhere in the kernel. However I do see __typeof__ used in many headers already so that approach seems to follow normal conventions and seems less risky. FYI using -std=gnu17 instead of -std=c17 works around this issue with bpf-gcc at least so this issue isn't really a blocker like the SEC macro issue, I had just accidentally mixed the two issues up due to accidentally not clearing out some header files when testing, they seem to be entirely separate. > > But also I tried to build libbpf-bootstrap with -std=c17 and > immediately ran into issue with asm, so we need to do the same with > asm -> __asm__. Can you please update your patch and fix both issues? Are you hitting that with clang/llvm or bpf-gcc? It doesn't appear that the libbpf-bootstrap build system is set up to build with bpf-gcc yet. > > [0] https://patches.dpdk.org/project/dpdk/patch/2601191342CEEE43887BDE71AB977258213F3012@irsmsx105.ger.corp.intel.com/ > [1] https://github.com/libbpf/libbpf-bootstrap > > > > tools/lib/bpf/bpf_core_read.h | 16 ++++++++-------- > > tools/lib/bpf/bpf_helpers.h | 4 ++-- > > tools/lib/bpf/bpf_tracing.h | 24 ++++++++++++------------ > > tools/lib/bpf/btf.h | 4 ++-- > > tools/lib/bpf/libbpf_internal.h | 6 +++--- > > tools/lib/bpf/usdt.bpf.h | 6 +++--- > > tools/lib/bpf/xsk.h | 12 ++++++------ > > 7 files changed, 36 insertions(+), 36 deletions(-) > > > > [...]