Re: Duplicated module names
From: Sudeep Holla
Date: Fri Jan 29 2016 - 10:58:27 EST
On Fri, Jan 29, 2016 at 5:54 AM, Rusty Russell <rusty@xxxxxxxxxxxxxxx> wrote:
> Lucas De Marchi <lucas.de.marchi@xxxxxxxxx> writes:
>> Hi!
>>
>> CC'ing Rusty and mailing lists
>
> Thanks.
>
>> Rusty and ohers: it looks like both CONFIG_CRC32 and
>> CONFIG_CRYPTO_CRC32 can be compiled as module, and they generate
>> modules with the same name, crc32. Could that be fixed?
>
> Gah. Looks like it's been that way since at least 2014, too.
>
> I think we could rename it to crypto_crc32, but I don't think it's the
> only one. Marco, I think depmod should probably FAIL if two modules
> have the same name, which would at least find such problems.
>
> (BTW is there a nice way to figure out if a config var is a tristate? These
> are only problematic if both CONFIG_ are tristate.)
>
> Here's a hacky attempt to look for problems:
>
> rusty@rusty-Lemur:~/devel/kernel/linux (master)$ KCONFIGS=`find * -name 'Kconfig*'`; for m in `find [b-z]* -name 'Makefile*'`; do sed -n 's,obj-\$(CONFIG.*+= \([a-z0-9_-]\+\.o\)$,'$m' \1,p' <$m | sort -u; done | sort -k 2 | uniq -D -f 1 | while read m obj; do fgrep -w $obj $m /dev/null; done | while read LINE; do conf=`echo $LINE | sed 's/.*\$(CONFIG_\([A-Z0-9_]*\).*/\1/'`; if grep -C2 "^config $conf\$" $KCONFIGS | fgrep -q tristate; then echo $LINE; fi; done
>
> Here are the results (mildly filtered by me):
>
[...]
>
> drivers/hwmon/Makefile:obj-$(CONFIG_SENSORS_VEXPRESS) += vexpress.o
> drivers/regulator/Makefile:obj-$(CONFIG_REGULATOR_VEXPRESS) += vexpress.o
>
Indeed causes issues if both are built as modules, only once succeeds.
I will post these 2 patches separately soon.
-->8