diff mbox series

[uclibc-ng-devel] xtensa: fix R_XTENSA_TLSDESC_ARG handling in _dl_do_reloc

Message ID 1516197174-11306-1-git-send-email-jcmvbkbc@gmail.com
State Accepted
Headers show
Series [uclibc-ng-devel] xtensa: fix R_XTENSA_TLSDESC_ARG handling in _dl_do_reloc | expand

Commit Message

Max Filippov Jan. 17, 2018, 1:52 p.m. UTC
R_XTENSA_TLSDESC_ARG is a true RELA relocation, the addend is in the
relocation record itself, not in place.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
 ldso/ldso/xtensa/elfinterp.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Waldemar Brodkorb Jan. 17, 2018, 7:19 p.m. UTC | #1
Hi Max,
Max Filippov wrote,

> R_XTENSA_TLSDESC_ARG is a true RELA relocation, the addend is in the
> relocation record itself, not in place.
> 

Just curious, are you find these bugfixes via a general code review
or some bugs reported to you? Are there any additions to the
testsuite which might help to find these issues?

Are there more bugfixes coming? I can align/wait with the next release.

best regards
 Waldemar
Max Filippov Jan. 17, 2018, 7:42 p.m. UTC | #2
Hi Waldemar,

On Wed, Jan 17, 2018 at 11:19 AM, Waldemar Brodkorb <wbx@uclibc-ng.org> wrote:
>> R_XTENSA_TLSDESC_ARG is a true RELA relocation, the addend is in the
>> relocation record itself, not in place.
>
> Just curious, are you find these bugfixes via a general code review
> or some bugs reported to you? Are there any additions to the
> testsuite which might help to find these issues?

I'm currently reviving glibc port for xtensa and both TLS-related issues
for which I sent patches for uclibc-ng were triggered by the nptl/tst-stack4.
This test is not (and apparently never was) present in the uclibc-ng test
suite. However it's big, it doesn't complete in reasonable time on
configurations that I have, so I made a small version of it which I can share.

> Are there more bugfixes coming? I can align/wait with the next release.

I really don't know, I'm just going through the testsuite failures, fixing
glibc port and checking corresponding bits of uclibc-ng port. I have ~50
more failures not related to math and a few hundreds more of math
related, so it will probably take me several weeks to complete.
Waldemar Brodkorb Jan. 21, 2018, 12:37 p.m. UTC | #3
Hi Max,
Max Filippov wrote,

> R_XTENSA_TLSDESC_ARG is a true RELA relocation, the addend is in the
> relocation record itself, not in place.
> 
> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>

Applied and pushed,
 thx
  Waldemar
diff mbox series

Patch

diff --git a/ldso/ldso/xtensa/elfinterp.c b/ldso/ldso/xtensa/elfinterp.c
index 4c83ab65e668..e38a02666477 100644
--- a/ldso/ldso/xtensa/elfinterp.c
+++ b/ldso/ldso/xtensa/elfinterp.c
@@ -244,10 +244,11 @@  _dl_do_reloc (struct elf_resolve *tpnt, struct r_scope_elem *scope,
 		if (!TRY_STATIC_TLS ((struct link_map *) tls_tpnt))
 			*reloc_addr = (ElfW(Addr))
 				_dl_make_tlsdesc_dynamic((struct link_map *) tls_tpnt,
-										 symbol_addr + *reloc_addr);
+							 symbol_addr + rpnt->r_addend);
 		else
 #endif
-			*reloc_addr += symbol_addr + tls_tpnt->l_tls_offset;
+			*reloc_addr = symbol_addr + rpnt->r_addend +
+				tls_tpnt->l_tls_offset;
 		break;
 #endif