This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] [Cell/B.E.] Fix wrong relocation for TLS variable offset


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ef36892e85baa498501cca8c558b1fe958e51858

commit ef36892e85baa498501cca8c558b1fe958e51858
Author: Ulrich Weigand <ulrich.weigand@de.ibm.com>
Date:   Thu Aug 27 19:31:04 2015 +0200

    [Cell/B.E.] Fix wrong relocation for TLS variable offset
    
    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.
    
    ChangeLog:
    
    	* ppc-linux-tdep.c (ppc_linux_spe_context_lookup): Do not
    	attempt to relocate a TLS variable offset.

Diff:
---
 gdb/ChangeLog        | 5 +++++
 gdb/ppc-linux-tdep.c | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 46fb2d1..399cdaa 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
 2015-08-08  Ulrich Weigand  <uweigand@de.ibm.com>
 
+	* ppc-linux-tdep.c (ppc_linux_spe_context_lookup): Do not
+	attempt to relocate a TLS variable offset.
+
+2015-08-08  Ulrich Weigand  <uweigand@de.ibm.com>
+
 	* spu-multiarch.c (parse_spufs_run): Bail out if inferior is not
 	registered yet.  Set inferior_ptid while calling target_read_memory.
 
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index 69c791e..56d9994 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -1140,7 +1140,7 @@ ppc_linux_spe_context_lookup (struct objfile *objfile)
     {
       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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]