t-kernel-zh team mailing list archive
-
t-kernel-zh team
-
Mailing list archive
-
Message #00005
[Open T-Kernel] GCC 除法库的支持
GCC 的除法,取余等函数存在于 libgcc.a 之中,原版的 T-Kernel 使用了编
译器附带的函数。Open T-Kernel 不采用这种方式,而是采用 LINUX 内核的方
式,不依赖于编译器提供的库,这样期望有更好的兼容性。调试也更有确定性,
比如果,不会因为改了编译器,而系统的行为发生太大的改变。
目前我所知可用的除法,在 Linux 内核或 U-Boot,Barebox,Redhat Newlib
都有不错的参考实现,下一步可以先从 Linux 内核搬出相应的函数来用。
目前出错的信息如下:
----------------------------------------------------------------------
du@book:~/open-t-kernel/tkernel_source$ make
AS sysdepend/arm/lib/libgcc.o
LD sysdepend/arm/lib/built-in.o
LINK vmtronx
LD vmtronx.o
find: ‘.tmp_versions’: No such file or directory
MODPOST vmtronx.o
GEN .version
LD vmtronx
sysdepend/arm/lib/built-in.o: In function `GetPhysicalTimerConfig':
waitusec.c:(.text+0x2678): undefined reference to `__aeabi_uidiv'
lib/built-in.o: In function `_mem_malloc':
lib/libtm/tm_writedisk.o:(.text+0x2d04): undefined reference to `__aeabi_uidiv'
lib/built-in.o: In function `_vsprintf.constprop.0':
lib/libtm/tm_writedisk.o:(.text+0x41ac): undefined reference to `__aeabi_uidivmod'
lib/libtm/tm_writedisk.o:(.text+0x41c0): undefined reference to `__aeabi_uidiv'
sysdepend/arm/mach-em1d/built-in.o: In function `CountWaitUsec':
tkdev_init.c:(.text+0x1c4): undefined reference to `__aeabi_uidiv'
tkdev_init.c:(.text+0x1d8): undefined reference to `__aeabi_uidiv'
kernel/built-in.o: In function `request':
wait.c:(.text+0x2308): undefined reference to `__aeabi_ldivmod'
kernel/built-in.o: In function `waitcomplete':
wait.c:(.text+0x2714): undefined reference to `__aeabi_ldivmod'
kernel/built-in.o: In function `imalloc':
wait.c:(.text+0x39d0): undefined reference to `__aeabi_uidiv'
kernel/built-in.o: In function `_tk_rel_mpf':
wait.c:(.text+0x68f4): undefined reference to `__aeabi_idivmod'
kernel/built-in.o: In function `_tk_ref_tsk':
wait.c:(.text+0xf580): undefined reference to `__aeabi_uldivmod'
kernel/built-in.o: In function `_tk_inf_tsk':
wait.c:(.text+0xf72c): undefined reference to `__aeabi_uldivmod'
wait.c:(.text+0xf74c): undefined reference to `__aeabi_uldivmod'
kernel/built-in.o: In function `_td_ref_tsk':
wait.c:(.text+0x1013c): undefined reference to `__aeabi_uldivmod'
kernel/built-in.o: In function `_td_inf_tsk':
wait.c:(.text+0x102c0): undefined reference to `__aeabi_uldivmod'
kernel/built-in.o:wait.c:(.text+0x102e0): more undefined references to `__aeabi_uldivmod' follow
kernel/built-in.o: In function `_tk_get_tim':
wait.c:(.text+0x11240): undefined reference to `__aeabi_ldivmod'
kernel/built-in.o: In function `_tk_get_tim_u':
wait.c:(.text+0x11360): undefined reference to `__aeabi_uidiv'
wait.c:(.text+0x11374): undefined reference to `__aeabi_ldivmod'
kernel/built-in.o: In function `_tk_get_otm':
wait.c:(.text+0x11420): undefined reference to `__aeabi_ldivmod'
kernel/built-in.o: In function `_tk_get_otm_u':
wait.c:(.text+0x1152c): undefined reference to `__aeabi_uidiv'
wait.c:(.text+0x11540): undefined reference to `__aeabi_ldivmod'
kernel/built-in.o: In function `_td_get_tim':
wait.c:(.text+0x11604): undefined reference to `__aeabi_ldivmod'
wait.c:(.text+0x11694): undefined reference to `__aeabi_uidiv'
wait.c:(.text+0x116a8): undefined reference to `__aeabi_ldivmod'
kernel/built-in.o: In function `_td_get_tim_u':
wait.c:(.text+0x11778): undefined reference to `__aeabi_uidiv'
wait.c:(.text+0x1178c): undefined reference to `__aeabi_ldivmod'
kernel/built-in.o: In function `_td_get_otm':
wait.c:(.text+0x117ec): undefined reference to `__aeabi_ldivmod'
wait.c:(.text+0x1187c): undefined reference to `__aeabi_uidiv'
wait.c:(.text+0x11890): undefined reference to `__aeabi_ldivmod'
kernel/built-in.o: In function `_td_get_otm_u':
wait.c:(.text+0x1194c): undefined reference to `__aeabi_uidiv'
wait.c:(.text+0x11960): undefined reference to `__aeabi_ldivmod'
kernel/built-in.o: In function `_tk_cre_cyc_u':
wait.c:(.text+0x11d50): undefined reference to `__aeabi_uldivmod'
kernel/built-in.o: In function `_tk_sta_cyc':
wait.c:(.text+0x121ac): undefined reference to `__aeabi_uldivmod'
kernel/built-in.o: In function `_tk_ref_cyc_u':
wait.c:(.text+0x12460): undefined reference to `__aeabi_uldivmod'
kernel/built-in.o: In function `_tk_ref_cyc':
wait.c:(.text+0x12548): undefined reference to `__aeabi_uldivmod'
kernel/built-in.o: In function `_td_ref_cyc_u':
wait.c:(.text+0x127d0): undefined reference to `__aeabi_uldivmod'
kernel/built-in.o:wait.c:(.text+0x12890): more undefined references to `__aeabi_uldivmod' follow
kernel/built-in.o: In function `timer_initialize':
wait.c:(.text+0x133cc): undefined reference to `__aeabi_uidiv'
wait.c:(.text+0x133f0): undefined reference to `__aeabi_uldivmod'
kernel/built-in.o: In function `adjust_time':
wait.c:(.text+0x13524): undefined reference to `__aeabi_uidiv'
wait.c:(.text+0x13538): undefined reference to `__aeabi_ldivmod'
kernel/built-in.o: In function `timer_insert':
wait.c:(.text+0x1360c): undefined reference to `__aeabi_uidiv'
wait.c:(.text+0x13620): undefined reference to `__aeabi_ldivmod'
kernel/built-in.o: In function `timer_insert_reltim':
wait.c:(.text+0x13748): undefined reference to `__aeabi_uidiv'
wait.c:(.text+0x1375c): undefined reference to `__aeabi_ldivmod'
driver/built-in.o: In function `cons_getch':
pccard.c:(.text+0x10f4): undefined reference to `__aeabi_uidivmod'
pccard.c:(.text+0x1104): undefined reference to `__aeabi_uidivmod'
driver/built-in.o: In function `cons_putch':
pccard.c:(.text+0x1198): undefined reference to `__aeabi_uidivmod'
driver/built-in.o: In function `console_io_entry':
pccard.c:(.text+0x1e58): undefined reference to `__aeabi_uidivmod'
pccard.c:(.text+0x1fc0): undefined reference to `__aeabi_uidivmod'
driver/built-in.o:pccard.c:(.text+0x1fd0): more undefined references to `__aeabi_uidivmod' follow
driver/built-in.o: In function `init_sio':
pccard.c:(.text+0x2dcc): undefined reference to `__aeabi_idiv'
driver/built-in.o: In function `sio_inthdr':
pccard.c:(.text+0x3204): undefined reference to `__aeabi_uidivmod'
driver/built-in.o: In function `ns16450_in':
pccard.c:(.text+0x3784): undefined reference to `__aeabi_uidivmod'
driver/built-in.o: In function `simMove':
pccard.c:(.text+0x6794): undefined reference to `__aeabi_idiv'
driver/built-in.o: In function `MemAlloc':
pccard.c:(.text+0x75b0): undefined reference to `__aeabi_idiv'
driver/built-in.o: In function `kpScalingPos':
pccard.c:(.text+0x7794): undefined reference to `__aeabi_idiv'
pccard.c:(.text+0x77ac): undefined reference to `__aeabi_idiv'
pccard.c:(.text+0x77e0): undefined reference to `__aeabi_idiv'
driver/built-in.o:pccard.c:(.text+0x7834): more undefined references to `__aeabi_idiv' follow
driver/built-in.o: In function `ataSetupPart':
pccard.c:(.text+0xb224): undefined reference to `__aeabi_uidivmod'
pccard.c:(.text+0xb244): undefined reference to `__aeabi_uidiv'
pccard.c:(.text+0xb2dc): undefined reference to `__aeabi_idiv'
pccard.c:(.text+0xb2e4): undefined reference to `__aeabi_idiv'
driver/built-in.o: In function `ataCmd':
pccard.c:(.text+0xb800): undefined reference to `__aeabi_uidivmod'
pccard.c:(.text+0xb810): undefined reference to `__aeabi_uidiv'
pccard.c:(.text+0xb824): undefined reference to `__aeabi_idivmod'
pccard.c:(.text+0xb838): undefined reference to `__aeabi_idiv'
driver/built-in.o: In function `memIdentify':
pccard.c:(.text+0xc688): undefined reference to `__aeabi_idiv'
Makefile:974: recipe for target 'vmtronx' failed
make: *** [vmtronx] Error 1
du@book:~/open-t-kernel/tkernel_source$
----------------------------------------------------------------------
先把所有缺漏的函数用空函数补全,放于如下:
----8<----------------------------------------------------------------
@ sysdepend/arm/lib/libgcc.S
.globl __aeabi_idiv
.globl __aeabi_idivmod
.globl __aeabi_uidiv
.globl __aeabi_uidivmod
.globl __divsi3
.globl __modsi3
.globl __udivsi3
.globl __umodsi3
.globl __aeabi_ldivmod
.globl __aeabi_uldivmod
__aeabi_idiv:
__aeabi_idivmod:
__aeabi_uidiv:
__aeabi_uidivmod:
__divsi3:
__modsi3:
__udivsi3:
__umodsi3:
__aeabi_ldivmod:
__aeabi_uldivmod:
bx lr
.end
-----8<---------------------------------------------------------------
再添加到工程中
-----8<---------------------------------------------------------------
@ sysdepend/arm/lib/Makefile
obj-y += crt/
obj-y += libsvc/
obj-y += libtk/
obj-y += libgcc.o
-----8<---------------------------------------------------------------
编译通过。
--
...
duhuanpeng.
u74147@xxxxxxxxx
Follow ups