r329810 - [Driver] Don't forward -m[no-]unaligned-access options to GCC when assembling/linking

Chad Rosier via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 11 07:20:37 PDT 2018


Author: mcrosier
Date: Wed Apr 11 07:20:37 2018
New Revision: 329810

URL: http://llvm.org/viewvc/llvm-project?rev=329810&view=rev
Log:
[Driver] Don't forward -m[no-]unaligned-access options to GCC when assembling/linking

Differential Revision: https://reviews.llvm.org/D45092

Modified:
    cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
    cfe/trunk/test/Driver/gcc_forward.c

Modified: cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Gnu.cpp?rev=329810&r1=329809&r2=329810&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/Gnu.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Gnu.cpp Wed Apr 11 07:20:37 2018
@@ -85,6 +85,13 @@ void tools::gcc::Common::ConstructJob(Co
           A->getOption().matches(options::OPT_W_Group))
         continue;
 
+      // Don't forward -mno-unaligned-access since GCC doesn't understand
+      // it and because it doesn't affect the assembly or link steps.
+      if ((isa<AssembleJobAction>(JA) || isa<LinkJobAction>(JA)) &&
+          (A->getOption().matches(options::OPT_munaligned_access) ||
+           A->getOption().matches(options::OPT_mno_unaligned_access)))
+        continue;
+
       A->render(Args, CmdArgs);
     }
   }

Modified: cfe/trunk/test/Driver/gcc_forward.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/gcc_forward.c?rev=329810&r1=329809&r2=329810&view=diff
==============================================================================
--- cfe/trunk/test/Driver/gcc_forward.c (original)
+++ cfe/trunk/test/Driver/gcc_forward.c Wed Apr 11 07:20:37 2018
@@ -34,3 +34,9 @@
 // RUN:   | FileCheck --check-prefix=CHECK-ASM %s
 // CHECK-ASM: as
 // CHECK-ASM-NOT: "-g"
+
+// Check that we're not forwarding -mno-unaligned-access.
+// RUN: %clang -target aarch64-none-elf -mno-unaligned-access %s -### 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-ARM %s
+// CHECK-ARM: gcc{{[^"]*}}"
+// CHECK-ARM-NOT: -mno-unaligned-access




More information about the cfe-commits mailing list