From 86742879f3631e2fb995291877f9bdb98e4a0107 Mon Sep 17 00:00:00 2001 From: SASANO Takayoshi Date: Sat, 6 Oct 2018 18:33:18 +0900 Subject: [PATCH 1/4] There is no problem to create hello.mo with default compiler on Debian-9.5/amd64. But building hello.mo with i386-elf-gcc (5.5.0) cross compiler on OpenBSD-6.3/amd64, undefined reference to 'rt_kprintf' error occurs. To avoid this error, "compile and link" process needs to be divided to simply "compile" and "link". On Debian-9.5, both previous and current method produces same hello.mo. We have to improve disk image creation (Linux dependent), this is a future homework. --- bsp/x86/Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bsp/x86/Makefile b/bsp/x86/Makefile index cdb4f4ca8c..eb4654193b 100644 --- a/bsp/x86/Makefile +++ b/bsp/x86/Makefile @@ -7,7 +7,7 @@ all: rtthread rtsym exe dll floppy.img @sudo mount -t vfat floppy.img tmp -o loop @sudo cp -fv rtthread.elf tmp/boot/oskernel @sudo rm tmp/bin/* -fr - @sudo cp out/* tmp/bin/ -fv + @sudo cp out/*.mo tmp/bin/ -fv @sudo umount tmp rtthread: @@ -23,7 +23,8 @@ out: mkdir -p out dll: obj out - $(CC) -shared -s -fPIC -e main -Isrc src/hello.c -o out/hello.mo + $(CC) -c -fPIC -Isrc src/hello.c -o out/hello.o + $(CC) -s -Wl,-shared,-melf_i386,--entry=main -o out/hello.mo out/hello.o disasm: obj out $(CC) -shared -S -fPIC -Isrc src/hello.c -o obj/hello.s From c81ebdc6d9aff6bf21b7ce21c990d9ffc42c0902 Mon Sep 17 00:00:00 2001 From: SASANO Takayoshi Date: Sun, 7 Oct 2018 05:56:27 +0900 Subject: [PATCH 2/4] there is dummy time() function, but now it is implemented in components/libc/compilers/minilibc/time.c. maybe this dummy code is no longer required, so deleted. --- bsp/x86/drivers/board.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/bsp/x86/drivers/board.c b/bsp/x86/drivers/board.c index 4d91604ab3..211ae1832a 100644 --- a/bsp/x86/drivers/board.c +++ b/bsp/x86/drivers/board.c @@ -71,12 +71,4 @@ void reboot(void) } FINSH_FUNCTION_EXPORT(reboot, reboot PC) #endif -#ifdef RT_USING_DFS -#include -time_t time(time_t* tm) -{ - (void)tm; - return 0; -} -#endif /*@}*/ From 777554bb86f3c0f82254cf3319f1d3bdf1a400be Mon Sep 17 00:00:00 2001 From: SASANO Takayoshi Date: Wed, 10 Oct 2018 15:38:24 +0900 Subject: [PATCH 3/4] Fixed undefined reference to 'dlmodule_relocate' This is caused by #ifdef __x86__ For x86(32bit) gcc, pre-defined macro is __i386__ not __x86__. --- components/libc/libdl/arch/x86.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/libc/libdl/arch/x86.c b/components/libc/libdl/arch/x86.c index 4f70b1d22e..16f2322fb4 100644 --- a/components/libc/libdl/arch/x86.c +++ b/components/libc/libdl/arch/x86.c @@ -11,7 +11,7 @@ #include "../dlmodule.h" #include "../dlelf.h" -#ifdef __x86__ +#ifdef __i386__ #define R_X86_64_GLOB_DAT 6 /* Create GOT entry */ #define R_X86_64_JUMP_SLOT 7 /* Create PLT entry */ From b41ecff518ab26b560a3f4f07c0693d1b18def8e Mon Sep 17 00:00:00 2001 From: SASANO Takayoshi Date: Sun, 21 Oct 2018 21:21:38 +0900 Subject: [PATCH 4/4] fix rt_system_module_init() -> rt_system_dlmodule_init(), in components/libc/libdl/dlmodule.c. --- bsp/x86/applications/application.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bsp/x86/applications/application.c b/bsp/x86/applications/application.c index 2eb4e9b8ba..8928e6357e 100644 --- a/bsp/x86/applications/application.c +++ b/bsp/x86/applications/application.c @@ -48,7 +48,7 @@ void components_init(void) #endif #ifdef RT_USING_MODULE - rt_system_module_init(); + rt_system_dlmodule_init(); #endif #endif }