From 537bf804c58540a919c9ae6430aedf12427e392a Mon Sep 17 00:00:00 2001 From: ian Date: Wed, 28 Feb 2018 21:51:51 +0000 Subject: [PATCH] Fix module loading on arm after the metadata.c unification in r329190. Arm modules need an additional address fixup not needed by other platforms. --- stand/common/metadata.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/stand/common/metadata.c b/stand/common/metadata.c index 6aaa066694e0..31ba2fbb7123 100644 --- a/stand/common/metadata.c +++ b/stand/common/metadata.c @@ -265,6 +265,7 @@ md_copymodules(vm_offset_t addr, int kern64) struct preloaded_file *fp; struct file_metadata *md; uint64_t scratch64; + uint32_t scratch32; int c; c = addr != 0; @@ -281,7 +282,11 @@ md_copymodules(vm_offset_t addr, int kern64) scratch64 = fp->f_size; MOD_SIZE(addr, scratch64, c); } else { - MOD_ADDR(addr, fp->f_addr, c); + scratch32 = fp->f_addr; +#ifdef __arm__ + scratch32 -= __elfN(relocation_offset); +#endif + MOD_ADDR(addr, scratch32, c); MOD_SIZE(addr, fp->f_size, c); } for (md = fp->f_metadata; md != NULL; md = md->md_next) {