diff mbox series

[v4,1/3] kbuild: add mod(name,file)_flags to assembler flags for module objects

Message ID 20240614171428.968174-2-kris.van.hees@oracle.com (mailing list archive)
State Handled Elsewhere
Headers show
Series Generate address range data for built-in modules | expand

Commit Message

Kris Van Hees June 14, 2024, 5:14 p.m. UTC
Module objects compiled from C source can be identified by the presence
of -DKBUILD_MODFILE and -DKBUILD_MODNAME on their compile command lines.
However, module objects from assembler source do not have this defines.

Add $(modfile_flags) to modkern_aflags (similar to modkern_cflahs), and
add $(modname_flags) to a_flags (similar to c_flags).

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
---
 scripts/Makefile.lib | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Steven Rostedt June 14, 2024, 5:46 p.m. UTC | #1
On Fri, 14 Jun 2024 13:14:26 -0400
Kris Van Hees <kris.van.hees@oracle.com> wrote:

> Module objects compiled from C source can be identified by the presence
> of -DKBUILD_MODFILE and -DKBUILD_MODNAME on their compile command lines.
> However, module objects from assembler source do not have this defines.
> 
> Add $(modfile_flags) to modkern_aflags (similar to modkern_cflahs), and
> add $(modname_flags) to a_flags (similar to c_flags).

You explain what this does but not why it does it.

-- Steve
Kris Van Hees June 14, 2024, 6:10 p.m. UTC | #2
On Fri, Jun 14, 2024 at 01:46:51PM -0400, Steven Rostedt wrote:
> On Fri, 14 Jun 2024 13:14:26 -0400
> Kris Van Hees <kris.van.hees@oracle.com> wrote:
> 
> > Module objects compiled from C source can be identified by the presence
> > of -DKBUILD_MODFILE and -DKBUILD_MODNAME on their compile command lines.
> > However, module objects from assembler source do not have this defines.
> > 
> > Add $(modfile_flags) to modkern_aflags (similar to modkern_cflahs), and
> > add $(modname_flags) to a_flags (similar to c_flags).
> 
> You explain what this does but not why it does it.

The first paragraph is meant to estabish the "why" (being able to identify
what objects are module objects, even if they are compiled from assembler
source).

As I mention, for objects compiled from C source code, those defines being
present identifies those objects as belonging to a module.  For objects
compiled from assembler source code, those defines are not present.  Passing
them on the compile command line for assembler source code files for objects
that are part of one or more modules allows us to identify all objects that
are part of modules with a single consistent mechanism.

	Kris
Steven Rostedt June 14, 2024, 6:26 p.m. UTC | #3
On Fri, 14 Jun 2024 14:10:58 -0400
Kris Van Hees <kris.van.hees@oracle.com> wrote:

> On Fri, Jun 14, 2024 at 01:46:51PM -0400, Steven Rostedt wrote:
> > On Fri, 14 Jun 2024 13:14:26 -0400
> > Kris Van Hees <kris.van.hees@oracle.com> wrote:
> >   
> > > Module objects compiled from C source can be identified by the presence
> > > of -DKBUILD_MODFILE and -DKBUILD_MODNAME on their compile command lines.
> > > However, module objects from assembler source do not have this defines.
> > > 
> > > Add $(modfile_flags) to modkern_aflags (similar to modkern_cflahs), and
> > > add $(modname_flags) to a_flags (similar to c_flags).  
> > 
> > You explain what this does but not why it does it.  
> 
> The first paragraph is meant to estabish the "why" (being able to identify
> what objects are module objects, even if they are compiled from assembler
> source).

Perhaps there's a lack of context. Sure, the cover letter can help in
this regard, but I always look at each commit as a stand alone.

> 
> As I mention, for objects compiled from C source code, those defines being
> present identifies those objects as belonging to a module.  For objects
> compiled from assembler source code, those defines are not present.  Passing
> them on the compile command line for assembler source code files for objects
> that are part of one or more modules allows us to identify all objects that
> are part of modules with a single consistent mechanism.

Sure, but why do we care? Again, if this was the only patch you sent,
it should explain why it is being done.

Perhaps something like: "In order to be able to identify what code is
from a module, even if it is built in, ..."

But what you are saying is just "C code has these flags, make
assembly have them too". Which is meaningless.

The other patches could use some more explanation too.

-- Steve
Kris Van Hees Aug. 14, 2024, 2:26 p.m. UTC | #4
On Fri, Jun 14, 2024 at 02:26:21PM -0400, Steven Rostedt wrote:
> On Fri, 14 Jun 2024 14:10:58 -0400
> Kris Van Hees <kris.van.hees@oracle.com> wrote:
> 
> > On Fri, Jun 14, 2024 at 01:46:51PM -0400, Steven Rostedt wrote:
> > > On Fri, 14 Jun 2024 13:14:26 -0400
> > > Kris Van Hees <kris.van.hees@oracle.com> wrote:
> > >   
> > > > Module objects compiled from C source can be identified by the presence
> > > > of -DKBUILD_MODFILE and -DKBUILD_MODNAME on their compile command lines.
> > > > However, module objects from assembler source do not have this defines.
> > > > 
> > > > Add $(modfile_flags) to modkern_aflags (similar to modkern_cflahs), and
> > > > add $(modname_flags) to a_flags (similar to c_flags).  
> > > 
> > > You explain what this does but not why it does it.  
> > 
> > The first paragraph is meant to estabish the "why" (being able to identify
> > what objects are module objects, even if they are compiled from assembler
> > source).
> 
> Perhaps there's a lack of context. Sure, the cover letter can help in
> this regard, but I always look at each commit as a stand alone.
> 
> > 
> > As I mention, for objects compiled from C source code, those defines being
> > present identifies those objects as belonging to a module.  For objects
> > compiled from assembler source code, those defines are not present.  Passing
> > them on the compile command line for assembler source code files for objects
> > that are part of one or more modules allows us to identify all objects that
> > are part of modules with a single consistent mechanism.
> 
> Sure, but why do we care? Again, if this was the only patch you sent,
> it should explain why it is being done.
> 
> Perhaps something like: "In order to be able to identify what code is
> from a module, even if it is built in, ..."
> 
> But what you are saying is just "C code has these flags, make
> assembly have them too". Which is meaningless.
> 
> The other patches could use some more explanation too.

Hi Steve,

Thank you for your feedback.  I hope that my new patch series [0] addresses
your questions.

Kris
diff mbox series

Patch

diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 3179747cbd2c..a2524ffd046f 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -234,7 +234,7 @@  modkern_rustflags =                                              \
 
 modkern_aflags = $(if $(part-of-module),				\
 			$(KBUILD_AFLAGS_MODULE) $(AFLAGS_MODULE),	\
-			$(KBUILD_AFLAGS_KERNEL) $(AFLAGS_KERNEL))
+			$(KBUILD_AFLAGS_KERNEL) $(AFLAGS_KERNEL) $(modfile_flags))
 
 c_flags        = -Wp,-MMD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE)     \
 		 -include $(srctree)/include/linux/compiler_types.h       \
@@ -244,7 +244,7 @@  c_flags        = -Wp,-MMD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE)     \
 rust_flags     = $(_rust_flags) $(modkern_rustflags) @$(objtree)/include/generated/rustc_cfg
 
 a_flags        = -Wp,-MMD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE)     \
-		 $(_a_flags) $(modkern_aflags)
+		 $(_a_flags) $(modkern_aflags) $(modname_flags)
 
 cpp_flags      = -Wp,-MMD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE)     \
 		 $(_cpp_flags)