2017-08-08 8 views
0

GCCコンパイラを使用しています。 -mno-gpoptフラグ をキャンセルした後、私はコンパイル時に次のエラーを取得しています:GCC err- "小データセクションが64KBを超えています。" "出力から追加の再配置オーバーフローが発生する1> collect2.exe:エラー:ldが1終了ステータスを返す"

c:/................../ld.exe: small-data section exceeds 64KB; 
lower small-data size limit (see option -G) 
.....................:(.text._ii_sem+0x56): relocation truncated to fit:**** 
........................ 
......................(.text._ii_+0x128): additional relocation overflows omitted from the output 
collect2.exe: error: ld returned 1 exit status 
make: *** [Makefile:76: ps100] Error 1 

(-Gオプションを参照してください) - "小データセクション" とは何MIPSのdocumantation

This option directs the compiler to put definitions of externally-visible data in a small data section when that data is no bigger than num bytes. GCC can then use gp-relative addressing, which is a powerful tool for reducing code size and is a favorite among toolchain designers. Data that is stored within reach of the gp register can be accessed in a single instruction using a signed, 16-bit offset from the gp register ($28). Because the maximum addressing range is 64K bytes, the total size of the small data section (.sdata, .sbss , .scommon) should be less than 64K bytes.

、どのようにサイズを制御できますか? 小さなセクションにデータが保存されていますか? -g defaultとは何ですか?つまり、「num」がMakefileに記述されていないとしますか?

編集:私は "-G0"を使用しようとしましたが、私は同じエラーがあります。 .oファイルをチェックし、.sbss/.sdataセクションが見つかりませんでした。なぜ私は同じエラーが発生しているすべてのアイデア?

答えて

1

コンパイラには "-G0"オプションを使用できます。 "-G"オプションは、小さなデータセクションの変数の最大サイズを設定します。この場合、sbss/sdata/scommonにはデータはありません。

+0

ありがとう、私は "-G0"を使用しようとしましたが、私は同じエラーが発生します。 – David

+0

ほとんどのライブラリ(libc、libm、...)は-G4キーで構築され、グローバルデータはsbss/sdataセクションにあります。あなた自身でgccをコンパイルするか、いくつかのprebuiltを使用しますか? –

+0

はい、私はいくつかのprebuiltを使用します。 – David

関連する問題