Patchwork MIPS64 N64 SIGBUS error

login
register
mail settings
Submitter Waldemar Brodkorb
Date Nov. 26, 2013, 7:17 p.m.
Message ID <20131126191736.GM18747@waldemar-brodkorb.de>
Download mbox | patch
Permalink /patch/294385/
State Accepted
Commit 052bcf13afb067cafac5e7f4fc21fbad2b34b11f
Headers show

Comments

Waldemar Brodkorb - Nov. 26, 2013, 7:17 p.m.
Hi Bernhard,
Bernhard Reutner-Fischer wrote,

> On 24 November 2013 10:51, Waldemar Brodkorb <wbx@openadk.org> wrote:
> > Hi Developers,
> >
> > I am trying to find the reason for a SIGBUS error, when
> 
> which binutils? ld.gold or bfd?
> thanks,

Binutils 2.23.2. normal ld not ld.gold.
I have done a deeper look into glibc 2.18 code and found out that
they are using ElfW(Addr) for the relocation address (or negative
offset?), see ./ports/sysdeps/mips/dl-machine.h.

After changing this, the SIGBUS is gone.
I have done following change to fix the debug output, too:


What do you think about this change? I verified that it does not
effect a mips32 o32 build.

Thanks for any comments.
 Waldemar
Khem Raj - Nov. 26, 2013, 10:14 p.m.
On Tue, Nov 26, 2013 at 11:17 AM, Waldemar Brodkorb <wbx@openadk.org> wrote:
> Hi Bernhard,
> Bernhard Reutner-Fischer wrote,
>
>> On 24 November 2013 10:51, Waldemar Brodkorb <wbx@openadk.org> wrote:
>> > Hi Developers,
>> >
>> > I am trying to find the reason for a SIGBUS error, when
>>
>> which binutils? ld.gold or bfd?
>> thanks,
>
> Binutils 2.23.2. normal ld not ld.gold.
> I have done a deeper look into glibc 2.18 code and found out that
> they are using ElfW(Addr) for the relocation address (or negative
> offset?), see ./ports/sysdeps/mips/dl-machine.h.
>
> After changing this, the SIGBUS is gone.
> I have done following change to fix the debug output, too:
>
> diff -Nur uClibc-dev.orig/ldso/ldso/mips/elfinterp.c uClibc-dev/ldso/ldso/mips/elfinterp.c
> --- uClibc-dev.orig/ldso/ldso/mips/elfinterp.c  2013-11-23 22:51:50.000000000 +0100
> +++ uClibc-dev/ldso/ldso/mips/elfinterp.c       2013-11-25 11:46:04.000000000 +0100
> @@ -259,11 +259,11 @@
>                                         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;
>                                 }
>
> What do you think about this change?

this looks ok can you submit a properly formatted patch please ?

I verified that it does not
> effect a mips32 o32 build.
>
> Thanks for any comments.
>  Waldemar
> _______________________________________________
> uClibc mailing list
> uClibc@uclibc.org
> http://lists.busybox.net/mailman/listinfo/uclibc

Patch

diff -Nur uClibc-dev.orig/ldso/ldso/mips/elfinterp.c uClibc-dev/ldso/ldso/mips/elfinterp.c
--- uClibc-dev.orig/ldso/ldso/mips/elfinterp.c	2013-11-23 22:51:50.000000000 +0100
+++ uClibc-dev/ldso/ldso/mips/elfinterp.c	2013-11-25 11:46:04.000000000 +0100
@@ -259,11 +259,11 @@ 
 					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;
 				}