/branches/dynload/uspace/lib/rtld/include/rtld.h |
---|
61,7 → 61,7 |
link_t modules_head; |
} runtime_env_t; |
extern runtime_env_t runtime_env; |
extern runtime_env_t *runtime_env; |
#endif |
/branches/dynload/uspace/lib/rtld/module.c |
---|
77,12 → 77,15 |
*/ |
module_t *module_find(char *name) |
{ |
link_t *head = &runtime_env.modules_head; |
link_t *head = &runtime_env->modules_head; |
link_t *cur; |
module_t *m; |
char *p, *soname; |
printf("got head ptr\n"); |
printf(" = 0x%lx\n", (long) head); |
/* |
* If name contains slashes, treat it as a pathname and |
* construct soname by chopping off the path. Otherwise |
90,9 → 93,12 |
*/ |
p = strrchr(name, '/'); |
soname = p ? (p + 1) : name; |
printf("did strrchr. soname='%s'\n", soname); |
/* Traverse list of all modules. Not extremely fast, but simple */ |
for (cur = head->next; cur != head; cur = cur->next) { |
printf("get_instance...\n"); |
m = list_get_instance(cur, module_t, modules_link); |
if (strcmp(m->dyn.soname, soname) == 0) { |
return m; /* Found */ |
146,7 → 152,7 |
dynamic_parse(info.dynamic, m->bias, &m->dyn); |
/* Insert into the list of loaded modules */ |
list_append(&m->modules_link, &runtime_env.modules_head); |
list_append(&m->modules_link, &runtime_env->modules_head); |
return m; |
} |
209,7 → 215,7 |
void modules_process_relocs(void) |
{ |
link_t *head = &runtime_env.modules_head; |
link_t *head = &runtime_env->modules_head; |
link_t *cur; |
module_t *m; |
218,7 → 224,7 |
m = list_get_instance(cur, module_t, modules_link); |
/* Skip rtld, since it has already been processed */ |
if (m != &runtime_env.rtld) { |
if (m != &runtime_env->rtld) { |
module_process_relocs(m); |
} |
} |
228,7 → 234,7 |
*/ |
void modules_untag(void) |
{ |
link_t *head = &runtime_env.modules_head; |
link_t *head = &runtime_env->modules_head; |
link_t *cur; |
module_t *m; |
/branches/dynload/uspace/lib/rtld/rtld.c |
---|
36,7 → 36,7 |
#include <rtld.h> |
runtime_env_t runtime_env; |
runtime_env_t *runtime_env; |
/** @} |
*/ |
/branches/dynload/uspace/lib/rtld/symbol.c |
---|
149,8 → 149,8 |
/* Insert root (the program) into the queue and tag it */ |
list_initialize(&queue_head); |
runtime_env.program->bfs_tag = true; |
list_append(&runtime_env.program->queue_link, &queue_head); |
runtime_env->program->bfs_tag = true; |
list_append(&runtime_env->program->queue_link, &queue_head); |
/* If the symbol is found, it will be stored in 'sym' */ |
sym = NULL; |
/branches/dynload/uspace/lib/rtld/Makefile |
---|
41,6 → 41,8 |
CFLAGS += -Iinclude -I../../srv/loader/include -O0 -ggdb |
LFLAGS += |
PIC_CFLAGS := $(CFLAGS) -fPIC -D__PIC__ |
DEFS += -DRELEASE=\"$(RELEASE)\" |
ifdef REVISION |
65,9 → 67,12 |
GENERIC_OBJECTS := $(addsuffix .o,$(basename $(GENERIC_SOURCES))) |
ARCH_OBJECTS := $(addsuffix .o,$(basename $(ARCH_SOURCES))) |
OBJECTS := $(GENERIC_OBJECTS) $(ARCH_OBJECTS) |
PIC_OBJECTS := $(addsuffix .pio,$(basename $(OBJECTS))) |
.PHONY: all clean depend disasm sections inc |
all: inc $(OUTPUT) |
all: inc $(OUTPUT) librtld.pic.a |
inc: |
ln -sfn ../arch/$(ARCH)/include include/arch |
75,15 → 80,18 |
-include Makefile.depend |
clean: |
-rm -f $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm $(OUTPUT).sections Makefile.depend *.o arch/$(ARCH)/_link.ld include/arch |
-rm -f $(OUTPUT) librtld.pic.a $(OUTPUT).map $(OUTPUT).disasm $(OUTPUT).sections Makefile.depend *.o $(PIC_OBJECTS) arch/$(ARCH)/_link.ld include/arch |
find arch/$(ARCH)/ -name '*.o' -follow -exec rm \{\} \; |
depend: |
$(CC) $(DEFS) $(CFLAGS) -M $(ARCH_SOURCES) $(GENERIC_SOURCES)> Makefile.depend |
$(OUTPUT): depend $(ARCH_OBJECTS) $(GENERIC_OBJECTS) |
$(AR) rc $(OUTPUT) $(ARCH_OBJECTS) $(GENERIC_OBJECTS) |
$(OUTPUT): depend $(OBJECTS) |
$(AR) rc $(OUTPUT) $(OBJECTS) |
librtld.pic.a: depend $(PIC_OBJECTS) |
$(AR) rc librtld.pic.a $(PIC_OBJECTS) |
%.o: %.S |
$(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@ |
92,3 → 100,6 |
%.o: %.c |
$(CC) $(DEFS) $(CFLAGS) -c $< -o $@ |
%.pio: %.c |
$(CC) $(DEFS) $(PIC_CFLAGS) -c $< -o $@ |