Subversion Repositories HelenOS

Compare Revisions

No changes between revisions

Ignore whitespace Rev 2968 → Rev 2969

/branches/dynload/uspace/lib/rtld/include/elf.h
File deleted
/branches/dynload/uspace/lib/rtld/include/dynamic.h
86,6 → 86,9
bool symbolic;
bool text_rel;
bool bind_now;
 
/* Assume for now that there's at most one needed library */
char *needed;
} dyn_info_t;
 
void dynamic_parse(elf_dyn_t *dyn_ptr, size_t bias, dyn_info_t *info);
/branches/dynload/uspace/lib/rtld/dynamic.c
104,7 → 104,9
 
switch (dp->d_tag) {
case DT_NEEDED:
printf("needed:'%s'\n", info->str_tab + d_val);
/* Assume just for now there's only one dependency */
info->needed = info->str_tab + d_val;
printf("needed:'%s'\n", info->needed);
break;
 
default: break;
/branches/dynload/uspace/lib/rtld/rtld.c
40,7 → 40,8
 
#include <rtld.h>
#include <dynamic.h>
#include "../../app/iloader/pcb.h"
#include <pcb.h>
#include <elf_load.h>
 
static void kputint(unsigned i)
{
54,46 → 55,29
);
}
 
int z = 42;
 
void _putint(int i);
 
void test_func(void);
void test_func(void)
{
int fd, rc;
char buf[5];
 
printf("Hello, world! (from rtld)\n");
 
fd = open("/tetris", O_RDONLY);
if (fd < 0) { printf("fd<0 ("); _putint(fd); printf(")\n"); }
fd = 0;
 
rc = read(fd, &buf, 4);
//printf(" ->%d\n", rc);
buf[4]='\0';
printf(buf);
getchar();
 
printf("x\n");
while(1);
}
 
 
void _rtld_main(void)
{
// test_func();
 
pcb_t *pcb;
static dyn_info_t dyn_info;
elf_info_t lib_info;
int rc;
 
printf("Hello, world! (from rtld)\n");
getchar();
printf("Run program..\n");
 
printf("Parse .dynamic section\n");
pcb = (pcb_t *)PCB_ADDRESS;
dynamic_parse(pcb->dynamic, 0, &dyn_info);
 
printf("Program requested library '%s'\n", dyn_info.needed);
rc = elf_load_file("/libtest.so.0", &lib_info);
if (rc < 0) {
printf("failed to load library\n");
return;
}
 
printf("Run program..\n");
pcb->entry();
}
 
/branches/dynload/uspace/lib/rtld/elf_load.c
0,0 → 1,0
link ../../app/iloader/elf_load.c
Property changes:
Added: svn:special
+*
\ No newline at end of property
/branches/dynload/uspace/lib/rtld/Makefile
37,7 → 37,7
include $(LIBC_PREFIX)/Makefile.toolchain
include arch/$(ARCH)/Makefile.inc
 
CFLAGS += -I../../srv/kbd/include -I../../srv/console -Iinclude -fPIC -O0
CFLAGS += -I../../app/iloader/include -Iinclude -fPIC -O0 -ggdb
LFLAGS = -shared --no-undefined
 
LIBS = $(LIBC_PREFIX)/libc.pic.a
57,7 → 57,8
OUTPUT = rtld.so
GENERIC_SOURCES = \
rtld.c \
dynamic.c
dynamic.c \
elf_load.c
 
GENERIC_OBJECTS := $(addsuffix .o,$(basename $(GENERIC_SOURCES)))
ARCH_OBJECTS := $(addsuffix .o,$(basename $(ARCH_SOURCES)))