Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp121216iol; Wed, 8 Jun 2022 23:50:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyy8jJ6poZcYQAQCpNEUflX+RrX75yOJxcQIUFxEYmhf+tD6+NH8317+7YqjOlp8hILemD7 X-Received: by 2002:a17:906:a245:b0:708:ce69:e38b with SMTP id bi5-20020a170906a24500b00708ce69e38bmr34819297ejb.100.1654757422289; Wed, 08 Jun 2022 23:50:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654757422; cv=none; d=google.com; s=arc-20160816; b=IoUjTSnhNBBhDpBNT3anjiEWljqdVqcQuhAJ0zzmJ2TdjWqHDoFP4L+G+YZPgmMQ1U GG1mRCueknt3YrRaunYXoAl9jYD27JHZHox04EHHGNf68/QRU4OC1J1iqAQWHVyBZT62 9ZUWrHlXrshhr6cuUPHwEt+ucSHm2uIol2hqF4Br827zNqWCEnK6pTjLIE5/ByR5ACBg MEifx8ST7rxjbZICeLwVXvgXrC9V3RSeGvELmI9aR4sK386BwTCD4hOjeXZyyT07wmqc yfqPx0xDoIqPLSKy5rDhfCMSniRjFxAnjEoay9a+yNyPB1pKV1XUz0IlBtYuQ90/Zpjr IaLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=E1ri1ukx6Vx1NLRGSHD+ge+wUstRc/ldJH0iFpmi8aQ=; b=ccyzKJsNYvgey+Ugq3l1xcK/05fW79morGM7tbLqN2E/YxS8iRDX6fzQdagspaIyQn TAtY9VJhR+kgMcqzYTlsC3cKLZEGIwcQb4NXM+n5owy2irBNLCM8+RiOVu7nY+ZHrDXJ hjOC91d20+JAkgdfRAWLB1cxaxsHjWLJnRhRU0UstKwRsV0EDgDjZnxSp5Qd/CtByXTh KOXKv+OjH+JUaPn8QBO65S3FHUoyvwSszVAfpvo+SJ4zVTofbCuYdoXbIrhNKG2ugoAV Fal/xyA3legedx1kRoY60dzmvZdBuxyl38wj+2E3BtfL+qV++0w0xbukk6BZclEPlMj3 RRXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=qtphDcKP; 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 b4-20020aa7d484000000b0042dd274260csi21174106edr.634.2022.06.08.23.49.57; Wed, 08 Jun 2022 23:50:22 -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=qtphDcKP; 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 S238202AbiFIGY2 (ORCPT + 99 others); Thu, 9 Jun 2022 02:24:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231339AbiFIGY0 (ORCPT ); Thu, 9 Jun 2022 02:24:26 -0400 Received: from mail-il1-x132.google.com (mail-il1-x132.google.com [IPv6:2607:f8b0:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01FF0CFB; Wed, 8 Jun 2022 23:24:25 -0700 (PDT) Received: by mail-il1-x132.google.com with SMTP id y16so18113822ili.13; Wed, 08 Jun 2022 23:24:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=E1ri1ukx6Vx1NLRGSHD+ge+wUstRc/ldJH0iFpmi8aQ=; b=qtphDcKPhwp7KUD1fEGpVgrLnv3May6lb30MGRe+WwoLQDLO7iPWrKR0mp91M0TmOE uRr9SBwuYW/BjRK8ds9dYvi2xiQgeYI9kLm4WLDbLohIj3yF/dOmTJ5EU0J8x3++ZfYE D1fhdvajqzEiPFnEKFQFJ772HwMF8kuGjpLZK61NKR6Ldwciu/xJKC5vaAdynt885qT+ XCY/kJ7qQtA08oMeMSF6VTK24R1QOULZb/vgTBqCOXK8B2uiCzD41Mq3BORf416EmKsK wqTOzdNT6V4Z11u3p7FZRAql9qOEjQ1V5Oo5lKkomUb0EAKloIghG5mcCDPCAjlJHJny sNkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=E1ri1ukx6Vx1NLRGSHD+ge+wUstRc/ldJH0iFpmi8aQ=; b=kxVqE/ihoja9mjgNTTLlD2WYGBouyRA3nJMD88+6vR1AFldeuwJ5Be48fKVk/qp8sr dsp+JTdJB/0aOj7maufiTUuSbe3vGCi14nzDyk6889c/4nLspGww8P1pfjY8rxRTyp2J RdpEVw1Km4YU2tccaE9dex9TFIi2nXkSL6haLzNvPGmqRjRiNmExZNnz4GbtFvQ2V7E/ RS1YU17up7vSXz0SeTeWTXFFGKuvMLpqbv5gOCGxHKZzsUBPTPe2lNEtvlrGnnU8ux0Z OL0KJEyvMSCky173Ee+Y0Cp65TXgocGPp4x/SmUoTRkgx1xjDdI7ZrAgnCQpVkQTecbr csww== X-Gm-Message-State: AOAM532gxabR8z3oGklj3rmQzSpw24lb98lJYOxAveMUYbYbizF9lguS goLZ4vFtl1aXsurTPLs7v0nmdXscsza3bg== X-Received: by 2002:a05:6e02:1aa8:b0:2d3:d69a:6d88 with SMTP id l8-20020a056e021aa800b002d3d69a6d88mr22181153ilv.243.1654755864241; Wed, 08 Jun 2022 23:24:24 -0700 (PDT) Received: from james-x399.localdomain (71-218-113-86.hlrn.qwest.net. [71.218.113.86]) by smtp.gmail.com with ESMTPSA id a125-20020a021683000000b0032b7fb6c33asm9057481jaa.84.2022.06.08.23.24.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 23:24:23 -0700 (PDT) From: James Hilliard To: bpf@vger.kernel.org Cc: James Hilliard , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , netdev@vger.kernel.org (open list:BPF (Safe dynamic programs and tools)), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v3 1/1] libbpf: fix broken gcc SEC pragma macro Date: Thu, 9 Jun 2022 00:24:12 -0600 Message-Id: <20220609062412.3950380-1-james.hilliard1@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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 It seems the gcc preprocessor breaks unless pragmas are wrapped individually inside macros when surrounding __attribute__. Fixes errors like: error: expected identifier or '(' before '#pragma' 106 | SEC("cgroup/bind6") | ^~~ error: expected '=', ',', ';', 'asm' or '__attribute__' before '#pragma' 114 | char _license[] SEC("license") = "GPL"; | ^~~ Signed-off-by: James Hilliard --- Changes v2 -> v3: - just fix SEC pragma Changes v1 -> v2: - replace typeof with __typeof__ instead of changing pragma macros --- tools/lib/bpf/bpf_helpers.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/lib/bpf/bpf_helpers.h b/tools/lib/bpf/bpf_helpers.h index fb04eaf367f1..66d23c47c206 100644 --- a/tools/lib/bpf/bpf_helpers.h +++ b/tools/lib/bpf/bpf_helpers.h @@ -22,11 +22,12 @@ * To allow use of SEC() with externs (e.g., for extern .maps declarations), * make sure __attribute__((unused)) doesn't trigger compilation warning. */ +#define DO_PRAGMA(x) _Pragma(#x) #define SEC(name) \ - _Pragma("GCC diagnostic push") \ - _Pragma("GCC diagnostic ignored \"-Wignored-attributes\"") \ + DO_PRAGMA("GCC diagnostic push") \ + DO_PRAGMA("GCC diagnostic ignored \"-Wignored-attributes\"") \ __attribute__((section(name), used)) \ - _Pragma("GCC diagnostic pop") \ + DO_PRAGMA("GCC diagnostic pop") \ /* Avoid 'linux/stddef.h' definition of '__always_inline'. */ #undef __always_inline -- 2.25.1