Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [jeyu:modules-next 3/11] arc4.c:(___ksymtab+arc4_setkey+0x8): undefined reference to `no symbol'
       [not found] ` <20190911052124.GA247847@google.com>
@ 2019-09-11 10:32   ` Jessica Yu
  2019-09-11 10:36     ` Will Deacon
  0 siblings, 1 reply; 2+ messages in thread
From: Jessica Yu @ 2019-09-11 10:32 UTC (permalink / raw)
  To: Matthias Maennich
  Cc: Arnd Bergmann, Ard Biesheuvel, Greg Kroah-Hartman, Will Deacon,
	Catalin Marinas, Martijn Coenen, linux-arm-kernel

+++ Matthias Maennich [11/09/19 06:21 +0100]:
>On Wed, Sep 11, 2019 at 03:11:53AM +0800, kbuild test robot wrote:
>>tree:   https://kernel.googlesource.com/pub/scm/linux/kernel/git/jeyu/linux.git modules-next
>>head:   32bca2df7da27be34371a37f9bb5e2b85fdd92bd
>>commit: 8651ec01daedad26290f76beeb4736f9d2da4b87 [3/11] module: add support for symbol namespaces.
>>config: arm64-defconfig (attached as .config)
>>compiler: aarch64-linux-gcc (GCC) 7.4.0
>>reproduce:
>>       wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>>       chmod +x ~/bin/make.cross
>>       git checkout 8651ec01daedad26290f76beeb4736f9d2da4b87
>>       # save the attached .config to linux build tree
>>       GCC_VERSION=7.4.0 make.cross ARCH=arm64
>>
>>If you fix the issue, kindly add following tag
>>Reported-by: kbuild test robot <lkp@intel.com>
>>
>>All errors (new ones prefixed by >>):
>>
>>  lib/crypto/arc4.o: In function `__ksymtab_arc4_setkey':
>>>>arc4.c:(___ksymtab+arc4_setkey+0x8): undefined reference to `no symbol'
>>  lib/crypto/arc4.o: In function `__ksymtab_arc4_crypt':
>>>>arc4.c:(___ksymtab+arc4_crypt+0x8): undefined reference to `no symbol'
>
>Hmm, this is caused by the relative relocation of the 'namespace_offset'
>struct member to NULL in case there is no namespace defined:
>
>#define __KSYMTAB_ENTRY(sym, sec)					\
>	__ADDRESSABLE(sym)						\
>	asm("	.section \"___ksymtab" sec "+" #sym "\", \"a\"	\n"	\
>	    "	.balign 4					\n"	\
>	    "__ksymtab_" #sym ":				\n"	\
>	    "	.long	" #sym "- .				\n"	\
>	    "	.long	__kstrtab_" #sym "- .			\n"	\
>	    "	.long	0 - .					\n"	\
>	    	       ^^^^^^^
>	    "	.previous					\n")
>
>struct kernel_symbol {
>	int value_offset;
>	int name_offset;
>	int namespace_offset;
>};
>
>That is apparently not an issue on x86, but on arm. Not sure how to
>express a relative relocation to NULL then.
>
>I will try to solve this somehow, just wanted to check if somebody knows the
>trick here.

(Adding more CC's..)

Do we have to have a place-relative relocation there? If we can't find
a workaround, having just .long 0 for a null namespace seemed to fix the
build issues on arm64 for me at least..



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [jeyu:modules-next 3/11] arc4.c:(___ksymtab+arc4_setkey+0x8): undefined reference to `no symbol'
  2019-09-11 10:32   ` [jeyu:modules-next 3/11] arc4.c:(___ksymtab+arc4_setkey+0x8): undefined reference to `no symbol' Jessica Yu
@ 2019-09-11 10:36     ` Will Deacon
  0 siblings, 0 replies; 2+ messages in thread
From: Will Deacon @ 2019-09-11 10:36 UTC (permalink / raw)
  To: Jessica Yu
  Cc: Arnd Bergmann, Ard Biesheuvel, Catalin Marinas, Matthias Maennich,
	graf, Greg Kroah-Hartman, Martijn Coenen, linux-arm-kernel

Hi all,

On Wed, Sep 11, 2019 at 12:32:18PM +0200, Jessica Yu wrote:
> +++ Matthias Maennich [11/09/19 06:21 +0100]:
> > On Wed, Sep 11, 2019 at 03:11:53AM +0800, kbuild test robot wrote:
> > > tree:   https://kernel.googlesource.com/pub/scm/linux/kernel/git/jeyu/linux.git modules-next
> > > head:   32bca2df7da27be34371a37f9bb5e2b85fdd92bd
> > > commit: 8651ec01daedad26290f76beeb4736f9d2da4b87 [3/11] module: add support for symbol namespaces.
> > > config: arm64-defconfig (attached as .config)
> > > compiler: aarch64-linux-gcc (GCC) 7.4.0
> > > reproduce:
> > >       wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> > >       chmod +x ~/bin/make.cross
> > >       git checkout 8651ec01daedad26290f76beeb4736f9d2da4b87
> > >       # save the attached .config to linux build tree
> > >       GCC_VERSION=7.4.0 make.cross ARCH=arm64
> > > 
> > > If you fix the issue, kindly add following tag
> > > Reported-by: kbuild test robot <lkp@intel.com>
> > > 
> > > All errors (new ones prefixed by >>):
> > > 
> > >  lib/crypto/arc4.o: In function `__ksymtab_arc4_setkey':
> > > > > arc4.c:(___ksymtab+arc4_setkey+0x8): undefined reference to `no symbol'
> > >  lib/crypto/arc4.o: In function `__ksymtab_arc4_crypt':
> > > > > arc4.c:(___ksymtab+arc4_crypt+0x8): undefined reference to `no symbol'
> > 
> > Hmm, this is caused by the relative relocation of the 'namespace_offset'
> > struct member to NULL in case there is no namespace defined:
> > 
> > #define __KSYMTAB_ENTRY(sym, sec)					\
> > 	__ADDRESSABLE(sym)						\
> > 	asm("	.section \"___ksymtab" sec "+" #sym "\", \"a\"	\n"	\
> > 	    "	.balign 4					\n"	\
> > 	    "__ksymtab_" #sym ":				\n"	\
> > 	    "	.long	" #sym "- .				\n"	\
> > 	    "	.long	__kstrtab_" #sym "- .			\n"	\
> > 	    "	.long	0 - .					\n"	\
> > 	    	       ^^^^^^^
> > 	    "	.previous					\n")
> > 
> > struct kernel_symbol {
> > 	int value_offset;
> > 	int name_offset;
> > 	int namespace_offset;
> > };
> > 
> > That is apparently not an issue on x86, but on arm. Not sure how to
> > express a relative relocation to NULL then.
> > 
> > I will try to solve this somehow, just wanted to check if somebody knows the
> > trick here.
> 
> (Adding more CC's..)
> 
> Do we have to have a place-relative relocation there? If we can't find
> a workaround, having just .long 0 for a null namespace seemed to fix the
> build issues on arm64 for me at least..

Ard, Alex and I have hacked the following diff which seems to do the trick.
I'll post as a proper patch later today.

Will

--->8

diff --git a/include/asm-generic/export.h b/include/asm-generic/export.h
index e2b5d0f569d3..d0912c7ac2fc 100644
--- a/include/asm-generic/export.h
+++ b/include/asm-generic/export.h
@@ -17,7 +17,7 @@
 
 .macro __put, val, name
 #ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
-	.long	\val - ., \name - ., 0 - .
+	.long	\val - ., \name - ., 0
 #elif defined(CONFIG_64BIT)
 	.quad	\val, \name, 0
 #else
diff --git a/include/linux/export.h b/include/linux/export.h
index 2c5468d8ea9a..ef5d015d754a 100644
--- a/include/linux/export.h
+++ b/include/linux/export.h
@@ -68,7 +68,7 @@ extern struct module __this_module;
 	    "__ksymtab_" #sym ":				\n"	\
 	    "	.long	" #sym "- .				\n"	\
 	    "	.long	__kstrtab_" #sym "- .			\n"	\
-	    "	.long	0 - .					\n"	\
+	    "	.long	0					\n"	\
 	    "	.previous					\n")
 
 struct kernel_symbol {
diff --git a/kernel/module.c b/kernel/module.c
index f76efcf2043e..7ab244c4e1ba 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -547,6 +547,8 @@ static const char *kernel_symbol_name(const struct kernel_symbol *sym)
 static const char *kernel_symbol_namespace(const struct kernel_symbol *sym)
 {
 #ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
+	if (!sym->namespace_offset)
+		return NULL;
 	return offset_to_ptr(&sym->namespace_offset);
 #else
 	return sym->namespace;

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2019-09-11 10:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <201909110352.uPcQrbuc%lkp@intel.com>
     [not found] ` <20190911052124.GA247847@google.com>
2019-09-11 10:32   ` [jeyu:modules-next 3/11] arc4.c:(___ksymtab+arc4_setkey+0x8): undefined reference to `no symbol' Jessica Yu
2019-09-11 10:36     ` Will Deacon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox