branch out of range compile error

匿名 (未验证) 提交于 2019-12-03 00:59:01

问题:

I get the following compile errors when compiling to the device. (When compiling to simulator everything is OK)

/var/folders/3B/3BAjD+ANHHmfh-eIWrtXDU+++TI/-Tmp-/cc-hojnUD.s:1784380:branch out of range /var/folders/3B/3BAjD+ANHHmfh-eIWrtXDU+++TI/-Tmp-/cc-hojnUD.s:1784372:branch out of range /var/folders/3B/3BAjD+ANHHmfh-eIWrtXDU+++TI/-Tmp-/cc-hojnUD.s:1784364:branch out of range /var/folders/3B/3BAjD+ANHHmfh-eIWrtXDU+++TI/-Tmp-/cc-hojnUD.s:1784356:branch out of range

In various places I read something about turning off "Thumb". I don't really know if this would resolve the issue since I can't find this compile option anywhere.

I have some pretty large init files (with more than 50k lines) doing nothing else but defining NSMutuable array and stuf like that.

I can't get my app to compile for the iPhone anymore because of this error.

Do you have any idea what I can do about this?

ps. I use Xcode 4.2 with Apple LLVM 3.0 (using ARM, so I can't change the compiler)

Many thanks!

回答1:

(Moved from comment). Is your init file one huge function? If so, it may help to break the function into smaller pieces and have a master function call the pieces in order.



回答2:

This is a known linker bug (rdar://16186742). The problem is with the armv7 compiler, when it needs to synthesize branch islands to jump further than 16 MB, and the jump happens to be exactly 16 MB. The work around is to rearrange the source files in the project build phases and/or libraries in the Link Binary with Libraries section. With a few re-arrangements this problem should go away.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!