<div dir="ltr">On Sun, May 25, 2014 at 11:04 PM, Guo Yixuan <<a href="mailto:culu.gyx@gmail.com">culu.gyx@gmail.com</a>> wrote:<br>> I've built librime and tried to build brise, under sparc. And it just failed<br>
> with a bus error (SIGBUS), similar to many other architectures.[1]<br>><br>> It appears to be a misaligned access, thus probably a bug in g++.<div>> (I've tried both g++-4.8 and g++-4.9)</div><div>><br>
> $ gdb rime_deployer<br><br></div><div>[...]</div><div><br>> Program received signal SIGBUS, Bus error.<br>> 0xf7e795bc in rime::Table::BuildHeadIndex (this=this@entry=0x37b4c, vocabulary=..., num_syllables=num_syllables@entry=422)<br>
> at /mnt/sdb2/pkg2/ime/librime/src/dict/table.cc:300<br>> 300 for (const auto& v : vocabulary) {<br>> (gdb) x/i $pc<br>> => 0xf7e795bc <rime::Table::BuildHeadIndex(rime::Vocabulary const&, unsigned int)+188>: st %i2, [ %l2 + %l1 ]<br>
> (gdb) p/x $l2<br>> $2 = 0xf1838000 <br>> (gdb) p/x $l1<br>> $3 = 0xdca <br>> (gdb) x/i $npc<br>> 0xf7e795c0 <rime::Table::BuildHeadIndex(rime::Vocabulary const&, unsigned int)+192>: add %fp, -12, %i2<br>
> (gdb) p $i2<br>> $4 = 422<br>><br>> Because (%l2 + %l1) % 4 != 0, the instruction <br>> "st %i2, [ %l2 + %l1 ]" generated a SIGBUS,<br>><br>> arm* and mips* are also RISC with stricter memory<br>
> alignment requirement, so the other FTBFSes could<br>> be of the same reason.<br>><br>> [1] <a href="https://buildd.debian.org/status/package.php?p=brise">https://buildd.debian.org/status/package.php?p=brise</a><br>
<br>I made the wrong guess. In fact, this misaligned access</div><div>is intended, to store num_syllables (422 or 0x1a6) to</div><div>offset 0xdca in luna_pinyin.table.bin:</div><div><br></div><div>on amd64:</div><div>$ hd /usr/share/rime-data/luna_pinyin.table.bin<br>
</div><div>[...]</div><div><div>00000da0 7a 68 75 6e 00 7a 68 75 6f 00 7a 69 00 7a 6f 6e |zhun.zhuo.zi.zon|<br></div><div>00000db0 67 00 7a 6f 75 00 7a 75 00 7a 75 61 6e 00 7a 75 |g.zou.zu.zuan.zu|</div><div>00000dc0 69 00 7a 75 6e 00 7a 75 6f 00 a6 01 00 00 0c 00 |i.zun.zuo.......|</div>
<div>00000dd0 00 00 c4 13 00 00 53 14 00 00 9d 00 00 00 fb 80 |......S.........|</div><div>00000de0 00 00 83 88 00 00 88 00 00 00 03 00 01 00 87 06 |................|</div><div>[...]<br></div><div><br></div>on sparc:</div>
<div>$ hd data/luna_pinyin.table.bin # SIGBUS occured when writing at 0xdca<br></div><div><div>00000da0 7a 68 75 6e 00 7a 68 75 6f 00 7a 69 00 7a 6f 6e |zhun.zhuo.zi.zon|<br></div><div>00000db0 67 00 7a 6f 75 00 7a 75 00 7a 75 61 6e 00 7a 75 |g.zou.zu.zuan.zu|</div>
<div>00000dc0 69 00 7a 75 6e 00 7a 75 6f 00 00 00 00 00 00 00 |i.zun.zuo.......|</div><div>00000dd0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|</div><div>*</div><div>0296cec0</div><div><br></div>
</div><div>I'm not sure if there's any easy fix for this problem...</div><div><br></div><div>Regards,</div><div><br></div><div>Yixuan</div></div>