[PATCH] PPC64 Linuxthreads tls.h M2

Paul Mackerras paulus@samba.org
Fri Feb 28 02:18:00 GMT 2003


Roland McGrath writes:

> I am not having any luck testing on ppc64 right now even without TLS, so I
> don't know if my tls.h really works right.  Please test it and send any
> necessary changes relative to that.

This code in sysdeps/powerpc/powerpc64/dl-machine.h looks wrong to me
(and to Alan Modra), especially the !USE_TLS branch of the ifdef:

#if defined USE_TLS && !defined RTLD_BOOTSTRAP
  sym_map = RESOLVE_MAP (&sym, version, r_type);
  raw_value = value = reloc->r_addend;
  if (sym_map)
    if (sym)
    {
      raw_value += sym->st_value;
      value = raw_value + sym_map->l_addr;
    }
#else
  sym_map = RESOLVE_MAP (&sym, version, r_type);
  if (sym_map)
  {
    if (sym)
    {
      raw_value = sym->st_value + sym_map->l_addr;
    }
    value = raw_value + reloc->r_addend;
  }
#endif

In the sym != NULL && sym_map != NULL case, I think we want:

	raw_value = sym->st_value + reloc->r_addend;
	value = raw_value + sym_map->l_addr;

but instead we get:

	raw_value = sym->st_value + sym_map->l_addr;
	value = raw_value + reloc->r_addend;

I don't know if that would cause the problems you see though.

The other thing is that I can't see how we could get sym_map != NULL
but sym == NULL, so I don't see why the if (sym) statements are
needed.

Paul.



More information about the Libc-alpha mailing list