This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[commit] Do not relocate TLS minimal symbols
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: gdb-patches at sourceware dot org
- Date: Fri, 22 Aug 2008 00:28:51 +0200 (CEST)
- Subject: [commit] Do not relocate TLS minimal symbols
Hello,
accessing a thread-local variable in a shared file without debug information
did not work if that library was relocated at run-time.
This is because elf_symtab_read would apply the relocation offset to the
value of the TLS symbol -- this is bogus because this value is just the
offset in the thread-local data area.
Fixed by not applying the relocation offset in this case.
Tested on powerpc-linux and powerpc64-linux.
Applied to mainline.
Bye,
Ulrich
ChangeLog:
* elfread.c (elf_symtab_read): Do not relocate thread-local symbols.
diff -urNp gdb-orig/gdb/elfread.c gdb-head/gdb/elfread.c
--- gdb-orig/gdb/elfread.c 2007-10-21 14:40:08.916543193 +0200
+++ gdb-head/gdb/elfread.c 2007-10-21 14:40:17.124689552 +0200
@@ -312,8 +312,10 @@ elf_symtab_read (struct objfile *objfile
interested in will have a section. */
/* Bfd symbols are section relative. */
symaddr = sym->value + sym->section->vma;
- /* Relocate all non-absolute symbols by the section offset. */
- if (sym->section != &bfd_abs_section)
+ /* Relocate all non-absolute and non-TLS symbols by the
+ section offset. */
+ if (sym->section != &bfd_abs_section
+ && !(sym->section->flags & SEC_THREAD_LOCAL))
{
symaddr += offset;
}
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com