This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.
Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
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 at redhat dot 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
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |