-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add -m[no-]unaligned-access #62
Conversation
These two options are negative equivalent to -m[no-]strict-align. Signed-off-by: Wang Pengcheng <wangpengcheng.pp@bytedance.com>
Signed-off-by: Wang Pengcheng <wangpengcheng.pp@bytedance.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this patch is missing an explanation of why we'd want two ways of doing the same thing. It's probably clear to you, or else you wouldn't have proposed it, but it isn't clear to me.
Oh sorry! The background is: Clang/LLVM has supported both ways (same as AArch32/AArch64/LoongArch). def munaligned_access : Flag<["-"], "munaligned-access">, Group<m_Group>,
HelpText<"Allow memory accesses to be unaligned (AArch32/AArch64/LoongArch/RISC-V only)">;
def mno_unaligned_access : Flag<["-"], "mno-unaligned-access">, Group<m_Group>,
HelpText<"Force all memory accesses to be aligned (AArch32/AArch64/LoongArch/RISC-V only)">;
def mstrict_align : Flag<["-"], "mstrict-align">, Alias<mno_unaligned_access>,
Flags<[HelpHidden]>, Visibility<[ClangOption, CC1Option]>,
HelpText<"Force all memory accesses to be aligned (same as mno-unaligned-access)">;
def mno_strict_align : Flag<["-"], "mno-strict-align">, Alias<munaligned_access>,
Flags<[HelpHidden]>, Visibility<[ClangOption, CC1Option]>,
HelpText<"Allow memory accesses to be unaligned (same as munaligned-access)">; This can reduce some miscompiles when migrating some existed software packages. |
@wangpc-pp I am not qualified to comment on whether that's a sufficient justification, but my point was, the explanation needs to go into the document. Perhaps it could be a non-normative note, but regardless, readers will want to understand why there are two ways to do the same thing. |
Signed-off-by: Wang Pengcheng <wangpengcheng.pp@bytedance.com>
Signed-off-by: Wang Pengcheng <wangpengcheng.pp@bytedance.com>
Ping for comments. :-) |
I don't think this is sufficient motivation. It's unfortunate that Clang uses |
GCC ports only supports one of the options, with -mstrict-align preferred by newer ports. They reject adding -m[no-]unaligned-access to newer ports that use -m[no-]strict-align. (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111555). We should not support aliases, either. Since the behavior has been long-time for ARM (a146a48), support both forms for ARM for now but remove -m[no-]unaligned-access for RISC-V/LoongArch (see also riscv-non-isa/riscv-c-api-doc#62). While here, add TargetSpecific to ensure errors on unsupported targets (https://reviews.llvm.org/D151590) and remove unneeded CC1 options. Pull Request: #85350
These two options are negative equivalent to -m[no-]strict-align.
Clang/LLVM has supported both ways (same as AArch32/AArch64/LoongArch).
This can reduce some miscompiles when migrating some existed software packages.