diff options
| author | "Steven J. Hill" <sjhill@realitydiluted.com> | 2005-10-04 00:42:09 +0000 |
|---|---|---|
| committer | "Steven J. Hill" <sjhill@realitydiluted.com> | 2005-10-04 00:42:09 +0000 |
| commit | 9c5f0fd6e767713360a48b76a68a4f5febe100da (patch) | |
| tree | e1a05ae02c3858393688196679a41fd21bf7a18b | |
| parent | f3cacffe54fb2644fcf6dee57b5768af4e32e797 (diff) | |
| download | uClibc-alpine-9c5f0fd6e767713360a48b76a68a4f5febe100da.tar.bz2 uClibc-alpine-9c5f0fd6e767713360a48b76a68a4f5febe100da.tar.xz | |
Bring in changes from trunk.
| -rw-r--r-- | ldso/ldso/ldso.c | 13 | ||||
| -rw-r--r-- | ldso/libdl/libdl.c | 18 | ||||
| -rw-r--r-- | libc/misc/internals/__uClibc_main.c | 5 |
3 files changed, 16 insertions, 20 deletions
diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c index dceeab68e..197392a0e 100644 --- a/ldso/ldso/ldso.c +++ b/ldso/ldso/ldso.c @@ -777,14 +777,6 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, unsigned long load_addr, if (_dl_symbol_tables) goof += _dl_fixup(_dl_symbol_tables, unlazy); - for (tpnt = _dl_loaded_modules; tpnt; tpnt = tpnt->next) { - if (tpnt->relro_size) - _dl_protect_relro (tpnt); - } - - - - /* OK, at this point things are pretty much ready to run. Now we need * to touch up a few items that are required, and then we can let the * user application have at it. Note that the dynamic linker itself @@ -836,6 +828,11 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, unsigned long load_addr, } } + for (tpnt = _dl_loaded_modules; tpnt; tpnt = tpnt->next) { + if (tpnt->relro_size) + _dl_protect_relro (tpnt); + } + /* Find the real malloc function and make ldso functions use that from now on */ _dl_malloc_function = (void* (*)(size_t)) (intptr_t) _dl_find_hash("malloc", _dl_symbol_tables, NULL, ELF_RTYPE_CLASS_PLT); diff --git a/ldso/libdl/libdl.c b/ldso/libdl/libdl.c index 529b865af..8ce9466f6 100644 --- a/ldso/libdl/libdl.c +++ b/ldso/libdl/libdl.c @@ -349,15 +349,6 @@ void *dlopen(const char *libname, int flag) if (_dl_fixup(dyn_chain, now_flag)) goto oops; - if (relro_ptr) { - for (rpnt = relro_ptr->next; rpnt; rpnt = rpnt->next) { - if (rpnt->dyn->relro_size) - _dl_protect_relro(rpnt->dyn); - } - } - /* TODO: Should we set the protections of all pages back to R/O now ? */ - - /* Notify the debugger we have added some objects. */ if (_dl_debug_addr) { dl_brk = (void (*)(void)) _dl_debug_addr->r_brk; @@ -389,6 +380,15 @@ void *dlopen(const char *libname, int flag) } } #endif + + if (relro_ptr) { + for (rpnt = relro_ptr->next; rpnt; rpnt = rpnt->next) { + if (rpnt->dyn->relro_size) + _dl_protect_relro(rpnt->dyn); + } + } + /* TODO: Should we set the protections of all pages back to R/O now ? */ + _dl_unmap_cache(); return (void *) dyn_chain; diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c index 8ed1f8d71..9dad20efa 100644 --- a/libc/misc/internals/__uClibc_main.c +++ b/libc/misc/internals/__uClibc_main.c @@ -30,9 +30,9 @@ #include <stdint.h> /* for gcc-3.x + Etoh ssp */ -uintptr_t __guard /* segfaults with attribute_relro */; +uintptr_t __guard attribute_relro; /* for gcc-4.1 non-TLS */ -uintptr_t __stack_chk_guard /* attribute_relro */; +uintptr_t __stack_chk_guard attribute_relro; #endif /* @@ -53,7 +53,6 @@ extern void weak_function __pthread_initialize_minimal(void); - /* * Declare the __environ global variable and create a weak alias environ. * Note: Apparently we must initialize __environ to ensure that the weak |
