Skip to content

Commit 30b9537

Browse files
committed
[Driver] Add m_Group to -m[no-]strict-align
so that `Args.ClaimAllArgs(options::OPT_CompileOnly_Group);` in Driver::handleArguments will claim the options even if only linking is performed. Fix #87945
1 parent 5b4ed0d commit 30b9537

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4747,9 +4747,9 @@ def munaligned_symbols : Flag<["-"], "munaligned-symbols">, Group<m_Group>,
47474747
HelpText<"Expect external char-aligned symbols to be without ABI alignment (SystemZ only)">;
47484748
def mno_unaligned_symbols : Flag<["-"], "mno-unaligned-symbols">, Group<m_Group>,
47494749
HelpText<"Expect external char-aligned symbols to be without ABI alignment (SystemZ only)">;
4750-
def mstrict_align : Flag<["-"], "mstrict-align">,
4750+
def mstrict_align : Flag<["-"], "mstrict-align">, Group<m_Group>,
47514751
HelpText<"Force all memory accesses to be aligned (AArch64/LoongArch/RISC-V only)">;
4752-
def mno_strict_align : Flag<["-"], "mno-strict-align">,
4752+
def mno_strict_align : Flag<["-"], "mno-strict-align">, Group<m_Group>,
47534753
HelpText<"Allow memory accesses to be unaligned (AArch64/LoongArch/RISC-V only)">;
47544754
def mno_thumb : Flag<["-"], "mno-thumb">, Group<m_arm_Features_Group>;
47554755
def mrestrict_it: Flag<["-"], "mrestrict-it">, Group<m_arm_Features_Group>,

clang/test/Driver/riscv-features.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737

3838
// RUN: %clang --target=riscv32-unknown-elf -### %s -mno-strict-align 2>&1 | FileCheck %s -check-prefix=FAST-UNALIGNED-ACCESS
3939
// RUN: %clang --target=riscv32-unknown-elf -### %s -mstrict-align 2>&1 | FileCheck %s -check-prefix=NO-FAST-UNALIGNED-ACCESS
40+
// RUN: touch %t.o
41+
// RUN: %clang --target=riscv32-unknown-elf -### %t.o -mno-strict-align -mstrict-align
4042

4143
// FAST-UNALIGNED-ACCESS: "-target-feature" "+unaligned-scalar-mem" "-target-feature" "+unaligned-vector-mem"
4244
// NO-FAST-UNALIGNED-ACCESS: "-target-feature" "-unaligned-scalar-mem" "-target-feature" "-unaligned-vector-mem"

0 commit comments

Comments
 (0)