Re: Question on MODULE_VERSION macro

From: Sam Ravnborg
Date: Sun Feb 22 2004 - 17:24:25 EST


> > Any update on the MODULE_VERSION macro getting into mainline?
>
> Sam need to ack the build system changes.

I have taken a look at it now.

As you mention yourself this assume all input files for a module
is .c files. Which is almost always the case.
But I do not like the fact that we warn in cases where .s files is
actually used.

Current implementation will also fail when using O= syntax.

The more correct approach is to list the .o files in the
.mod file. Then in sumversion find the corresponding .file.o.cmd, and parse
up the name of the corresponding source file (listed as the first filename
in the deps_ assignment, and pass this filename to grab_file.

Example .file.o.cmd file:
sam@mars:~/bk/v2.6> head -10 ~/b/drivers/scsi/aic7xxx/.aic7xxx_osm.o.cmd
cmd_drivers/scsi/aic7xxx/aic7xxx_osm.o := gcc -Wp,-MD,drivers/scsi/aic7xxx/.aic7xxx_osm.o.d -nostdinc -iwithprefix include -D__KERNEL__ -Iinclude -Iinclude2 -I/home/sam/bk/v2.6/include -I/home/sam/bk/v2.6/drivers/scsi/aic7xxx -Idrivers/scsi/aic7xxx -D__KERNEL__ -I/home/sam/bk/v2.6/include -Iinclude -I/home/sam/bk/v2.6/include2 -Iinclude2 -I/home/sam/bk/v2.6/include -Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -pipe -mpreferred-stack-boundary=2 -march=i686 -I/home/sam/bk/v2.6/include/asm-i386/mach-default -Iinclude/asm-i386/mach-default -O2 -fomit-frame-pointer -I/home/sam/bk/v2.6/drivers/scsi -Idrivers/scsi -DMODULE -DKBUILD_BASENAME=aic7xxx_osm -DKBUILD_MODNAME=aic7xxx -c -o drivers/scsi/aic7xxx/aic7xxx_osm.o /home/sam/bk/v2.6/drivers/scsi/aic7xxx/aic7xxx_osm.c

deps_drivers/scsi/aic7xxx/aic7xxx_osm.o := \
/home/sam/bk/v2.6/drivers/scsi/aic7xxx/aic7xxx_osm.c \
$(wildcard include/config/aic7xxx/reset/delay/ms.h) \
$(wildcard include/config/aic7xxx/proc/stats.h) \


Here the source file is listed with absolute path.
It must be as simple as searching through the file for a line starting with deps_,
and then read the following line.

The .mod file will specify the path to the .file.o.cmd file, since this
is an output file, there is no need to use $(srctree).

I hope I made the approach clear enough?

Sam

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/