Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1567672pxb; Thu, 4 Feb 2021 17:05:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJwbKaPA9tAB11TMjWDfyy3spz4hJ23wnxYaulVeQ1N/LR4TKnOv27Ic85jmKddF2kdJcX0s X-Received: by 2002:a50:da8b:: with SMTP id q11mr1232993edj.352.1612487151911; Thu, 04 Feb 2021 17:05:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612487151; cv=none; d=google.com; s=arc-20160816; b=fj3al08jZI4+ovU0Vvq6u5ID5R1qEWfK6N+tCW4/s5NLNDcsjCuYqd44MDQeIr1t70 3NZ0Q0VVhmkU31y9rXik3YVCb8mimPvr8nRnKAdHE8xrM7Y+leWvOlRFf2MJPxtQtfn/ zxr9uQ6Te3sPXqHO3k7APatFSr9OM+MXxkja9nTI61U5fKuYOFLpqcfDofF1bLLxh+jQ fJy8fh00NTUNSYaiu7+/m0jbpV1tIHdn83y+VN2YLvCSBFZf6qWtHX3IjfNiqK1H7rKO Zoln64WL36MW9Sd4wOs1h9Zdos9ZBcpyOaCca1f6edgspAe/EOO999KI79yqIe6BW/6w PG5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:mime-version:message-id:date :sender:dkim-signature; bh=jVxxi2FsPuJw4XM1jbb8exuFnk/zAFQh52OuUnL6x5c=; b=gs7/zLuosji34o1SgkcQPiP0PYBrzHfbbM42uv5sVG/h5FurnHQ6+NreijZ8nKFToY Vgcuh2d/HaPpoDiEW8Y6GV94Cpc22MGpyBxS6LYGWWmB+jpDTmqECo9tfjjVlfb8PQc9 /RnxBXTkgZUEKoCTD9NIY2FtXtPEbckEQybRl0fQWEpXQbmSNxLUKr5qI7v1wAfJ37+5 gd0GUKctF008UQNHhXYxdzTFZPGyWgosSZBw1kN6hqRQEeVO42lBlQpVAahaOVUymgGT i1iODkMKJNUKh6u7lthQDwg5msiqHnC+ftdRb9xjIEQtj+KmG9R4mX5c7QZaOsdF0Vy5 KRJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=cBBH6E38; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n25si4065234eja.737.2021.02.04.17.05.27; Thu, 04 Feb 2021 17:05:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=cBBH6E38; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238225AbhBDRVn (ORCPT + 99 others); Thu, 4 Feb 2021 12:21:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238295AbhBDRUZ (ORCPT ); Thu, 4 Feb 2021 12:20:25 -0500 Received: from mail-pg1-x549.google.com (mail-pg1-x549.google.com [IPv6:2607:f8b0:4864:20::549]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5909C061786 for ; Thu, 4 Feb 2021 09:19:45 -0800 (PST) Received: by mail-pg1-x549.google.com with SMTP id 18so2750429pgp.22 for ; Thu, 04 Feb 2021 09:19:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:message-id:mime-version:subject:from:to:cc; bh=jVxxi2FsPuJw4XM1jbb8exuFnk/zAFQh52OuUnL6x5c=; b=cBBH6E38w3ioyeFqsdVI637YfnFdofxvqmnPq3Agbtor84vP4DOwxc29ct1qwg1dTr k3Enyv1FSv3SKdG6Pyefp5vIiAPf0wtby8liexvP0SZTzpOAOdqRBCUjs7ByW54gJV+7 bHlUjZ2phzNhw7TpKljfGEcnDmNFE205AsM4pPwqBna8CnFmSsvK9Nm252VXdEP2KEam 4WqKIF3bUtfx1CHRgj6G4R2f8XVM2/fzMyeHR/4WRRY4MeabYJPNKaqjwf4bCqc6bnCT OEASH+3HzCato3ZPypgQvZv4Nf7U4DiHGHzsbE5/bCSUj3uY46G4fduPbEJ/LUoEaGz+ 1DLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:message-id:mime-version:subject:from :to:cc; bh=jVxxi2FsPuJw4XM1jbb8exuFnk/zAFQh52OuUnL6x5c=; b=bKiNbi8NfCp8T/777HFGhJx8iQsF4291AqpqVObrzexr1OHlPItRrYGz/QbUac3KGu ry7mxD4EvavyitDZd4ZRWaca4KEF2HZp7dPJm28/xS9N9KGuq+NbqL6UWPpoqXMrY17Q n5mT4/TBDNwmzmFmv6GKh3KnJcrh27FBVe+o4ByHLyBNGIJRwuMe3KDBAZguNgUPubEb sVWdPhJvyO9KucriOxO49V6imQe+GwNY0ofb+/iRsjBkZQ9XdxMCmpfOvbMMoTZs88Xt Oro5HShwEd85ZCLQ2OHoNAZONyRZ2hhliaPJ6ucFFhSYdrXVWwuo97xtw9la6Q8HgL+h WncA== X-Gm-Message-State: AOAM532LYUdzlu8QTSmRQqFhXqwIdNPZyqzDPHJBJWFynamynkb01XDB O3w/qFBPnJB7bFjS4BXMyKUvBbdEjyF2 Sender: "brianvv via sendgmr" X-Received: from brianvv.c.googlers.com ([fda3:e722:ac3:10:7f:e700:c0a8:348]) (user=brianvv job=sendgmr) by 2002:a17:90a:7503:: with SMTP id q3mr480577pjk.79.1612459185194; Thu, 04 Feb 2021 09:19:45 -0800 (PST) Date: Thu, 4 Feb 2021 17:19:41 +0000 Message-Id: <20210204171942.469883-1-brianvv@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.30.0.365.g02bc693789-goog Subject: [PATCH net-next 1/2] net: add EXPORT_INDIRECT_CALLABLE wrapper From: Brian Vazquez To: Brian Vazquez , Brian Vazquez , Eric Dumazet , "David S . Miller" Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Stephen Rothwell Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When a static function is annotated with INDIRECT_CALLABLE_SCOPE and CONFIG_RETPOLINE is set, the static keyword is removed. Sometimes the function needs to be exported but EXPORT_SYMBOL can't be used because if CONFIG_RETPOLINE is not set, we will attempt to export a static symbol. This patch introduces a new indirect call wrapper: EXPORT_INDIRECT_CALLABLE. This basically does EXPORT_SYMBOL when CONFIG_RETPOLINE is set, but does nothing when it's not. Reported-by: Stephen Rothwell Signed-off-by: Brian Vazquez --- include/linux/indirect_call_wrapper.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/indirect_call_wrapper.h b/include/linux/indirect_call_wrapper.h index 54c02c84906a..a8345c8a613d 100644 --- a/include/linux/indirect_call_wrapper.h +++ b/include/linux/indirect_call_wrapper.h @@ -36,6 +36,7 @@ #define INDIRECT_CALLABLE_DECLARE(f) f #define INDIRECT_CALLABLE_SCOPE +#define EXPORT_INDIRECT_CALLABLE(f) EXPORT_SYMBOL(f) #else #define INDIRECT_CALL_1(f, f1, ...) f(__VA_ARGS__) @@ -44,6 +45,7 @@ #define INDIRECT_CALL_4(f, f4, f3, f2, f1, ...) f(__VA_ARGS__) #define INDIRECT_CALLABLE_DECLARE(f) #define INDIRECT_CALLABLE_SCOPE static +#define EXPORT_INDIRECT_CALLABLE(f) #endif /* -- 2.30.0.365.g02bc693789-goog