[uClibc-cvs] CVS uClibc/ldso/libdl
CVS User jocke
jocke at codepoet.org
Tue Nov 2 08:14:50 UTC 2004
Update of /var/cvs/uClibc/ldso/libdl
In directory nail:/tmp/cvs-serv19564/libdl
Modified Files:
libdl.c
Log Message:
- Remove dynamic_size from struct elf_resolve.
- Replace all open coded dynamic handling with a function. Reduces size.
- Fold special MIPS dynamic code into the dynamic_info item.
- Add RELRO support.
- Support linking with "-z now".
- prepare for DT_RELACOUNT/DT_RELCOUNT optimization.
- Add -z now to ld.so linking, this is what ld.so does anyway so
let the linker know that.
--- /var/cvs/uClibc/ldso/libdl/libdl.c 2004/10/14 15:23:51 1.59
+++ /var/cvs/uClibc/ldso/libdl/libdl.c 2004/11/02 08:14:49 1.60
@@ -47,6 +47,8 @@
__attribute__ ((__weak__));
extern int _dl_fixup(struct dyn_elf *rpnt, int lazy)
__attribute__ ((__weak__));
+extern void _dl_protect_relro(struct elf_resolve * tpnt)
+ __attribute__ ((__weak__));
extern int _dl_errno __attribute__ ((__weak__));
extern struct dyn_elf *_dl_symbol_tables __attribute__ ((__weak__));
extern struct dyn_elf *_dl_handles __attribute__ ((__weak__));
@@ -128,7 +130,7 @@
void *dlopen(const char *libname, int flag)
{
struct elf_resolve *tpnt, *tfrom, *tcurr;
- struct dyn_elf *dyn_chain, *rpnt = NULL, *dyn_ptr;
+ struct dyn_elf *dyn_chain, *rpnt = NULL, *dyn_ptr, *relro_ptr;
struct dyn_elf *dpnt;
ElfW(Addr) from;
struct elf_resolve *tpnt1;
@@ -168,6 +170,8 @@
tfrom = tpnt;
}
for(rpnt = _dl_symbol_tables; rpnt->next; rpnt=rpnt->next);
+
+ relro_ptr = rpnt;
/* Try to load the specified library */
#ifdef __SUPPORT_LD_DEBUG__
if(_dl_debug)
@@ -311,6 +315,10 @@
if (_dl_fixup(dyn_chain, now_flag))
goto oops;
+ 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 ? */
More information about the uClibc-cvs
mailing list