Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ARM test problem #1

Merged
merged 2 commits into from Oct 10, 2011
Merged

Fix ARM test problem #1

merged 2 commits into from Oct 10, 2011

Conversation

syohex
Copy link
Collaborator

@syohex syohex commented Oct 10, 2011

RT:71407の ARMでテストが通らないという問題を修正しました。
ARMでテストが通らなかった原因は OABIという ABIに起因するものです。

詳しい資料があればいいのですが、見当たらない概要だけ。
OABIでは doubleの保存の方法が特殊で 8byteを 4byte + 4byteと分けて
データを保存します。double型の 1の表現は以下のようになります。

0000000000000ff3 : 一般的な little endian
00000ff300000000 : OABI ARM

なんで, OABIの場合は, 前の 4byteと後の 4byteをスワップしてから
エンコード、デコードをする必要があります。

私が直したのは PP版だけです。msgpack(sysdep.hにあるマクロ)が
そもそも OABIを考慮していないので、XS版ではこけているようです。

なお最近の ARM環境はほとんど EABIという ABIを使っているので、
上記の問題は発生しません。EABIでは他のアーキテクチャと同様の
格納方法になっています。

手元の Little endianの OABI ARMでテストをパスすることを確認しました。
bigendian ARMは環境がないのでテストしていません。
クロスコンパイラをつくってバイナリを確認したところ、little endianと
同様のバイトの並びだったので、たぶん動作すると思います。

確認のほどよろしくお願いします。

And change decision of endian because ARM OABI double-precision order
is different from normal little-endian and normal big-endian.

On normal little endian, double-precision '1' is represented
"\x00\x00\x00\x00\x00\x00\xf0\x3f", but on little endian OABI ARM,
double-precision '1' is represented "\x00\x00\xf0\x3f\x00\x00\x00\x00".
@gfx
Copy link
Member

gfx commented Oct 10, 2011

なるほど。こういうアーキテクチャなんですね。
XS版も修正してからリリースしたいのですが、判別方法がよくわかりません。
#if defined(arm) && !defined(ARM_EABI) で合ってますかね…。

@gfx
Copy link
Member

gfx commented Oct 10, 2011

ああ!armとARM_EABIはアンスコ2つで囲まれてます!

@gfx gfx merged commit f36c540 into msgpack:master Oct 10, 2011
@gfx
Copy link
Member

gfx commented Oct 10, 2011

パッチ書いたので試してみていただけますでしょうか!
動くようならmsgpack本体を修正します。
https://github.com/msgpack/msgpack-perl/blob/master/arm-oabi.patch
(msgpack-perlでMakefile.PLすればpatchを当ててビルドします。)

@syohex
Copy link
Collaborator Author

syohex commented Oct 10, 2011

パッチ適用の結果 XS版でもテストをすべて通ることを確認しました。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants