summaryrefslogtreecommitdiff
path: root/elf/dl-load.c
diff options
context:
space:
mode:
Diffstat (limited to 'elf/dl-load.c')
-rw-r--r--elf/dl-load.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 36dc123c01..ccbbf4fdd2 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -1085,7 +1085,6 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
break;
case PT_TLS:
-#ifdef USE_TLS
if (ph->p_memsz == 0)
/* Nothing to do for an empty segment. */
break;
@@ -1113,7 +1112,7 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
break;
}
-# ifdef SHARED
+#ifdef SHARED
if (l->l_prev == NULL || (mode & __RTLD_AUDIT) != 0)
/* We are loading the executable itself when the dynamic linker
was executed directly. The setup will happen later. */
@@ -1122,7 +1121,7 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
/* In a static binary there is no way to tell if we dynamically
loaded libpthread. */
if (GL(dl_error_catch_tsd) == &_dl_initial_error_catch_tsd)
-# endif
+#endif
{
/* We have not yet loaded libpthread.
We can do the TLS setup right now! */
@@ -1155,7 +1154,6 @@ cannot allocate TLS data structures for initial thread");
_dl_deallocate_tls (tcb, 1);
goto call_lose;
}
-#endif
/* Uh-oh, the binary expects TLS support but we cannot
provide it. */
@@ -1394,7 +1392,7 @@ cannot allocate TLS data structures for initial thread");
requires that it be executable. We must change the
protection of the variable which contains the flags used in
the mprotect calls. */
-#if defined HAVE_Z_RELRO && defined SHARED
+#ifdef SHARED
if ((mode & (__RTLD_DLOPEN | __RTLD_AUDIT)) == __RTLD_DLOPEN)
{
const uintptr_t p = (uintptr_t) &__stack_prot & -GLRO(dl_pagesize);
@@ -1431,11 +1429,9 @@ cannot enable executable stack as shared object requires");
}
}
-#ifdef USE_TLS
/* Adjust the address of the TLS initialization image. */
if (l->l_tls_initimage != NULL)
l->l_tls_initimage = (char *) l->l_tls_initimage + l->l_addr;
-#endif
/* We are done mapping in the file. We no longer need the descriptor. */
if (__builtin_expect (__close (fd) != 0, 0))
@@ -1939,11 +1935,10 @@ open_path (const char *name, size_t namelen, int preloaded,
must not be freed using the general free() in libc. */
if (sps->malloced)
free (sps->dirs);
-#ifdef HAVE_Z_RELRO
+
/* rtld_search_dirs is attribute_relro, therefore avoid writing
into it. */
if (sps != &rtld_search_dirs)
-#endif
sps->dirs = (void *) -1;
}