From c80400a1322a6179ac4c7a74f01891810ed353fe Mon Sep 17 00:00:00 2001 From: raj Date: Thu, 19 Nov 2009 16:25:41 +0000 Subject: Provide an effective (relocated) address when building modules metadata. This lets modules loaded dynamically in loader(8) work for U-Boot-based platforms. MFC after: 1 week --- sys/boot/uboot/common/metadata.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/boot/uboot/common/metadata.c b/sys/boot/uboot/common/metadata.c index 9c8ce94..e5f4b04 100644 --- a/sys/boot/uboot/common/metadata.c +++ b/sys/boot/uboot/common/metadata.c @@ -231,6 +231,7 @@ md_copymodules(vm_offset_t addr) struct preloaded_file *fp; struct file_metadata *md; int c; + vm_offset_t a; c = addr != 0; /* start with the first module on the list, should be the kernel */ @@ -240,7 +241,8 @@ md_copymodules(vm_offset_t addr) MOD_TYPE(addr, fp->f_type, c); if (fp->f_args) MOD_ARGS(addr, fp->f_args, c); - MOD_ADDR(addr, fp->f_addr, c); + a = fp->f_addr - __elfN(relocation_offset); + MOD_ADDR(addr, a, c); MOD_SIZE(addr, fp->f_size, c); for (md = fp->f_metadata; md != NULL; md = md->md_next) { if (!(md->md_type & MODINFOMD_NOCOPY)) -- cgit v1.1