Getting LLVM/Clang to be 16 bit aligned

佐手、 提交于 2019-12-03 22:26:49

According to clang's sources, it does support mac68k alignment rules. It seems that right now you can enable it via "#pragma options align=mac68k" only. If you're ok with small clang hacking, then you can implement the cmdline option as well and submit the patch to clang.

I would suggest looking at #pragma pack (see http://msdn.microsoft.com/en-us/library/2e70t5y1%28v=vs.80%29.aspx and http://gcc.gnu.org/onlinedocs/gcc/Structure_002dPacking-Pragmas.html). It's relatively easy to use, and should work with any compiler Apple ships.

i use the latest gcc/gortran on osx compiled by the guys at ibm, if you read the gcc manual there are at least 8 different alignment optimizations to consider not just the bulk malign

Because system-level headers assume default alignment (they don't have directives to override alignment in most cases), changing the alignment for everything will break OS calls. As such, you don't want to be doing this.

Just write a script to apply your #pragma pack(2) to the source files in question, avoiding #includes. It's relatively easy and unlikely to cause unfortunate side-effects.

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