Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1579929pxb; Thu, 4 Feb 2021 17:29:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJyc4265ARipfaSWizU4p9xPTvpY2BLjWiudaMMjUUfVq65zpn1WF3wU5kQR3Fl8o7IKZAus X-Received: by 2002:a17:906:1be9:: with SMTP id t9mr1704518ejg.527.1612488592131; Thu, 04 Feb 2021 17:29:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612488592; cv=none; d=google.com; s=arc-20160816; b=Fn+dpOhJvMZo16v5V4tcM7akC2F1MghxRfIUvR2G6aKEwjUZd+qKxlz0ZkjsBsb/jX p9evzvNcKL9k/FQF5UsSU7fzxkOWRX3tpKQ2NaVTp7f6Fvla6TRVIMbtg2vPfe+4QA9h FOyK8BWs+IglamNbfu69/ni5yKzg24NzlfM3lD5hs6toMAHnoUGk+Lf1emFjPOpgQY8Z 4SaKEUy9rR3WI01YVtoQWNLLGNMVljSeZMLkiinRdxlwTe/PZGsZ8A/rS7jJQHC2rPM2 CFa77qW/ty0MMcGZEpPto2wJ1Ena4jUeJGPVEF8Uuz4NK0eKgR5+7ZFRVSThv2lkeLnK 6WUQ== 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=V8t1I2FKX7sUoSBq6/YOnGv+KpeZG57ntNXAQWxetSuPgQr9YZ/6YhhuzQ/SLI47gX HyjO/Vyc+Hz2re0vmK1vBlja4I/GcbMjzUAiEHiuUf3cn7dyM4tSLW+siveiBzmZeVz1 TMfDpD5A/9joiilcnNvNTDEbVJK+RLltyzHSPd8c8ypfaMj1P4skXD10vf+kM8+/Jlym rSfMvwR3rsF5+yb3xCEt1OqT+9JtFfXAHRupjAkVD1EU/Ff2hn4Lw53j9JfQB8w8fcpG LQJXTWNH1vmyIL3KFFof+4qiovuwvxZTj531YNNX+5V8wfKLj8N/fVd/i1ziM8Lq43+K NOXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=eoiLv4Fj; 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 11si5562438edw.195.2021.02.04.17.29.27; Thu, 04 Feb 2021 17:29:52 -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=eoiLv4Fj; 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 S238522AbhBDSdJ (ORCPT + 99 others); Thu, 4 Feb 2021 13:33:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238947AbhBDSTf (ORCPT ); Thu, 4 Feb 2021 13:19:35 -0500 Received: from mail-qk1-x74a.google.com (mail-qk1-x74a.google.com [IPv6:2607:f8b0:4864:20::74a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48463C0613D6 for ; Thu, 4 Feb 2021 10:18:55 -0800 (PST) Received: by mail-qk1-x74a.google.com with SMTP id f16so3386879qkk.20 for ; Thu, 04 Feb 2021 10:18:55 -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=eoiLv4Fjju3JEfXDuHbAba/lObCo1w6vbwyoS7MtecyRwqYnXpMFoZNAYuf+W6oplH gED96JwbPRY7jeChrEt5R+59xV+yLfGj24fcQAeQ3kg+O5aLSKHWIqNnkUhhZ+dn8Rq4 BSdC2ZaIBJTBtyH56RgpmICjqdLlGqg7bhCp5MvnfQftXNufcaTDf86YmN34tkYl8nUh E1TEXeKWOfc62QBEEL4iaICZJUqV2BK4Tg1pQtpDeOKiotE8p202ib96xqd5eEqoxJGm +lkG9dpS6gQ0YmtwBPKtO1zwA8TCpj/+Qfh0XPeMeyCRpOBP6XgHl3PnRK0X4FR79HSi HU0A== 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=adrgtDk15dlGSpPPmqsrqAzVcRJwc+gN97CmPsev/asAs2wlZp1HeDYN/fykJcY1O1 ZTI3/XNOAzB7p9jtyNM5GtMZ8MfHHjXKVydEG6VJjwkVpRIZ4UVYHTz/fpvkrxYorR8l k4ZE4abrzXsnXVL0PPHokvFHOGUe/92TkZRfblveCJ8DZl6qNc2luZ2o7z1Fu02nI180 e/BU58s8IEq1eJvCbe+l1Zy2S+yTunmQ4FVF78iThsAHS0MbaQom6138YWJZn49TRgns CgmK6Rw53IX/QbUgHDrMsq6NXinPIPijNFZtvVDFK5oMXjcRHgkYGIxMKqwSofhjpPF9 Z8wg== X-Gm-Message-State: AOAM530d/vZ5nYAq85HSUhWuhKeQCbLga6Vt5N9sdqV+AZsoIGsNOyUb hpzgF+hXziKzvx7wLijhxu0Cfevpb6lQ 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:a0c:e652:: with SMTP id c18mr436707qvn.59.1612462734464; Thu, 04 Feb 2021 10:18:54 -0800 (PST) Date: Thu, 4 Feb 2021 18:18:38 +0000 Message-Id: <20210204181839.558951-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