Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/libexec/ld.elf_so/arch/arm R_ARM_TLS_TPOFF32 needs to adjust...



details:   https://anonhg.NetBSD.org/src/rev/020546707929
branches:  trunk
changeset: 934700:020546707929
user:      joerg <joerg%NetBSD.org@localhost>
date:      Tue Jun 16 21:02:20 2020 +0000

description:
R_ARM_TLS_TPOFF32 needs to adjust the existing value, not blindly
overwrite it.

diffstat:

 libexec/ld.elf_so/arch/arm/mdreloc.c |  11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (28 lines):

diff -r 6b9dbd2303a5 -r 020546707929 libexec/ld.elf_so/arch/arm/mdreloc.c
--- a/libexec/ld.elf_so/arch/arm/mdreloc.c      Tue Jun 16 21:01:30 2020 +0000
+++ b/libexec/ld.elf_so/arch/arm/mdreloc.c      Tue Jun 16 21:02:20 2020 +0000
@@ -1,8 +1,8 @@
-/*     $NetBSD: mdreloc.c,v 1.44 2018/04/03 21:10:27 joerg Exp $       */
+/*     $NetBSD: mdreloc.c,v 1.45 2020/06/16 21:02:20 joerg Exp $       */
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: mdreloc.c,v 1.44 2018/04/03 21:10:27 joerg Exp $");
+__RCSID("$NetBSD: mdreloc.c,v 1.45 2020/06/16 21:02:20 joerg Exp $");
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -232,8 +232,11 @@
                            _rtld_tls_offset_allocate(obj))
                                return -1;
 
-                       tmp = (Elf_Addr)def->st_value + defobj->tlsoffset +
-                           sizeof(struct tls_tcb);
+                       if (__predict_true(RELOC_ALIGNED_P(where)))
+                               tmp = *where;
+                       else
+                               tmp = load_ptr(where);
+                       tmp += (Elf_Addr)def->st_value + defobj->tlsoffset + sizeof(struct tls_tcb);
                        if (__predict_true(RELOC_ALIGNED_P(where)))
                                *where = tmp;
                        else



Home | Main Index | Thread Index | Old Index