使LLVM/Clang对齐16位 [英] Getting LLVM/Clang to be 16 bit aligned

查看:155
本文介绍了使LLVM/Clang对齐16位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一个遗留项目,该遗留项目具有大量可追溯到OS X以前的文件.它的数据经过16位对齐已超过15年.我想转向完整的LLVM编译,但似乎无法使2字节对齐正常工作.是否有任何可用的编译器级别选项? (以前使用-malign-mac68k)

I am working on a legacy project that has a large amount of files dating back to pre-OS X days. It's data has been 16 bit aligned for > 15 years. I would like to move to a full LLVM compilation but I can't seem to get 2 byte alignment working. Are there any compiler level options available for this? (previously using -malign-mac68k)

我知道这里的#pragma pack(2)选项.但是,这将需要我修改1000多个源文件才能包含此文件.那是最坏的选择,但看起来像是骇客.此外,如果可以的话,那么肯定有一个默认选项可以设置对齐方式吗?

I am aware of the #pragma pack(2) option here. However that would require me to modify upwards of 1000 source files to include this. That it's a worst-case option, but it seems like a hack. Besides, if this is possible then surely there is a default option to set the alignment?

推荐答案

根据clang的消息来源,它确实支持mac68k对齐规则.看来现在您只能通过"#pragma options align = mac68k"启用它.如果您可以接受小型clang黑客攻击,那么也可以实现cmdline选项,然后将修补程序提交给clang.

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.

这篇关于使LLVM/Clang对齐16位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆