diff --git a/csu/libc-tls.c b/csu/libc-tls.c index 3c897bf28b..aed66f6f95 100644 --- a/csu/libc-tls.c +++ b/csu/libc-tls.c @@ -102,4 +102,10 @@ init_static_tls (size_t memsz, size_t align) } +static void silly_slow_memcpy(char * dst, const char * src, size_t sz) { + for (size_t i = 0; i < sz; ++i) { + dst[i] = src[i]; + } +} + void __libc_setup_tls (void) @@ -176,7 +182,9 @@ __libc_setup_tls (void) # error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined" #endif + _dl_static_dtv[2].pointer.to_free = NULL; /* sbrk gives us zero'd memory, so we don't need to clear the remainder. */ - memcpy (_dl_static_dtv[2].pointer.val, initimage, filesz); + //memcpy (_dl_static_dtv[2].pointer.val, initimage, filesz); + silly_slow_memcpy(_dl_static_dtv[2].pointer.val, initimage, filesz); /* Install the pointer to the dtv. */