Re: is there an efficient module_is_builtin() test ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 09 Mar 2021 12:55:14 -0700, jim.cromie@xxxxxxxxx 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@xxxxxxxxxxxxxxxxx
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]

  Powered by Linux