我使用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默認值,即如果在Makefile中沒有提到「num」?
編輯:我曾嘗試使用「-G0」而且,我已經得到了同樣的錯誤。我檢查了.o文件並沒有找到.sbss/.sdata節。任何想法爲什麼我得到相同的錯誤?
謝謝,我曾嘗試使用「-G0」,我也得到了同樣的錯誤,任何想法,爲什麼? – David
最有可能的庫(libc,libm,...)是使用-G4鍵構建的,其全局數據位於sbss/sdata節中。 Dou自己編譯gcc還是使用一些預編譯的? –
是的,我使用一些預製。 – David