From: James Hogan <james.hogan@imgtec.com>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>,
Stephen Rothwell <sfr@canb.auug.org.au>,
Al Viro <viro@zeniv.linux.org.uk>, Michal Marek <mmarek@suse.cz>,
Andrew Morton <akpm@linux-foundation.org>,
Guenter Roeck <linux@roeck-us.net>,
Jean Delvare <khali@linux-fr.org>,
linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
Mike Frysinger <vapier@gentoo.org>,
uclinux-dist-devel@blackfin.uclinux.org,
linux-next@vger.kernel.org
Subject: Re: [RFC -next] linux/linkage.h: fix symbol prefix handling
Date: Wed, 13 Mar 2013 09:21:01 +0000 [thread overview]
Message-ID: <514044FD.2040502@imgtec.com> (raw)
In-Reply-To: <20130313063157.GB19681@merkur.ravnborg.org>
Hi Sam,
On 13/03/13 06:31, Sam Ravnborg wrote:
>> /* Some toolchains use a `_' prefix for all user symbols. */
>> -#ifdef CONFIG_SYMBOL_PREFIX
>> -#define MODULE_SYMBOL_PREFIX CONFIG_SYMBOL_PREFIX
>> +#ifdef CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX
>> +#define __VMLINUX_SYMBOL(x) _##x
>> +#define __VMLINUX_SYMBOL_STR(x) "_" #x
>> +#define VMLINUX_SYMBOL_PREFIX_STR "_"
>> #else
>> -#define MODULE_SYMBOL_PREFIX ""
>> +#define __VMLINUX_SYMBOL(x) x
>> +#define __VMLINUX_SYMBOL_STR(x) #x
>> +#define VMLINUX_SYMBOL_PREFIX_STR ""
>> #endif
>
> We know the prefix is an underscore. No benefits from defining
> VMLINUX_SYMBOL_PREFIX_STR.
scripts/modpost.c uses the actual prefix string though:
> if (memcmp(symname, MODULE_SYMBOL_PREFIX,
> strlen(MODULE_SYMBOL_PREFIX)) == 0) {
> mod->unres =
> alloc_symbol(symname +
> strlen(MODULE_SYMBOL_PREFIX),
> ELF_ST_BIND(sym->st_info) == STB_WEAK,
> mod->unres);
See also my "module: fix symbol versioning with symbol prefixes" patch
for an additional use in modpost.
Having a MODULE_SYMBOL_PREFIX/VMLINUX_SYMBOL_PREFIX_STR seems like the
simplest way to keep this code clean and readable without special cases.
Cheers
James
next prev parent reply other threads:[~2013-03-13 9:21 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-07 11:44 [RFC -next] linux/linkage.h: fix symbol prefix handling James Hogan
2013-03-08 0:03 ` Rusty Russell
2013-03-08 9:15 ` James Hogan
2013-03-11 6:35 ` Rusty Russell
2013-03-11 12:07 ` Stephen Rothwell
2013-03-12 4:48 ` Rusty Russell
2013-03-12 12:33 ` Stephen Rothwell
2013-03-13 0:00 ` Rusty Russell
2013-03-13 6:31 ` Sam Ravnborg
2013-03-13 9:21 ` James Hogan [this message]
2013-03-13 18:15 ` Sam Ravnborg
2013-03-14 4:00 ` Rusty Russell
2013-03-14 10:49 ` James Hogan
2013-03-15 4:37 ` Rusty Russell
2013-03-12 12:36 ` James Hogan
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=514044FD.2040502@imgtec.com \
--to=james.hogan@imgtec.com \
--cc=akpm@linux-foundation.org \
--cc=khali@linux-fr.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=mmarek@suse.cz \
--cc=rusty@rustcorp.com.au \
--cc=sam@ravnborg.org \
--cc=sfr@canb.auug.org.au \
--cc=uclinux-dist-devel@blackfin.uclinux.org \
--cc=vapier@gentoo.org \
--cc=viro@zeniv.linux.org.uk \
/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).