summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/gen/tls.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/libc/gen/tls.c b/lib/libc/gen/tls.c
index dd1e7df..6cba47f 100644
--- a/lib/libc/gen/tls.c
+++ b/lib/libc/gen/tls.c
@@ -33,6 +33,7 @@
*/
#include <sys/cdefs.h>
+#include <sys/param.h>
#include <stdlib.h>
#include <string.h>
#include <elf.h>
@@ -82,9 +83,6 @@ void __libc_free_tls(void *tls, size_t tcbsize, size_t tcbalign);
#ifndef PIC
-#define round(size, align) \
- (((size) + (align) - 1) & ~((align) - 1))
-
static size_t tls_static_space;
static size_t tls_init_size;
static void *tls_init;
@@ -190,7 +188,7 @@ __libc_free_tls(void *tcb, size_t tcbsize __unused, size_t tcbalign)
* Figure out the size of the initial TLS block so that we can
* find stuff which ___tls_get_addr() allocated dynamically.
*/
- size = round(tls_static_space, tcbalign);
+ size = roundup2(tls_static_space, tcbalign);
dtv = ((Elf_Addr**)tcb)[1];
tlsend = (Elf_Addr) tcb;
@@ -210,7 +208,7 @@ __libc_allocate_tls(void *oldtls, size_t tcbsize, size_t tcbalign)
Elf_Addr *dtv;
Elf_Addr segbase, oldsegbase;
- size = round(tls_static_space, tcbalign);
+ size = roundup2(tls_static_space, tcbalign);
if (tcbsize < 2 * sizeof(Elf_Addr))
tcbsize = 2 * sizeof(Elf_Addr);
@@ -307,7 +305,7 @@ _init_tls(void)
for (i = 0; (unsigned) i < phnum; i++) {
if (phdr[i].p_type == PT_TLS) {
- tls_static_space = round(phdr[i].p_memsz,
+ tls_static_space = roundup2(phdr[i].p_memsz,
phdr[i].p_align);
tls_init_size = phdr[i].p_filesz;
tls_init = (void*) phdr[i].p_vaddr;
OpenPOWER on IntegriCloud