summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ldso/ldso/dl-elf.c5
-rw-r--r--ldso/ldso/ldso.c12
-rw-r--r--ldso/ldso/readelflib1.c5
3 files changed, 19 insertions, 3 deletions
diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c
index b84476338..aefcf19e3 100644
--- a/ldso/ldso/dl-elf.c
+++ b/ldso/ldso/dl-elf.c
@@ -573,6 +573,7 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure,
back again later. */
if (dynamic_info[DT_TEXTREL]) {
+#ifdef DO_MPROTECT_HACKS
ppnt = (elf_phdr *)(intptr_t) & header[epnt->e_phoff];
for (i = 0; i < epnt->e_phnum; i++, ppnt++) {
if (ppnt->p_type == PT_LOAD && !(ppnt->p_flags & PF_W))
@@ -581,6 +582,10 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure,
(ppnt->p_vaddr & ADDR_ALIGN) + (unsigned long) ppnt->p_filesz,
PROT_READ | PROT_WRITE | PROT_EXEC);
}
+#else
+ _dl_dprintf(_dl_debug_file, "Can't modify %s's text section. Use GCC option -fPIC for shared objects, please.\n",libname);
+ _dl_exit(1);
+#endif
}
tpnt = _dl_add_elf_hash_table(libname, (char *) libaddr, dynamic_info,
diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c
index 3dd5d19c9..bd8ef6e7f 100644
--- a/ldso/ldso/ldso.c
+++ b/ldso/ldso/ldso.c
@@ -659,10 +659,16 @@ static void _dl_get_ready_to_run(struct elf_resolve *tpnt, struct elf_resolve *a
tpnt->libtype = program_interpreter;
tpnt->loadaddr = (char *) load_addr;
- INIT_GOT(lpnt, tpnt);
+#ifdef ALLOW_ZERO_PLTGOT
+ if (tpnt->dynamic_info[DT_PLTGOT])
+#endif
+ {
+ INIT_GOT(lpnt, tpnt);
#ifdef __SUPPORT_LD_DEBUG_EARLY__
- _dl_dprintf(_dl_debug_file, "GOT found at %x\n", lpnt);
+ _dl_dprintf(_dl_debug_file, "GOT found at %x\n", lpnt);
#endif
+ }
+
/* OK, this was a big step, now we need to scan all of the user images
and load them properly. */
@@ -859,7 +865,7 @@ static void _dl_get_ready_to_run(struct elf_resolve *tpnt, struct elf_resolve *a
#endif
- _dl_trace_loaded_objects = _dl_getenv("__LDSO_LDD_SUPPORT___LOADED_OBJECTS", envp);
+ _dl_trace_loaded_objects = _dl_getenv("LD_TRACE_LOADED_OBJECTS", envp);
#ifndef __LDSO_LDD_SUPPORT__
if (_dl_trace_loaded_objects) {
_dl_dprintf(_dl_debug_file, "Use the ldd provided by uClibc\n");
diff --git a/ldso/ldso/readelflib1.c b/ldso/ldso/readelflib1.c
index b84476338..aefcf19e3 100644
--- a/ldso/ldso/readelflib1.c
+++ b/ldso/ldso/readelflib1.c
@@ -573,6 +573,7 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure,
back again later. */
if (dynamic_info[DT_TEXTREL]) {
+#ifdef DO_MPROTECT_HACKS
ppnt = (elf_phdr *)(intptr_t) & header[epnt->e_phoff];
for (i = 0; i < epnt->e_phnum; i++, ppnt++) {
if (ppnt->p_type == PT_LOAD && !(ppnt->p_flags & PF_W))
@@ -581,6 +582,10 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure,
(ppnt->p_vaddr & ADDR_ALIGN) + (unsigned long) ppnt->p_filesz,
PROT_READ | PROT_WRITE | PROT_EXEC);
}
+#else
+ _dl_dprintf(_dl_debug_file, "Can't modify %s's text section. Use GCC option -fPIC for shared objects, please.\n",libname);
+ _dl_exit(1);
+#endif
}
tpnt = _dl_add_elf_hash_table(libname, (char *) libaddr, dynamic_info,