Patchwork Fix for SIGBUS error on MIPS64 with N64 ABI

login
register
mail settings
Submitter Waldemar Brodkorb
Date Nov. 27, 2013, 8:55 a.m.
Message ID <20131127085550.GA18015@waldemar-brodkorb.de>
Download mbox | patch
Permalink /patch/294520/
State Accepted, archived
Headers show

Comments

Waldemar Brodkorb - Nov. 27, 2013, 8:55 a.m.
When accessing errno, a per thread variable, from _stdio_init
a SIGBUS error happens. This change fixes the wrong relocation
and debug output.

Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
---
 ldso/ldso/mips/elfinterp.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
aldot - Dec. 20, 2013, 1:37 p.m.
On Wed, Nov 27, 2013 at 09:55:51AM +0100, Waldemar Brodkorb wrote:
> When accessing errno, a per thread variable, from _stdio_init
> a SIGBUS error happens. This change fixes the wrong relocation
> and debug output.

applied, thanks!

I'll try to look at the other mips64 issues during christmas

Patch

diff --git a/ldso/ldso/mips/elfinterp.c b/ldso/ldso/mips/elfinterp.c
index e57a99f..a90e163 100644
--- a/ldso/ldso/mips/elfinterp.c
+++ b/ldso/ldso/mips/elfinterp.c
@@ -259,11 +259,11 @@  int _dl_parse_relocation_information(struct dyn_elf *xpnt,
 					case R_MIPS_TLS_TPREL32:
 					case R_MIPS_TLS_TPREL64:
 						CHECK_STATIC_TLS((struct link_map *)tls_tpnt);
-						*(ElfW(Word) *)reloc_addr +=
+						*(ElfW(Addr) *)reloc_addr +=
 							TLS_TPREL_VALUE (tls_tpnt, symbol_addr);
 #ifdef __SUPPORT_LD_DEBUG__
 						_dl_dprintf(2, "TLS_TPREL  : %s, %x, %x\n",
-							symname, old_val, *((unsigned int *)reloc_addr));
+							symname, old_val, *((unsigned long *)reloc_addr));
 #endif
 						break;
 				}