linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* powerpc64-linux-ld: drivers/i2c/busses/i2c-pasemi-core.o:undefined reference to `__this_module'
@ 2022-02-10  2:43 kernel test robot
  0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2022-02-10  2:43 UTC (permalink / raw)
  To: Sven Peter; +Cc: kbuild-all, linux-kernel, Wolfram Sang, Arnd Bergmann

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   f4bc5bbb5fef3cf421ba3485d6d383c27ec473ed
commit: d88ae2932df0e670610cb741fec442ad12466c03 i2c: pasemi: Add Apple platform driver
date:   4 months ago
config: powerpc64-randconfig-r012-20220210 (https://download.01.org/0day-ci/archive/20220210/202202101008.EvUHrprq-lkp@intel.com/config)
compiler: powerpc64-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d88ae2932df0e670610cb741fec442ad12466c03
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout d88ae2932df0e670610cb741fec442ad12466c03
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=powerpc SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All error/warnings (new ones prefixed by >>):

>> powerpc64-linux-ld: warning: orphan section `.stubs' from `drivers/i2c/busses/i2c-pasemi-core.o' being placed in section `.stubs'
>> powerpc64-linux-ld: warning: orphan section `.ftrace.tramp' from `drivers/i2c/busses/i2c-pasemi-core.o' being placed in section `.ftrace.tramp'
>> powerpc64-linux-ld: drivers/i2c/busses/i2c-pasemi-core.o:(.toc+0x0): undefined reference to `__this_module'

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: powerpc64-linux-ld: drivers/i2c/busses/i2c-pasemi-core.o:undefined reference to `__this_module'
  2021-12-06 19:47   ` Arnd Bergmann
@ 2021-12-06 20:38     ` Sven Peter
  0 siblings, 0 replies; 5+ messages in thread
From: Sven Peter @ 2021-12-06 20:38 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: kernel test robot, Linux I2C, kbuild-all,
	Linux Kernel Mailing List, Wolfram Sang, Hector Martin,
	Alyssa Rosenzweig



On Mon, Dec 6, 2021, at 20:47, Arnd Bergmann wrote:
> On Mon, Dec 6, 2021 at 6:02 PM Sven Peter <sven@svenpeter.dev> wrote:
>> On Mon, Dec 6, 2021, at 11:10, kernel test robot wrote:
>
>> > If you fix the issue, kindly add following tag as appropriate
>> > Reported-by: kernel test robot <lkp@intel.com>
>> >
>> > All error/warnings (new ones prefixed by >>):
>> >
>> >>> powerpc64-linux-ld: warning: orphan section `.stubs' from `drivers/i2c/busses/i2c-pasemi-core.o' being placed in section `.stubs'
>> >>> powerpc64-linux-ld: drivers/i2c/busses/i2c-pasemi-core.o:(.toc+0x0): undefined reference to `__this_module'
>>
>> This seems to be triggered by compiling one of {pci,platform} as a module and the
>> other one as built-in. That setup can only happen with COMPILE_TEST since -pci
>> is otherwise only compiled for powerpc and -platform for arm64.
>>
>> -core.c is only built once with THIS_MODULE expanding to __this_module. That will
>> fail when linking the built-in driver where THIS_MODULE should've been NULL instead.
>>
>> The most simple fix (that also has no chance of breaking anything) is probably to
>> just move
>>
>>   smbus->adapter.owner = THIS_MODULE;
>>
>> from core to both apple.c and pci.c. I'll prepare a patch later this week.
>
> I'd prefer fixing this in a better way, linking an object file into
> both vmlinux and a loadable
> module is not supported at all. 

Make sense, I didn't know that.

> Other options are:
>
> - #include the common .c file from the individual drivers (not great)
> - use Kconfig logic to prevent the broken configuration
> - use Makefile tricks to make both drivers built-in when this happens
> - make the common part a separate loadable module, exporting all the
>   global symbols.
>
> Out of these, I would prefer the last option.

Sure, I'll see when I can spare some time to do that since testing that
is going to be a bit more annoying with my current setup.

Fwiw, I2C_OCTEON and I2C_THUNDERX might have the same issue as well
with i2c-octeon-core.o. It just won't result in the same compile error
because i2c-octeon-core.c doesn't use THIS_MODULE.
It's also nothing that is likely to ever happen since those two drivers
are also never used on the same arch and it should only be possible to
create a broken configuration with COMPILE_TEST as well.



Sven

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: powerpc64-linux-ld: drivers/i2c/busses/i2c-pasemi-core.o:undefined reference to `__this_module'
  2021-12-06 17:02 ` Sven Peter
@ 2021-12-06 19:47   ` Arnd Bergmann
  2021-12-06 20:38     ` Sven Peter
  0 siblings, 1 reply; 5+ messages in thread
From: Arnd Bergmann @ 2021-12-06 19:47 UTC (permalink / raw)
  To: Sven Peter
  Cc: kernel test robot, Linux I2C, kbuild-all,
	Linux Kernel Mailing List, Wolfram Sang, Arnd Bergmann,
	Hector Martin, Alyssa Rosenzweig

On Mon, Dec 6, 2021 at 6:02 PM Sven Peter <sven@svenpeter.dev> wrote:
> On Mon, Dec 6, 2021, at 11:10, kernel test robot wrote:

> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <lkp@intel.com>
> >
> > All error/warnings (new ones prefixed by >>):
> >
> >>> powerpc64-linux-ld: warning: orphan section `.stubs' from `drivers/i2c/busses/i2c-pasemi-core.o' being placed in section `.stubs'
> >>> powerpc64-linux-ld: drivers/i2c/busses/i2c-pasemi-core.o:(.toc+0x0): undefined reference to `__this_module'
>
> This seems to be triggered by compiling one of {pci,platform} as a module and the
> other one as built-in. That setup can only happen with COMPILE_TEST since -pci
> is otherwise only compiled for powerpc and -platform for arm64.
>
> -core.c is only built once with THIS_MODULE expanding to __this_module. That will
> fail when linking the built-in driver where THIS_MODULE should've been NULL instead.
>
> The most simple fix (that also has no chance of breaking anything) is probably to
> just move
>
>   smbus->adapter.owner = THIS_MODULE;
>
> from core to both apple.c and pci.c. I'll prepare a patch later this week.

I'd prefer fixing this in a better way, linking an object file into
both vmlinux and a loadable
module is not supported at all. Other options are:

- #include the common .c file from the individual drivers (not great)
- use Kconfig logic to prevent the broken configuration
- use Makefile tricks to make both drivers built-in when this happens
- make the common part a separate loadable module, exporting all the
  global symbols.

Out of these, I would prefer the last option.

       Arnd

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: powerpc64-linux-ld: drivers/i2c/busses/i2c-pasemi-core.o:undefined reference to `__this_module'
  2021-12-06 10:10 kernel test robot
@ 2021-12-06 17:02 ` Sven Peter
  2021-12-06 19:47   ` Arnd Bergmann
  0 siblings, 1 reply; 5+ messages in thread
From: Sven Peter @ 2021-12-06 17:02 UTC (permalink / raw)
  To: kernel test robot, linux-i2c
  Cc: kbuild-all, linux-kernel, Wolfram Sang, Arnd Bergmann,
	Hector Martin, Alyssa Rosenzweig

On Mon, Dec 6, 2021, at 11:10, kernel test robot wrote:
> tree:   
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
> master
> head:   0fcfb00b28c0b7884635dacf38e46d60bf3d4eb1
> commit: d88ae2932df0e670610cb741fec442ad12466c03 i2c: pasemi: Add Apple 
> platform driver
> date:   8 weeks ago
> config: powerpc64-randconfig-r023-20211206 
> (https://download.01.org/0day-ci/archive/20211206/202112061809.XT99aPrf-lkp@intel.com/config)
> compiler: powerpc64-linux-gcc (GCC) 11.2.0
> reproduce (this is a W=1 build):
>         wget 
> https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross 
> -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # 
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d88ae2932df0e670610cb741fec442ad12466c03
>         git remote add linus 
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
>         git fetch --no-tags linus master
>         git checkout d88ae2932df0e670610cb741fec442ad12466c03
>         # save the config file to linux build tree
>         mkdir build_dir
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross 
> O=build_dir ARCH=powerpc SHELL=/bin/bash
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
>
> All error/warnings (new ones prefixed by >>):
>
>>> powerpc64-linux-ld: warning: orphan section `.stubs' from `drivers/i2c/busses/i2c-pasemi-core.o' being placed in section `.stubs'
>>> powerpc64-linux-ld: drivers/i2c/busses/i2c-pasemi-core.o:(.toc+0x0): undefined reference to `__this_module'

This seems to be triggered by compiling one of {pci,platform} as a module and the
other one as built-in. That setup can only happen with COMPILE_TEST since -pci
is otherwise only compiled for powerpc and -platform for arm64.

-core.c is only built once with THIS_MODULE expanding to __this_module. That will
fail when linking the built-in driver where THIS_MODULE should've been NULL instead.

The most simple fix (that also has no chance of breaking anything) is probably to
just move

  smbus->adapter.owner = THIS_MODULE;

from core to both apple.c and pci.c. I'll prepare a patch later this week.

Sven

^ permalink raw reply	[flat|nested] 5+ messages in thread

* powerpc64-linux-ld: drivers/i2c/busses/i2c-pasemi-core.o:undefined reference to `__this_module'
@ 2021-12-06 10:10 kernel test robot
  2021-12-06 17:02 ` Sven Peter
  0 siblings, 1 reply; 5+ messages in thread
From: kernel test robot @ 2021-12-06 10:10 UTC (permalink / raw)
  To: Sven Peter; +Cc: kbuild-all, linux-kernel, Wolfram Sang, Arnd Bergmann

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   0fcfb00b28c0b7884635dacf38e46d60bf3d4eb1
commit: d88ae2932df0e670610cb741fec442ad12466c03 i2c: pasemi: Add Apple platform driver
date:   8 weeks ago
config: powerpc64-randconfig-r023-20211206 (https://download.01.org/0day-ci/archive/20211206/202112061809.XT99aPrf-lkp@intel.com/config)
compiler: powerpc64-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d88ae2932df0e670610cb741fec442ad12466c03
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout d88ae2932df0e670610cb741fec442ad12466c03
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=powerpc SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All error/warnings (new ones prefixed by >>):

>> powerpc64-linux-ld: warning: orphan section `.stubs' from `drivers/i2c/busses/i2c-pasemi-core.o' being placed in section `.stubs'
>> powerpc64-linux-ld: drivers/i2c/busses/i2c-pasemi-core.o:(.toc+0x0): undefined reference to `__this_module'

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-02-10  2:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-10  2:43 powerpc64-linux-ld: drivers/i2c/busses/i2c-pasemi-core.o:undefined reference to `__this_module' kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2021-12-06 10:10 kernel test robot
2021-12-06 17:02 ` Sven Peter
2021-12-06 19:47   ` Arnd Bergmann
2021-12-06 20:38     ` Sven Peter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).