linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Will Deacon <will@kernel.org>
To: Jessica Yu <jeyu@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Matthias Maennich <maennich@google.com>,
	graf@amazon.com, Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Martijn Coenen <maco@android.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [jeyu:modules-next 3/11] arc4.c:(___ksymtab+arc4_setkey+0x8): undefined reference to `no symbol'
Date: Wed, 11 Sep 2019 11:36:41 +0100	[thread overview]
Message-ID: <20190911103640.7dwgjmdhv4my2mlx@willie-the-truck> (raw)
In-Reply-To: <20190911103217.GA27338@linux-8ccs.fritz.box>

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

      reply	other threads:[~2019-09-11 10:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190911103640.7dwgjmdhv4my2mlx@willie-the-truck \
    --to=will@kernel.org \
    --cc=ard.biesheuvel@linaro.org \
    --cc=arnd@arndb.de \
    --cc=catalin.marinas@arm.com \
    --cc=graf@amazon.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jeyu@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=maco@android.com \
    --cc=maennich@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).