From 74622c6ed343b0fffe6ce47b620569f0d94ceee4 Mon Sep 17 00:00:00 2001 From: parai Date: Thu, 8 Feb 2018 20:19:10 +0800 Subject: [PATCH] Fix issue when loading *.o when do internal function call Fox example for the below example code: #include void goodBye(void) { printf("Good Bye!\n"); } int main(int argc, char* argv[]) { printf("Hello World!\n"); goodBye(); return 0; } --- src/module.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/module.c b/src/module.c index 2c5cec1b0..b9801558d 100644 --- a/src/module.c +++ b/src/module.c @@ -823,6 +823,15 @@ static struct rt_module* _load_relocated_object(const char *name, (Elf32_Addr)data_addr + sym->st_value); } } + else if (ELF_ST_TYPE(sym->st_info) == STT_FUNC) + { + /* relocate function */ + rt_module_arm_relocate(module, rel, + (Elf32_Addr)((rt_uint8_t *) + module->module_space + - module_addr + + sym->st_value)); + } } else if (ELF_ST_TYPE(sym->st_info) == STT_FUNC) {