This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[pushed][Cell/B.E.] Fix wrong relocation for TLS variable offset
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: gdb-patches at sourceware dot org
- Date: Thu, 27 Aug 2015 19:42:18 +0200 (CEST)
- Subject: [pushed][Cell/B.E.] Fix wrong relocation for TLS variable offset
- Authentication-results: sourceware.org; auth=none
Hello,
when debugging Cell/B.E. code, the cross-architecture frame unwinding
works by accessing data structures refered to by a thread-local variable
in the inferior. While accessing this variable via minimal symbol,
code would use BMSYMBOL_VALUE_ADDRESS to determine the offset of the
variable in the thread-local storage block.
This is incorrect, since it adds any relocation offset of the shared
library defining the TLS variable. That offset would be OK when
accessing the initial copy present in the .tbss section, but it must
not be applied to the offset of the variable in the TLS block at
runtime. Depending on whether or not the libspe2.so library was
prelinked, access to the variable would fail due to the incorrectly
relocated offset.
Tested on Cell/B.E., pushed to mainline.
Bye,
Ulrich
ChangeLog:
* ppc-linux-tdep.c (ppc_linux_spe_context_lookup): Do not
attempt to relocate a TLS variable offset.
Index: binutils-gdb/gdb/ppc-linux-tdep.c
===================================================================
--- binutils-gdb.orig/gdb/ppc-linux-tdep.c
+++ binutils-gdb/gdb/ppc-linux-tdep.c
@@ -1140,7 +1140,7 @@ ppc_linux_spe_context_lookup (struct obj
{
spe_context_objfile = objfile;
spe_context_lm_addr = svr4_fetch_objfile_link_map (objfile);
- spe_context_offset = BMSYMBOL_VALUE_ADDRESS (sym);
+ spe_context_offset = MSYMBOL_VALUE_RAW_ADDRESS (sym.minsym);
spe_context_cache_ptid = minus_one_ptid;
spe_context_cache_address = 0;
return;
--
Dr. Ulrich Weigand
GNU/Linux compilers and toolchain
Ulrich.Weigand@de.ibm.com