iOS で使用する arm64 用の C ライブラリ (GMP 6.0.0) を構築しようとしています。以下の呼び出しでconfigureスクリプトを実行しています(コンパイラはxcrun --findを使用して見つかったものです)。
./configure \
CC="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" \
CPP="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -E" \
CPPFLAGS="-target arm64-apple-darwin -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/ -miphoneos-version-min=7.0" \
--host=aarch64-apple-darwin
ただし、これは次の行で失敗します (「長い長い信頼性テスト 1」)。
checking compiler /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -O2 -pedantic -target arm64-apple-darwin -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/ -miphoneos-version-min=7.0... no, long long reliability test 1
configure: error: could not find a working compiler, see config.log for details
完全な config.logはこちらから入手できます。次のような長い長い信頼性テストのコンパイルに関する複数の警告とエラーが表示されます。
conftest.c:9:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
f(){static const struct{t1 n;t1 src[9];t1 want[9];}d[]={{1,{0},{1}},};t1 got[9];int i;
^
conftest.c:10:44: error: implicit declaration of function 'h' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
for(i=0;i<1;i++){if(e(got,got,9,d[i].n)==0)h();g(i,d[i].src,d[i].n,got,d[i].want,9);if(d[i].n)h();}}
^
conftest.c:10:48: error: implicit declaration of function 'g' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
for(i=0;i<1;i++){if(e(got,got,9,d[i].n)==0)h();g(i,d[i].src,d[i].n,got,d[i].want,9);if(d[i].n)h();}}
^
conftest.c:10:100: warning: control reaches end of non-void function [-Wreturn-type]
for(i=0;i<1;i++){if(e(got,got,9,d[i].n)==0)h();g(i,d[i].src,d[i].n,got,d[i].want,9);if(d[i].n)h();}}
^
それを使用--host=none
すると問題なく動作しますが、arm64 用に最適化されたアセンブリでビルドする方法を理解したいと思っています。
私のシステムは x86_64-apple-darwin13.1.0 (または config.guess によると coreisbr-apple-darwin13.1.0) で、OS X v10.9.2 を実行する初期の '11 Core i7 MBP です。Xcode 5.1 (5B130a) を使用しています。
どんな助けでも感謝します。
編集1
ARMv7 用にコンパイルすると configure はパスしますが、make で失敗します (configure/make の完全な出力はこちら)。アセンブリのコンパイル中に明らかに発生します。
tmp-dive_1.s:165:18: error: unexpected token in '.section' directive
.section .rodata
^
編集2
@MarcGlisse: 推奨されるエラーを無視するように clang を強制することにより (-Wno-...) arm64 は configure に合格しますが、make で失敗します (完全な出力はこちら):
tmp-mul_1.s:59:2: error: unrecognized instruction mnemonic
bcc Lfi1
^
tmp-mul_1.s:60:2: error: unrecognized instruction mnemonic
beq Lfi2
^
補足として、これらのコミットは、エラーを抑制する必要をなくすことを意図していると思いますが、機能していないようです。つまり、抑制を削除すると同じエラーが発生します。
armv7 の場合、これらのコミットを推奨どおりに使用すると .section エラーが修正されますが、make は後で次のように失敗します (完全な出力はこちら)。
tmp-mode1o.s:64:2: error: unknown directive
.protected ___gmp_binvert_limb_table
^
編集3
提案された編集を使用すると、armv7、armv7s、i386、および x86_64 がすべてアセンブリでコンパイルされるようになりました。
arm64 の場合、編集により以前のエラーが解消されますが、無効な入力制約 'rZ' に関するいくつかのエラーがすべて同じファイルに表示されます (完全な出力はこちら)。
divrem_1.c:237:5: error: invalid input constraint 'rZ' in asm
udiv_qrnnd_preinv (*qp, r, r, nshift, d, dinv);
^
../gmp-impl.h:3062:2: note: expanded from macro 'udiv_qrnnd_preinv'
add_ssaaaa (_qh, _ql, _qh, _ql, (nh) + 1, (nl)); \
^
../longlong.h:551:7: note: expanded from macro 'add_ssaaaa'
: "rZ" (ah), "rZ" (bh), "%r" (al), "rI" (bl) __CLOBBER_CC)
編集4
longlong.h でコメント アウトadd_ssaaaa
しsub_ddmmss
、gcd_1.asm ( blo
tob.lo
など) でさらにいくつかのアセンブリ命令を編集した後、次のエラーのいくつかで失敗するようになりました (完全な出力はこちら)。
tmp-invert_limb.s:75:22: error: immediate value expected for shifter operand
add x1, x1, x2, lsr 1
^
tmp-invert_limb.s:75:22: error: invalid operand for instruction
add x1, x1, x2, lsr 1
^
後で全体の差分を投稿します。
編集5
わかりました、これでさらに一歩進みますが、次のようになります (完全な出力はこちら):
tmp-invert_limb.s:52:2: error: ADR/ADRP relocations must be GOT relative
adrp x1, approx_tab
^
これが続く場合は、メールでこれを続ける方が良いかもしれません.