From: Tejun Heo <tj@kernel.org>
To: Jan Engelhardt <jengelh@inai.de>
Cc: cl@linux-foundation.org, linux-mm@kvack.org,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: percpu section failure with Gold linker
Date: Fri, 23 Nov 2012 13:25:59 -0800 [thread overview]
Message-ID: <20121123212559.GW15971@htj.dyndns.org> (raw)
In-Reply-To: <alpine.LNX.2.01.1211232136380.11359@nerf07.vanv.qr>
Hello, Jan.
On Fri, Nov 23, 2012 at 09:44:02PM +0100, Jan Engelhardt wrote:
> when compiling a kernel with the gold linker (3.7.0-rc6 26d29d06ea0204,
> gcc-4.7 and binutils-2.23 in my case), certain pcpu symbols are
> seemingly errneously copied over from .o files to .ko files, leading to
> a hard warning during depmod:
>
> gold$ make -j8 LD=gold HOSTLD=gold
> gold$ make modules_install INSTALL_MOD_PATH=/tmp/foo
> [...]
> WARNING: /tmp/foo/lib/modules/3.7.0-rc6-jng6-default+
> /kernel/net/rds/rds_tcp.ko needs unknown symbol
> __pcpu_scope_rds_tcp_stats
Yeah, this is from the nasty tricks percpu plays to get percpu decls
working on s390 and alpha. Take a look at
DECLARE/DEFINE_PER_CPU_SECTION() definitions in
include/linux/percpu-defs.h for details.
> This happens with many modules using percpu; looking at things with nm
> reveals:
>
> gold/net/ipv6$ nm ipv6.o | grep __pcpu_
> 0000000000000000 D __pcpu_unique_ipv6_cookie_scratch
> gold/net/ipv6$ nm ipv6.ko | grep __pcpu_
> U __pcpu_unique_ipv6_cookie_scratch
>
> On the other hand, in a linux tree built with the original ld (ld.bfd),
> things look like:
>
> bfd$ make -j8
> [...]
> bfd/net/ipv6$ nm ipv6.o | grep pcpu
> 0000000000000000 D __pcpu_unique_ipv6_cookie_scratch
> bfd/net/ipv6$ nm ipv6.ko | grep pcpu
> (no result)
So, those __pcpu_unique and __pcpu_scope variables are only used so
that multiple copy of them collide with each other and trigger compile
failure (as the actual percpu variable needs to be declared __weak).
They're all put into .discard section, so should go away once it
passes through the linker. gold left reference to that symbol while
discarding the definition. Hmmm... different interpretation of
.discard? Still weird tho. There's nothing dereferencing that
symbol.
Thanks.
--
tejun
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
prev parent reply other threads:[~2012-11-23 21:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-23 20:44 percpu section failure with Gold linker Jan Engelhardt
2012-11-23 21:25 ` Tejun Heo [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=20121123212559.GW15971@htj.dyndns.org \
--to=tj@kernel.org \
--cc=cl@linux-foundation.org \
--cc=jengelh@inai.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/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).