编译 WebKitGtk 过程中,链接测试程序阶段报出 undefined symbol ‘__sync_add_and_fetch_8’,这是由于 ‘__sync_add_and_fetch_8’ 在 MIPS O32 平台上没有实现,但龙芯实际上是 64-bit 的 CPU,所以可以使用下面的实现:
#include
#include
LEAF(__sync_add_and_fetch_8)
.set push
.set mips64r2
.set noreorder
dins t0, a2, 0, 32
dins t0, a3, 32, 32
sync
_retry:
lld t1, 0(a0)
daddu t1, t1, t0
scd t1, 0(a0)
beqz t1, _retry
daddu t1, t1, t0
sync
dext v0, t1, 0, 32
jr ra
dext v1, t1, 32, 32
.set pop
END(__sync_add_and_fetch_8)
Over!
能否给一个完整的patch?非常感谢!
完整的 patch 目前没有,只要把这段代码另存为一个文件 sync.S,加入到需要到地方编译、链接就行啦。