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=-3.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no 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 CE355C433DB for ; Tue, 9 Mar 2021 22:27:07 +0000 (UTC) Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (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 4AB0364E7C for ; Tue, 9 Mar 2021 22:27:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4AB0364E7C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=vt.edu Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kernelnewbies-bounces+kernelnewbies=archiver.kernel.org@kernelnewbies.org Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.94) (envelope-from ) id 1lJkog-0007xO-Sb for kernelnewbies@archiver.kernel.org; Tue, 09 Mar 2021 17:27:02 -0500 Received: from mail-qk1-x72f.google.com ([2607:f8b0:4864:20::72f]) by shelob.surriel.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94) (envelope-from ) id 1lJkmu-0006XD-Pg for kernelnewbies@kernelnewbies.org; Tue, 09 Mar 2021 17:25:13 -0500 Received: by mail-qk1-x72f.google.com with SMTP id l4so14874160qkl.0 for ; Tue, 09 Mar 2021 14:25:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vt-edu.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:in-reply-to:references:mime-version:date :message-id; bh=M7bquv0hOEe7bvMxD1mnBA+jYUFr6+4+e4AZdMl9ioo=; b=gGHkjl2Q9FUVwmpfdJ+EaF88t6SkSLoDi6Prz62w5ar4PS8Ite2DaRmNoNeSVpsGXR 194Kvy8wRcQXzc2J5JpkFBj7dlc8S0uEshNQ/281e3KDGKcJTWWA05MQWIPjGJCLryCd OFDzKfq8HvEXVx4eh+wRuD4O7vRplO6aXJFj62MSSY4WFcXY1t8mUJePL7SwHve9nduG oNpPnZ4dtYhQKRtZu2dziroWTX5T0QRINZ7Q15hI4ksKcMv0/vBVEW6OGHG5hCtsX+sI heZDS0bKHfe9zQ8VnP8BtMgQmulObRrIm1LGb87jXtx/o+klVkJD4i2h7OLmddlXVBau Xitg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:in-reply-to:references :mime-version:date:message-id; bh=M7bquv0hOEe7bvMxD1mnBA+jYUFr6+4+e4AZdMl9ioo=; b=W0OPk7EMeLn+H65L+zcnLgbjsWrJ/fV9PB3s4c1SHqD7arftXJLWSqJMAzf9KaR2HK FDyu8xpJCQqXArnm6uoHEqQ1p7XINPSiF8Vo983wio0Ye5cU2hcIo0xNwyrbTp8XNa9l d74Zu+0TxPSkpuZLws6A5dD2nr03ab34EukHwTFIK1GTwku+9MkERPq/AiW0PzUT/Wl6 ++6uiQsEuUNswdFj157uUfiX7KePI1e6chNewNAnKY2Sq/j6iQqUUfymcarwqT1r7EqS k0yco2AkZ44p4phJOiUTFTBxR+WO2GALcmHLT9mOsNyTfmukuthtL2YZTU6ohKGGoxKX fiuw== X-Gm-Message-State: AOAM533EL02Qs3jYCi+ZvxGQ38MuN+5l+cfZdsvka9zUde6tAuIwD3Mv /ttdWrIIGOtuJ/GyATyXg1sVWw== X-Google-Smtp-Source: ABdhPJycvFTA9l4cFypFOotqAN0ufTeeB7hNpCey3K5wrA7kVOu3NyUoZAqpzv3eGhesNQHzSlWmtg== X-Received: by 2002:a05:620a:144a:: with SMTP id i10mr27869050qkl.431.1615328710049; Tue, 09 Mar 2021 14:25:10 -0800 (PST) Received: from turing-police ([2601:5c0:c380:d61::359]) by smtp.gmail.com with ESMTPSA id i9sm11435762qko.69.2021.03.09.14.25.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Mar 2021 14:25:09 -0800 (PST) From: "Valdis Kl=?utf-8?Q?=c4=93?=tnieks" X-Google-Original-From: "Valdis Kl=?utf-8?Q?=c4=93?=tnieks" X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7+dev To: jim.cromie@gmail.com Subject: Re: is there an efficient module_is_builtin() test ? In-reply-to: References: Mime-Version: 1.0 Date: Tue, 09 Mar 2021 17:25:08 -0500 Message-ID: <229754.1615328708@turing-police> Cc: kernelnewbies X-BeenThere: kernelnewbies@kernelnewbies.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Learn about the Linux kernel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kernelnewbies-bounces+kernelnewbies=archiver.kernel.org@kernelnewbies.org On Tue, 09 Mar 2021 12:55:14 -0700, jim.cromie@gmail.com said: > To use the index, I need &dyndbg_sites[], and that only works > for builtin-module's callsites. For loaded modules, I can/have > added a pointer to the section into module load_info, giving me > the base I will need for the ! builtin branch. > > I just need a not expensive is-it-builtin (modref) One way to sidestep it is to stick in an EXPORT_SYMBOL(dyndbg_sites) in the .c file you're defining it, and let the module loader do all the heavy lifting for you. Not sure if some license purist would insist on EXPORT_SYMBOL_GPL instead - the difference will only matter for out-of-tree non-GPL modules. An slightly uglier solution is to do something like #if defined(MODULE) #define FIND_DEBUG /* code to find via load_info */ #else #define FIND_DEBUG /* code to load &dyndbg_site directly */ #endif which you should probably stick into a suitable .h file, and then stick your newly defined FIND_DEBUG where you need the magic happen (probably in a .h file as well) _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies