我正在使用 armcc
和 armlink
来编译和链接我的程序。编译源代码后,我试图用 armlink
命令链接它们,但我得到了这个错误:
fatal error :./Release/Source/BookCity/bookcity_Protocol.o 有相反的字节
对前面的对象进行排序。
这个错误是什么意思?如何更改 armcc
中的字节顺序?
这是我的链接命令:
armlink -bin -o ./cis-0.123.bin ../../Lib/X2API.alf ../../Lib/X2DeviceB.alf ../../Lib/X2Font。 alf ../../Lib/X2PPPTCP.alf ./Release/Source/BookCity/bookcity_Protocol.o ./Release/Source/BookCity/bookcity_configuration.o ./Release/Source/BookCity/bookcity_initialization.o ./Release/Source/BookCity/bookcity_transactions.o ./Release/Source/Cash/cash_configuration.o
最佳答案
看看你的数据初始化。来自“编写双端编译器”:
Data Initialization
In the BEC, pointer data types can also be attributed with a byte order. As a result, there may be situations where a pointer has the opposite byte order as the target platform. Pointers of the opposite byte order must be byte-swapped upon initialization. This presents a challenge when pointers are initialized by link time constants because these constants are unknown at compile time and are resolved later during the linking stage.
来源:http://www.drdobbs.com/architecture-and-design/writing-a-bi-endian-compiler/240003090
如果它没有解决您的问题,请考虑向编译器团队开发人员提交错误问题。这可能是内部错误。
关于c - 使用 armcc 与前面的对象相反的字节顺序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19512093/