From: "Jan Beulich" <jbeulich@novell.com>
To: <paulus@samba.org>
Cc: linuxppc-dev@ozlabs.org, linux-kernel@vger.kernel.org
Subject: [PATCH, ppc64] improve dedotify()
Date: Fri, 11 Jan 2008 09:13:50 +0000 [thread overview]
Message-ID: <4787415E.76E4.0078.0@novell.com> (raw)
This completely untested patch is intended to be a suggestion only:
Code inspection for an entirely different purpose made me stumble
across this, and I think that modifying the string table of an ELF
object is a bad idea, since there's nothing disallowing a linker to
merge strings inside the table, which would result in this code
possibly, but unintentionally screwing up other symbol names.
Besides that, the presented alternative is both smaller and faster.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
---
arch/powerpc/kernel/module_64.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
--- linux-2.6.24-rc7/arch/powerpc/kernel/module_64.c 2007-02-04 =
19:44:54.000000000 +0100
+++ 2.6.24-rc7-ppc64-dedotify/arch/powerpc/kernel/module_64.c 2008-01-08 =
13:32:33.000000000 +0100
@@ -154,16 +154,14 @@ static void dedotify_versions(struct mod
}
=20
/* Undefined symbols which refer to .funcname, hack to funcname */
-static void dedotify(Elf64_Sym *syms, unsigned int numsyms, char *strtab)
+static void dedotify(Elf64_Sym *syms, unsigned int numsyms, const char =
*strtab)
{
unsigned int i;
=20
for (i =3D 1; i < numsyms; i++) {
- if (syms[i].st_shndx =3D=3D SHN_UNDEF) {
- char *name =3D strtab + syms[i].st_name;
- if (name[0] =3D=3D '.')
- memmove(name, name+1, strlen(name));
- }
+ if (syms[i].st_shndx =3D=3D SHN_UNDEF
+ && strtab[syms[i].st_name] =3D=3D '.')
+ syms[i].st_name++;
}
}
=20
reply other threads:[~2008-01-11 9:33 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=4787415E.76E4.0078.0@novell.com \
--to=jbeulich@novell.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=paulus@samba.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