* [PATCH] Fix ppc32 dl-machine.h
@ 2003-03-25 13:52 Jakub Jelinek
2003-03-25 17:30 ` Jakub Jelinek
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jakub Jelinek @ 2003-03-25 13:52 UTC (permalink / raw)
To: Roland McGrath; +Cc: Glibc hackers
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Fix ppc32 dl-machine.h
2003-03-25 13:52 [PATCH] Fix ppc32 dl-machine.h Jakub Jelinek
@ 2003-03-25 17:30 ` Jakub Jelinek
2003-03-26 12:12 ` Roland McGrath
2003-03-28 2:47 ` Roland McGrath
2 siblings, 0 replies; 4+ messages in thread
From: Jakub Jelinek @ 2003-03-25 17:30 UTC (permalink / raw)
To: Roland McGrath; +Cc: Glibc hackers
On Tue, Mar 25, 2003 at 11:40:55AM +0100, Jakub Jelinek wrote:
> The patch is untested, but IMHO should work. Will test later today.
Tested, works just fine and fixes all binutils test failures.
> 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.
Jakub
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Fix ppc32 dl-machine.h
2003-03-25 13:52 [PATCH] Fix ppc32 dl-machine.h Jakub Jelinek
2003-03-25 17:30 ` Jakub Jelinek
@ 2003-03-26 12:12 ` Roland McGrath
2003-03-28 2:47 ` Roland McGrath
2 siblings, 0 replies; 4+ messages in thread
From: Roland McGrath @ 2003-03-26 12:12 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Glibc hackers
> 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.
I can't find anything in the ABI spec to suggest this should be done. Is
it considered part of the spec, or a binutils bug that we are just stuck with?
I had the impression that this was a sparc-specific bug, not the specified
behavior. Do other Rela platforms use this meaning?
Thanks,
Roland
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Fix ppc32 dl-machine.h
2003-03-25 13:52 [PATCH] Fix ppc32 dl-machine.h Jakub Jelinek
2003-03-25 17:30 ` Jakub Jelinek
2003-03-26 12:12 ` Roland McGrath
@ 2003-03-28 2:47 ` Roland McGrath
2 siblings, 0 replies; 4+ messages in thread
From: Roland McGrath @ 2003-03-28 2:47 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Glibc hackers
I put it in. ld should definitely be fixed, but we must support the
existing binaries.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-03-28 0:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-25 13:52 [PATCH] Fix ppc32 dl-machine.h Jakub Jelinek
2003-03-25 17:30 ` Jakub Jelinek
2003-03-26 12:12 ` Roland McGrath
2003-03-28 2:47 ` Roland McGrath
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).