/branches/dynload/uspace/app/dltest/dltest.c |
---|
34,12 → 34,8 |
* @file |
*/ |
#include <libtest.h> |
#include <stdio.h> |
void __io_init(void); |
void __main(void); |
void __exit(void); |
static void kputint(unsigned i) |
{ |
unsigned dummy; |
52,36 → 48,16 |
); |
} |
/*static void test(void) |
int main(int argc, char *argv[]) |
{ |
kputint(-1); |
kputint(42); |
kputint(0x100); |
printf("Hello from dltest!\n"); |
kputint(0x200); |
while(1); |
}*/ |
int main(int argc, char *argv[]) |
{ |
// test(); |
/* Unreachable, yet. Just to create a relocation entry */ |
test_func(); |
return 0; |
} |
void __io_init(void) |
{ |
} |
void __main(void) |
{ |
main(0, 0); |
} |
void __exit(void) |
{ |
} |
/** @} |
*/ |
/branches/dynload/uspace/app/dltest/Makefile |
---|
34,13 → 34,14 |
LIBC_PREFIX = ../../lib/libc |
SOFTINT_PREFIX = ../../lib/softint |
RTLD_PREFIX = ../../lib/rtld |
include $(LIBC_PREFIX)/Makefile.toolchain |
CFLAGS += -I../../lib/libtest -O0 |
LFLAGS := -Bdynamic -I/rtld.so |
CFLAGS += -I../../lib/libc -O0 |
LFLAGS := -Bdynamic -I/rtld.so -rpath-link $(RTLD_PREFIX) |
# LIBS = $(LIBC_PREFIX)/libc.a |
LIBS = ../../lib/libtest/libtest.so.0 |
LIBS = ../../lib/libc-shared/libc.so.0 |
DEFS += -DRELEASE=\"$(RELEASE)\" |
ifdef REVISION |
/branches/dynload/uspace/app/iloader/include/pcb.h |
---|
33,7 → 33,7 |
#ifndef ILOADER_PCB_H_ |
#define ILOADER_PCB_H_ |
#define PCB_ADDRESS 0x40000 |
#define PCB_ADDRESS 0x6000000 |
typedef void (*entry_point_t)(void); |
/branches/dynload/uspace/app/iramfs/data.h |
---|
45,9 → 45,9 |
extern const size_t dltest_size; |
extern const char dltest_filename[]; |
extern const uint8_t libtest[]; |
extern const size_t libtest_size; |
extern const char libtest_filename[]; |
extern const uint8_t libc[]; |
extern const size_t libc_size; |
extern const char libc_filename[]; |
#endif |
/branches/dynload/uspace/app/iramfs/main.c |
---|
88,7 → 88,7 |
if (write_file(rtld, rtld_size, rtld_filename) < 0) return 1; |
if (write_file(dltest, dltest_size, dltest_filename) < 0) return 1; |
if (write_file(libtest, libtest_size, libtest_filename) < 0) return 1; |
if (write_file(libc, libc_size, libc_filename) < 0) return 1; |
printf("done\n"); |
getchar(); |
/branches/dynload/uspace/app/iramfs/Makefile |
---|
87,7 → 87,7 |
%.o: %.c |
$(CC) $(DEFS) $(CFLAGS) -c $< -o $@ |
data.c: ../../lib/rtld/rtld.so ../dltest/dltest ../../lib/libtest/libtest.so |
data.c: ../../lib/rtld/rtld.so ../dltest/dltest ../../lib/libc-shared/libc.so.0 |
../../../tools/bin2c.py ../../lib/rtld/rtld.so rtld.so rtld >$@ |
../../../tools/bin2c.py ../dltest/dltest dltest dltest >>$@ |
../../../tools/bin2c.py ../../lib/libtest/libtest.so libtest.so.0 libtest >>$@ |
../../../tools/bin2c.py ../../lib/libc-shared/libc.so.0 libc.so.0 libc >>$@ |
/branches/dynload/uspace/lib/rtld/dynamic.c |
---|
98,6 → 98,7 |
(uintptr_t)info->soname, soname_idx, (uintptr_t)info->soname); |
printf("soname='%s'\n", info->soname); |
printf("rpath='%s'\n", info->rpath); |
printf("hash=0x%x\n", (uintptr_t)info->hash); |
/* |
* Now that we have a pointer to the string table, |
/branches/dynload/uspace/lib/rtld/rtld.c |
---|
70,7 → 70,7 |
printf("Program requested library '%s'\n", prog.dyn.needed); |
rc = elf_load_file("/libtest.so.0", 0x20000, &lib_info); |
rc = elf_load_file("/libc.so.0", 0x20000, &lib_info); |
if (rc < 0) { |
printf("failed to load library\n"); |
return; |
/branches/dynload/uspace/lib/rtld/arch/ia32/src/reloc.c |
---|
87,16 → 87,18 |
rel_type = ELF32_R_TYPE(r_info); |
r_ptr = (uint32_t *)(r_offset + m->bias); |
printf("rel_type: %x, rel_offset: 0x%x\n", rel_type, r_offset); |
sym_def = symbol_def_find(str_tab + sym->st_name, &dest); |
printf("dest name: '%s'\n", dest->dyn.soname); |
printf("dest bias: 0x%x\n", dest->bias); |
if (sym_def) { |
sym_addr = sym_def->st_value + dest->bias; |
printf("symbol definition found, addr=0x%x\n", sym_addr); |
} else { |
printf("symbol definition not found\n"); |
continue; |
if (sym->st_name != 0) { |
printf("rel_type: %x, rel_offset: 0x%x\n", rel_type, r_offset); |
sym_def = symbol_def_find(str_tab + sym->st_name, &dest); |
printf("dest name: '%s'\n", dest->dyn.soname); |
printf("dest bias: 0x%x\n", dest->bias); |
if (sym_def) { |
sym_addr = sym_def->st_value + dest->bias; |
printf("symbol definition found, addr=0x%x\n", sym_addr); |
} else { |
printf("symbol definition not found\n"); |
continue; |
} |
} |
switch (rel_type) { |
/branches/dynload/uspace/lib/libc-shared/Makefile |
---|
34,13 → 34,14 |
LIBC_PREFIX = ../../lib/libc |
SOFTINT_PREFIX = ../../lib/softint |
RTLD_PREFIX = ../../lib/rtld |
include $(LIBC_PREFIX)/Makefile.toolchain |
#include arch/$(ARCH)/Makefile.inc |
ARCH_SOURCES := |
LFLAGS = -shared -soname libc.so.0 --whole-archive |
LFLAGS = -shared -soname libc.so.0 --whole-archive |
LIBS = $(LIBC_PREFIX)/libc.pic.a $(SOFTINT_PREFIX)/libsoftint.a |
LIBS = $(LIBC_PREFIX)/libc.pic.a $(SOFTINT_PREFIX)/libsoftint.a $(RTLD_PREFIX)/rtld.so |
DEFS += -DRELEASE=\"$(RELEASE)\" |
ifdef REVISION |
/branches/dynload/uspace/Makefile |
---|
36,8 → 36,8 |
lib/libfs \ |
lib/softint \ |
lib/softfloat \ |
lib/rtld \ |
lib/libc-shared \ |
lib/rtld \ |
lib/libtest \ |
srv/ns \ |
srv/fb \ |