ldso/ARC: fix DT_RELACOUNT handling

Submitted by Vineet Gupta on May 20, 2016, 6:56 a.m.

Details

Message ID 1463727387-26624-1-git-send-email-vgupta@synopsys.com
State New
Headers show

Commit Message

Vineet Gupta May 20, 2016, 6:56 a.m.
From: Cupertino Miranda <cmiranda@synopsys.com>

Wih new bintuils supporting DT_RELACOUNT, ldso was crashing as it was
parsing relocs incorrectly.

Apparently that code ran for first time and was never tested.

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
---
 ldso/ldso/arc/dl-sysdep.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Khem Raj May 20, 2016, 7:27 a.m.
On Thu, May 19, 2016 at 11:56 PM, Vineet Gupta
<Vineet.Gupta1@synopsys.com> wrote:
> From: Cupertino Miranda <cmiranda@synopsys.com>
>
> Wih new bintuils supporting DT_RELACOUNT, ldso was crashing as it was
> parsing relocs incorrectly.
>
> Apparently that code ran for first time and was never tested.
>
> Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
> ---
>  ldso/ldso/arc/dl-sysdep.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/ldso/ldso/arc/dl-sysdep.h b/ldso/ldso/arc/dl-sysdep.h
> index b6bda9d14691..caece997d254 100644
> --- a/ldso/ldso/arc/dl-sysdep.h
> +++ b/ldso/ldso/arc/dl-sysdep.h
> @@ -166,7 +166,7 @@ static __always_inline void
>  elf_machine_relative (Elf32_Addr load_off, const Elf32_Addr rel_addr,
>                       Elf32_Word relative_count)
>  {
> -        Elf32_Rel * rpnt = (void *) rel_addr;
> +        Elf32_Rela * rpnt = (void *) rel_addr;

This is ok

>         --rpnt;
>         do {
>                 Elf32_Addr *const reloc_addr = (void *) (load_off + (++rpnt)->r_offset);
> --
> 2.5.0
>
> _______________________________________________
> uClibc mailing list
> uClibc@uclibc.org
> http://lists.busybox.net/mailman/listinfo/uclibc
Vineet Gupta May 20, 2016, 8:26 a.m.
On Friday 20 May 2016 12:57 PM, Khem Raj wrote:
> On Thu, May 19, 2016 at 11:56 PM, Vineet Gupta
> <Vineet.Gupta1@synopsys.com> wrote:
>> From: Cupertino Miranda <cmiranda@synopsys.com>
>>
>> Wih new bintuils supporting DT_RELACOUNT, ldso was crashing as it was
>> parsing relocs incorrectly.
>>
>> Apparently that code ran for first time and was never tested.
>>
>> Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
>> ---
>>  ldso/ldso/arc/dl-sysdep.h | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/ldso/ldso/arc/dl-sysdep.h b/ldso/ldso/arc/dl-sysdep.h
>> index b6bda9d14691..caece997d254 100644
>> --- a/ldso/ldso/arc/dl-sysdep.h
>> +++ b/ldso/ldso/arc/dl-sysdep.h
>> @@ -166,7 +166,7 @@ static __always_inline void
>>  elf_machine_relative (Elf32_Addr load_off, const Elf32_Addr rel_addr,
>>                       Elf32_Word relative_count)
>>  {
>> -        Elf32_Rel * rpnt = (void *) rel_addr;
>> +        Elf32_Rela * rpnt = (void *) rel_addr;
> This is ok

Is this is question - ARC is a rela ABI and this fell thru cracks as it was not
being exercised at all due to lack of DT_RELACOUNT support in binutils so far.

>
>>         --rpnt;
>>         do {
>>                 Elf32_Addr *const reloc_addr = (void *) (load_off + (++rpnt)->r_offset);
>> --
>> 2.5.0
>>
>> _______________________________________________
>> uClibc mailing list
>> uClibc@uclibc.org
>> http://lists.busybox.net/mailman/listinfo/uclibc
Khem Raj May 20, 2016, 2:37 p.m.
On Fri, May 20, 2016 at 1:26 AM, Vineet Gupta
<Vineet.Gupta1@synopsys.com> wrote:
>> This is ok
>
> Is this is question

no, its a comment. I know its a rela ABI
Waldemar Brodkorb May 28, 2016, 7:59 p.m.
Hi,
Vineet Gupta wrote,

> From: Cupertino Miranda <cmiranda@synopsys.com>
> 
> Wih new bintuils supporting DT_RELACOUNT, ldso was crashing as it was
> parsing relocs incorrectly.
> 
> Apparently that code ran for first time and was never tested.
> 
> Signed-off-by: Vineet Gupta <vgupta@synopsys.com>

Applied and pushed,

But the testsuite results are still not pretty.
ARM and Xtensa are down to zero failures.
ARC has between 28-30 failures even with latest binutils/gcc
release. Anyone from you can take a look?

For example:
http://tests.embedded-test.org/uClibc-ng/1.0.14/REPORT.arcv2.nsim.libc.uClibc-ng-1.0.14

 Thanks
  Waldemar
Vineet Gupta May 30, 2016, 4:31 a.m.
On Sunday 29 May 2016 01:30 AM, Waldemar Brodkorb wrote:
> ARC has between 28-30 failures even with latest binutils/gcc

Latest here is pretty overloaded :-) We had 2016.03 release recently and then
there's bleeding edge binutils atleast which is tracking pretty close to upstream
binutils.

What exact versions of these tools are you using.

Thx,
-Vineet
Waldemar Brodkorb May 30, 2016, 5:20 a.m.
Hi Vineet,
Vineet Gupta wrote,

> On Sunday 29 May 2016 01:30 AM, Waldemar Brodkorb wrote:
> > ARC has between 28-30 failures even with latest binutils/gcc
> 
> Latest here is pretty overloaded :-) We had 2016.03 release recently and then
> there's bleeding edge binutils atleast which is tracking pretty close to upstream
> binutils.
> 
> What exact versions of these tools are you using.

I am using 2016.03. I wanted to say latest release :=)

The 1.0.15 testrun is not yet finished, but I think it is
simply reproducable by running nsim and uclibcng-testrunner.sh.

best regards
 Waldemar
Waldemar Brodkorb May 30, 2016, 5:34 a.m.
Hi,
Waldemar Brodkorb wrote,

> Hi Vineet,
> Vineet Gupta wrote,
> 
> > On Sunday 29 May 2016 01:30 AM, Waldemar Brodkorb wrote:
> > > ARC has between 28-30 failures even with latest binutils/gcc
> > 
> > Latest here is pretty overloaded :-) We had 2016.03 release recently and then
> > there's bleeding edge binutils atleast which is tracking pretty close to upstream
> > binutils.
> > 
> > What exact versions of these tools are you using.
> 
> I am using 2016.03. I wanted to say latest release :=)
> 
> The 1.0.15 testrun is not yet finished, but I think it is
> simply reproducable by running nsim and uclibcng-testrunner.sh.

Nsim is nice to script, but the performance
is pretty bad. Running the testsuite takes for the four combinations
(arc700,archs,little and big mode) mostly the same time as 
running all the other tests in Qemu :)
1 CORE 100 % CPU...

Would be NSIM Pro faster?

best regards
 Waldemar
Waldemar Brodkorb May 31, 2016, 4:15 a.m.
Hi,
Waldemar Brodkorb wrote,

> Hi,
> Waldemar Brodkorb wrote,
> 
> > Hi Vineet,
> > Vineet Gupta wrote,
> > 
> > > On Sunday 29 May 2016 01:30 AM, Waldemar Brodkorb wrote:
> > > > ARC has between 28-30 failures even with latest binutils/gcc
> > > 
> > > Latest here is pretty overloaded :-) We had 2016.03 release recently and then
> > > there's bleeding edge binutils atleast which is tracking pretty close to upstream
> > > binutils.
> > > 
> > > What exact versions of these tools are you using.
> > 
> > I am using 2016.03. I wanted to say latest release :=)
> > 
> > The 1.0.15 testrun is not yet finished, but I think it is
> > simply reproducable by running nsim and uclibcng-testrunner.sh.
> 
> Nsim is nice to script, but the performance
> is pretty bad. Running the testsuite takes for the four combinations
> (arc700,archs,little and big mode) mostly the same time as 
> running all the other tests in Qemu :)
> 1 CORE 100 % CPU...
> 
> Would be NSIM Pro faster?

Here are the 1.0.15 results:
http://tests.embedded-test.org/uClibc-ng/1.0.15/

best regards
 Waldemar
Alexey Brodkin May 31, 2016, 3:58 p.m.
Hi Waldemar,

On Tue, 2016-05-31 at 06:15 +0200, Waldemar Brodkorb wrote:
> Hi,
> Waldemar Brodkorb wrote,
> 
> > 
> > Hi,
> > Waldemar Brodkorb wrote,
> > 
> > > 
> > > Hi Vineet,
> > > Vineet Gupta wrote,
> > > 
> > > > 
> > > > On Sunday 29 May 2016 01:30 AM, Waldemar Brodkorb wrote:
> > > > > 
> > > > > ARC has between 28-30 failures even with latest binutils/gcc
> > > > Latest here is pretty overloaded :-) We had 2016.03 release recently and then
> > > > there's bleeding edge binutils atleast which is tracking pretty close to upstream
> > > > binutils.
> > > > 
> > > > What exact versions of these tools are you using.
> > > I am using 2016.03. I wanted to say latest release :=)
> > > 
> > > The 1.0.15 testrun is not yet finished, but I think it is
> > > simply reproducable by running nsim and uclibcng-testrunner.sh.
> > Nsim is nice to script, but the performance
> > is pretty bad. Running the testsuite takes for the four combinations
> > (arc700,archs,little and big mode) mostly the same time as 
> > running all the other tests in Qemu :)
> > 1 CORE 100 % CPU...
> > 
> > Would be NSIM Pro faster?
> Here are the 1.0.15 results:
> http://tests.embedded-test.org/uClibc-ng/1.0.15/

Thank you so much for doing that, appreciate it a lot!

I'm wondering if there's a reason why did you use Linux 4.4
instead of latest (4.6)? Since we push all out stuff upstream
chances are some failures won't happen with more recent kernel.

Also from the logs it's not clear what tools were used?
Was it latest stable arc-2016.03, previous arc-2015.12?
I'd like to have this information to narrow down investigation of
failure reasons.

-Alexey
Waldemar Brodkorb June 1, 2016, 5:52 p.m.
Hi Alexey,
Alexey Brodkin wrote,
> Hi Waldemar,
> 
> On Tue, 2016-05-31 at 06:15 +0200, Waldemar Brodkorb wrote:
> > Hi,
> > Waldemar Brodkorb wrote,
> > 
> > > 
> > > Hi,
> > > Waldemar Brodkorb wrote,
> > > 
> > > > 
> > > > Hi Vineet,
> > > > Vineet Gupta wrote,
> > > > 
> > > > > 
> > > > > On Sunday 29 May 2016 01:30 AM, Waldemar Brodkorb wrote:
> > > > > > 
> > > > > > ARC has between 28-30 failures even with latest binutils/gcc
> > > > > Latest here is pretty overloaded :-) We had 2016.03 release recently and then
> > > > > there's bleeding edge binutils atleast which is tracking pretty close to upstream
> > > > > binutils.
> > > > > 
> > > > > What exact versions of these tools are you using.
> > > > I am using 2016.03. I wanted to say latest release :=)
> > > > 
> > > > The 1.0.15 testrun is not yet finished, but I think it is
> > > > simply reproducable by running nsim and uclibcng-testrunner.sh.
> > > Nsim is nice to script, but the performance
> > > is pretty bad. Running the testsuite takes for the four combinations
> > > (arc700,archs,little and big mode) mostly the same time as 
> > > running all the other tests in Qemu :)
> > > 1 CORE 100 % CPU...
> > > 
> > > Would be NSIM Pro faster?
> > Here are the 1.0.15 results:
> > http://tests.embedded-test.org/uClibc-ng/1.0.15/
> 
> Thank you so much for doing that, appreciate it a lot!
> 
> I'm wondering if there's a reason why did you use Linux 4.4
> instead of latest (4.6)? Since we push all out stuff upstream
> chances are some failures won't happen with more recent kernel.

Normally I try to run with latest LTS kernel for the testing.
I updated ARC tests to use 4.6. (one failure disappeared)
 
> Also from the logs it's not clear what tools were used?
> Was it latest stable arc-2016.03, previous arc-2015.12?
> I'd like to have this information to narrow down investigation of
> failure reasons.

arc-2016.03 is used here. I will add some information about
OpenADK git version used and GCC/Binutils used for running the stuff
in the future.

best regards
 Waldemar

Patch hide | download patch | download mbox

diff --git a/ldso/ldso/arc/dl-sysdep.h b/ldso/ldso/arc/dl-sysdep.h
index b6bda9d14691..caece997d254 100644
--- a/ldso/ldso/arc/dl-sysdep.h
+++ b/ldso/ldso/arc/dl-sysdep.h
@@ -166,7 +166,7 @@  static __always_inline void
 elf_machine_relative (Elf32_Addr load_off, const Elf32_Addr rel_addr,
 		      Elf32_Word relative_count)
 {
-	 Elf32_Rel * rpnt = (void *) rel_addr;
+	 Elf32_Rela * rpnt = (void *) rel_addr;
 	--rpnt;
 	do {
 		Elf32_Addr *const reloc_addr = (void *) (load_off + (++rpnt)->r_offset);