From: Jakub Jelinek <jakub@redhat.com>
To: Roland McGrath <roland@redhat.com>
Cc: Glibc hackers <libc-hacker@sources.redhat.com>
Subject: [PATCH] Fix ppc32 dl-machine.h
Date: Tue, 25 Mar 2003 13:52:00 -0000 [thread overview]
Message-ID: <20030325114055.C1717@sunsite.ms.mff.cuni.cz> (raw)
Hi!
It seems the 2003-03-02 cleanups broke relocs against local symbols on ppc32
(e.g. a bunch of binutils tests now fail).
On ppc32 (and sparc32) for those relocs r_addend already includes st_value,
so ATM glibc adds them in twice.
[ 6] .rodata PROGBITS 00000918 000918 000010 00 A 0 0 4
[ 7] .data PROGBITS 00010928 000928 000008 00 WA 0 0 4
00000876 00000706 R_PPC_ADDR16_HA 00010928 .data + 10928
00000882 00000704 R_PPC_ADDR16_LO 00010928 .data + 10928
000008a2 00000706 R_PPC_ADDR16_HA 00010928 .data + 1092c
000008ae 00000704 R_PPC_ADDR16_LO 00010928 .data + 1092c
0000089e 00000606 R_PPC_ADDR16_HA 00000918 .rodata + 918
000008a6 00000604 R_PPC_ADDR16_LO 00000918 .rodata + 918
000008aa 00000604 R_PPC_ADDR16_LO 00000918 .rodata + 918
The patch is untested, but IMHO should work. Will test later today.
2003-03-25 Jakub Jelinek <jakub@redhat.com>
* sysdeps/powerpc/powerpc32/dl-machine.h (elf_machine_rela): Restore
special handling of relocations against local symbols.
--- libc/sysdeps/powerpc/powerpc32/dl-machine.h.jj 2003-03-06 12:26:23.000000000 -0500
+++ libc/sysdeps/powerpc/powerpc32/dl-machine.h 2003-03-25 05:36:57.000000000 -0500
@@ -361,6 +361,9 @@ elf_machine_rela (struct link_map *map,
const Elf32_Sym *const refsym = sym;
Elf32_Addr value;
const int r_type = ELF32_R_TYPE (reloc->r_info);
+#if defined USE_TLS && !defined RTLD_BOOTSTRAP
+ struct link_map *sym_map;
+#endif
if (r_type == R_PPC_RELATIVE)
{
@@ -371,16 +374,24 @@ elf_machine_rela (struct link_map *map,
if (__builtin_expect (r_type == R_PPC_NONE, 0))
return;
+ /* binutils on ppc32 includes st_value in r_addend for relocations
+ against local symbols. */
+ if (__builtin_expect (ELF32_ST_BIND (sym->st_info) == STB_LOCAL, 0)
+ && sym->st_shndx != SHN_UNDEF)
+ value = map->l_addr;
+ else
+ {
#if defined USE_TLS && !defined RTLD_BOOTSTRAP
- struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type);
- value = sym == NULL ? 0 : sym_map->l_addr + sym->st_value;
+ sym_map = RESOLVE_MAP (&sym, version, r_type);
+ value = sym == NULL ? 0 : sym_map->l_addr + sym->st_value;
#else
- value = RESOLVE (&sym, version, r_type);
+ value = RESOLVE (&sym, version, r_type);
# ifndef RTLD_BOOTSTRAP
- if (sym != NULL)
+ if (sym != NULL)
# endif
- value += sym->st_value;
+ value += sym->st_value;
#endif
+ }
value += reloc->r_addend;
/* A small amount of code is duplicated here for speed. In libc,
Jakub
next reply other threads:[~2003-03-25 10:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-03-25 13:52 Jakub Jelinek [this message]
2003-03-25 17:30 ` Jakub Jelinek
2003-03-26 12:12 ` Roland McGrath
2003-03-28 2:47 ` Roland McGrath
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=20030325114055.C1717@sunsite.ms.mff.cuni.cz \
--to=jakub@redhat.com \
--cc=libc-hacker@sources.redhat.com \
--cc=roland@redhat.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 read-only IMAP folder(s) and NNTP newsgroup(s).