Re: '-D' 'KBUILD_MODSYM=main - like KBUILD_MODNAME, without the quotes ?

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

 





On Thu, Jan 28, 2021 at 4:57 PM Valdis Klētnieks <valdis.kletnieks@xxxxxx> wrote:
On Thu, 28 Jan 2021 12:11:54 -0700, jim.cromie@xxxxxxxxx said:

> In my hacking, Im finding this useful.
> it adds a version of KBUILD_MODNAME without the quotes

OK, I'll bite.  When and how is this useful?


heres my use

#define DEFINE_DYNAMIC_DEBUG_TABLE_(_sym_,_mod_)       \
weak struct _ddebug \
__used __aligned(8) \
__section(".gnu.linkonce." _mod_ ".dyndbg") \
_sym_##_dyndbg_base = { \
.site = &_sym_##_dyndbg_site, \
.format = _mod_, \
.lineno = 0 \
}

#pragma message "OK<" KBUILD_MODNAME ">[" __stringify(KBUILD_MODSYM) "] adding DYNDBG_TABLE"

#define DEFINE_DYNAMIC_DEBUG_TABLE() \
DEFINE_DYNAMIC_DEBUG_TABLE_(KBUILD_MODSYM, KBUILD_MODNAME);
 
that pragma does:

                 from /home/jimc/projects/lx/wk-next/init/version.c:14:
/home/jimc/projects/lx/wk-next/include/linux/dynamic_debug.h:172:9: note: ‘#pragma message: OK<version>[version] adding DYNDBG_TABLE’
  172 | #pragma message "OK<" KBUILD_MODNAME ">[" __stringify(KBUILD_MODSYM) "] adding DYNDBG_TABLE"
      |         ^~~~~~~
  CC      init/do_mounts.o

IOW the _sym_ works better for ## token-joining


> KBUILD_MODNAME has the quotes for a reason;

Hint:  do a "git grep KBUILD_MODNAME", look at how it's used, and
think about how invasive a patch to change it would be...
(And pay heed to the comment in arch/sparc/include/asm/vio.h -
it means that there's second-order effects to deal with as well...)


I have no intention of changing KBUILD_MODNAME.
I created a near-synonym to avoid exactly that.

 
> Afterall, __stringify() could add the quotes for cases where it was needed.Afterall, __stringify() could add the quotes for cases where it was needed.

How would it know?

It would not.
you would add it to create the quoted version, as I used in the pragma. 
obviously theres no need, since KBUILD_MODNAME already exists.

So question reduces to:

is there anything brittle with the Makefile -DKBUILD_MODSYM=$modname addition ?
_______________________________________________
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