Fix issue when loading *.o when do internal function call

Fox example for the below example code:

#include <stdio.h>

void goodBye(void)
{
	printf("Good Bye!\n");
}

int main(int argc, char* argv[])
{
	printf("Hello World!\n");
	goodBye();
	return 0;
}
This commit is contained in:
parai 2018-02-08 20:19:10 +08:00 committed by GitHub
parent 84a44e58dd
commit 74622c6ed3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 0 deletions

View File

@ -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)
{