[clang] 30b9537 - [Driver] Add m_Group to -m[no-]strict-align

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 19 11:52:08 PDT 2024


Author: Fangrui Song
Date: 2024-04-19T11:52:02-07:00
New Revision: 30b9537ff438366547f968c7909718e27d65c815

URL: https://github.com/llvm/llvm-project/commit/30b9537ff438366547f968c7909718e27d65c815
DIFF: https://github.com/llvm/llvm-project/commit/30b9537ff438366547f968c7909718e27d65c815.diff

LOG: [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

Added: 
    

Modified: 
    clang/include/clang/Driver/Options.td
    clang/test/Driver/riscv-features.c

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index d83031b05cebc4..46225e2c7285ef 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -4747,9 +4747,9 @@ def munaligned_symbols : Flag<["-"], "munaligned-symbols">, Group<m_Group>,
   HelpText<"Expect external char-aligned symbols to be without ABI alignment (SystemZ only)">;
 def mno_unaligned_symbols : Flag<["-"], "mno-unaligned-symbols">, Group<m_Group>,
   HelpText<"Expect external char-aligned symbols to be without ABI alignment (SystemZ only)">;
-def mstrict_align : Flag<["-"], "mstrict-align">,
+def mstrict_align : Flag<["-"], "mstrict-align">, Group<m_Group>,
   HelpText<"Force all memory accesses to be aligned (AArch64/LoongArch/RISC-V only)">;
-def mno_strict_align : Flag<["-"], "mno-strict-align">,
+def mno_strict_align : Flag<["-"], "mno-strict-align">, Group<m_Group>,
   HelpText<"Allow memory accesses to be unaligned (AArch64/LoongArch/RISC-V only)">;
 def mno_thumb : Flag<["-"], "mno-thumb">, Group<m_arm_Features_Group>;
 def mrestrict_it: Flag<["-"], "mrestrict-it">, Group<m_arm_Features_Group>,

diff  --git a/clang/test/Driver/riscv-features.c b/clang/test/Driver/riscv-features.c
index 5e1db5ba1ed3e9..cfe293cd4667ff 100644
--- a/clang/test/Driver/riscv-features.c
+++ b/clang/test/Driver/riscv-features.c
@@ -37,6 +37,8 @@
 
 // RUN: %clang --target=riscv32-unknown-elf -### %s -mno-strict-align 2>&1 | FileCheck %s -check-prefix=FAST-UNALIGNED-ACCESS
 // RUN: %clang --target=riscv32-unknown-elf -### %s -mstrict-align 2>&1 | FileCheck %s -check-prefix=NO-FAST-UNALIGNED-ACCESS
+// RUN: touch %t.o
+// RUN: %clang --target=riscv32-unknown-elf -### %t.o -mno-strict-align -mstrict-align
 
 // FAST-UNALIGNED-ACCESS: "-target-feature" "+unaligned-scalar-mem" "-target-feature" "+unaligned-vector-mem"
 // NO-FAST-UNALIGNED-ACCESS: "-target-feature" "-unaligned-scalar-mem" "-target-feature" "-unaligned-vector-mem"


        


More information about the cfe-commits mailing list